Package org.wso2.carbon.registry.core

Examples of org.wso2.carbon.registry.core.Association


    }

    // method to obtain associations from a feed.
    private static Association[] getAssociationsFromFeed(Feed feed, String resourcePath) {
        List entries = feed.getEntries();
        Association associations[] = null;
        if (entries != null) {
            associations = new Association[entries.size()];
            for (int i = 0; i < entries.size(); i++) {
                Entry entry = (Entry) entries.get(i);
                Association association = new Association();
                association.setSourcePath(resourcePath);
                association.setDestinationPath(entry.getContent());
                association.setAssociationType(entry.getSummary());
                associations[i] = association;
            }
        }
        return associations;
    }
View Full Code Here


                                associationType),
                        getAuthorization());
        Document introspection = clientResponse.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        List entries = feed.getEntries();
        Association associations[] = null;
        if (entries != null) {
            associations = new Association[entries.size()];
            for (int i = 0; i < entries.size(); i++) {
                Entry entry = (Entry) entries.get(i);
                Association association = new Association();
                association.setSourcePath(resourcePath);
                association.setDestinationPath(entry.getContent());
                association.setAssociationType(associationType);
                associations[i] = association;
            }
        }
        abderaClient.teardown();
        return associations;
View Full Code Here

                                                length());
                    } else {
                        destination =
                                RegistryUtils.getAbsoluteAssociationPath(destination, path);
                    }
                    associationList.add(new Association(source, destination, type));
                }
            }
            // getting children, just storing in array list now, will used at the end
            // we are keeping old name to keep backward compatibility.
            else if (localName.equals(DumpConstants.CHILDREN) ||
View Full Code Here

        registry.addAssociation(r1.getPath(), "/depTest/test1/r2", Association.DEPENDS);


        Resource r21 = registry.get("/depTest/test1/r1");
        Resource r22 = registry.get("/depTest/test1/r2");
        Association association[] = registry.getAllAssociations(r21.getPath());
        assertNotNull(association);
        boolean foundForward = false;
        boolean foundBackward = false;
        for (Association association1 : association) {
            if ("/depTest/test1/r2".equals(association1.getDestinationPath())) {
View Full Code Here

        registry.addAssociation("/depTest/test2/r2", "/depTest/test2/r1", Association.DEPENDS);
        registry.addAssociation("/depTest/test2/r1", "/depTest/test2/r2", Association.DEPENDS);

        Resource r21 = registry.get("/depTest/test2/r1");
        Resource r22 = registry.get("/depTest/test2/r2");
        Association association[] = registry.getAllAssociations(r21.getPath());
        assertNotNull(association);
        boolean found = false;
        for (Association association1 : association) {
            if ("/depTest/test2/r2".equals(association1.getDestinationPath())) {
                found = true;
View Full Code Here

            List fatherAsso = provideChildAssociations(resourcePath, associationType, userRegistry);
            if (fatherAsso != null) {
                Iterator ifatherAssofaterAsso = fatherAsso.iterator();

                while (ifatherAssofaterAsso.hasNext()) {
                    Association asso = (Association) ifatherAssofaterAsso.next();
                    associationTreeBean.setAssociationTree(associationTreeBean.getAssociationTree() +
                            createAssociationTree(
                                    asso, associationTreeBean, userRegistry));

                }
View Full Code Here

            if (!foundInfinite) {
                if (!fatherAsso.isEmpty()) {
                    boolean showChildren = false;
                    Iterator iFaterAsso = fatherAsso.iterator();
                    while (iFaterAsso.hasNext()) {
                        Association asso = (Association) iFaterAsso.next();

                        // if path is equal to the destination path, it is a backward association. we are only displaying
                        // the forward associations here
                        if (!path.equals(asso.getDestinationPath())) {
                            if (!paths.contains(asso.getDestinationPath())) {
                                showChildren = true;
                                break;
                            }
                        }
                    }
                    if (showChildren) {
                        associationTreePart.append("<a onclick=\"showHideCommon('y_").append(
                                associationTreeBean.getAssoIndex()).append(
                                "');showHideCommon('xminus_").append(
                                associationTreeBean.getAssoIndex()).append(
                                "');showHideCommon('xplus_").append(
                                associationTreeBean.getAssoIndex()).append(
                                "');\">").append(
                                "<img src=\"../resources/images/icon-tree-minus.gif\"").append(
                                "id=\"xminus_").append(associationTreeBean.getAssoIndex()).append(
                                "\" style=\"margin-right:2px;\" />").append(
                                "<img src=\"../resources/images/icon-tree-plus.gif\"").append(
                                "id=\"xplus_").append(associationTreeBean.getAssoIndex()).append(
                                "\" style=\"margin-right:2px;display:none;\" /></a>");
                    }
                } else {
                    associationTreePart.append("<img src=\"../resources/images/spacer.gif\" style=\"width:15px;\" />");
                }
            } else {
                associationTreePart.append("<img src=\"../resources/images/spacer.gif\" style=\"width:15px;\" />");
            }
            if (fatherResourceType.equals("collection")) {
                associationTreePart.append("<img src=\"../resources/images/icon-folder-small.gif\" style=\"margin-right:2px;\" />");
            } else {
                associationTreePart.append("<img src=\"../resources/images/editshred.png\" style=\"margin-right:2px;\" />");
            }

            //associationTreePart += "<a title=\"" + path + "\" href=\"resource.jsp?path=" + calculateRelativePath(path) + "\">";
            String tempPath = path;
            if (tempPath != null) {
                tempPath = tempPath.replace("&", "%26");
            }
            associationTreePart.append("<a title=\"").append(path).append(
                    "\" href=\"../resources/resource.jsp?region=region3&item=resource_browser_menu&viewType=std&path=").append(
                    tempPath).append("\">");
            String pathSmall = path;
            if (pathSmall != null) {
                if (associationTreeBean.getAssoType().equals(CommonConstants.ASSOCIATION_TYPE01)) {
                    if (pathSmall.length() >= 108) {
                        pathSmall = pathSmall.substring(0, 50) + " .... " +
                                pathSmall.substring(pathSmall.length() - 50, pathSmall.length());
                    }
                } else {
                    if (pathSmall.length() >= 68) {
                        pathSmall = pathSmall.substring(0, 30) + " .... " +
                                pathSmall.substring(pathSmall.length() - 30, pathSmall.length());
                    }
                }
            }
            if (foundInfinite) {
                associationTreePart.append(pathSmall).append("(infinite loop..)");
            } else {
                associationTreePart.append(pathSmall);
            }
            associationTreePart.append("</a></li>");
            if (!associationTreeBean.getAssoType().equals(CommonConstants.ASSOCIATION_TYPE01))
                associationTreePart.append("<li class=\"second\">").append(
                        tmpAsso.getAssociationType()).append("</li>");
            associationTreePart.append("</ul></div>");
            if (!foundInfinite && !fatherAsso.isEmpty()) {
                associationTreePart.append("<div class=\"child-objects\" id=\"y_").append(
                        associationTreeBean.getAssoIndex()).append("\">");
                Iterator iFaterAsso = fatherAsso.iterator();
                while (iFaterAsso.hasNext()) {
                    Association asso = (Association) iFaterAsso.next();

                    // if path is equal to the destination path, it is a backward association. we are only displaying
                    // the forward associations here
                    if (!path.equals(asso.getDestinationPath())) {
                        if (!paths.contains(asso.getDestinationPath())) {
                            associationTreePart.append(createAssociationTree(asso, associationTreeBean, registry));
                        }
                    }
                }
                associationTreePart.append("</div>");
View Full Code Here

        tmpAssociations.addAll(Arrays.asList(asso));

        Iterator iAssociations = tmpAssociations.iterator();
        while (iAssociations.hasNext()) {
            Association tmpAsso = (Association) iAssociations.next();
            //Get all associations filtered by it's association type
            if (!path.equals(tmpAsso.getDestinationPath())) {
                if (tmpAsso.getAssociationType().equals(CommonConstants.ASSOCIATION_TYPE01) && assoType.equals(CommonConstants.ASSOCIATION_TYPE01))
                    associations.add(tmpAsso);
                if (!tmpAsso.getAssociationType().equals(CommonConstants.ASSOCIATION_TYPE01) && !assoType.equals(CommonConstants.ASSOCIATION_TYPE01))
                    associations.add(tmpAsso);
            }
        }

        resource.discard();
View Full Code Here

                            resourcePath.getPath() : resourcePath.getPathWithVersion()));
            Resource resource = userRegistry.get(path);

            AssociationBean[] beans = new AssociationBean[asso.length];
            for (int i = 0; i < beans.length; i++) {
                Association as = asso[i];
                beans[i] = new AssociationBean(as.getSourcePath(), as.getDestinationPath(),
                        as.getAssociationType());

            }
            dependenciesBean.setAssociationBeans(beans);

            dependenciesBean.setVersionView(!resourcePath.isCurrentVersion());
View Full Code Here

        return value;
    }

    public boolean associationPathExists(String path, String assoPath)
            throws Exception {
        Association association[] = registry.getAllAssociations(path);
        boolean value = false;

        for (int i = 0; i < association.length; i++) {
            //System.out.println(association[i].getDestinationPath());
            if (assoPath.equals(association[i].getDestinationPath()))
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.Association

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.