Examples of ResourceProxy


Examples of org.apache.sling.ide.transport.ResourceProxy

            return;
        }

        while (childrenIterator.hasNext() || nodeChildrenListIt.hasNext()) {

            ResourceProxy childResource = childrenIterator.next();
            Node childNode = nodeChildrenListIt.next();

            // order is as expected, skip reordering
            if (Text.getName(childResource.getPath()).equals(childNode.getName())) {
                // descend into covered child resources once they are properly arranged and perform reordering
                if (resourceToReorder.covers(childResource.getPath())) {
                    reorderChildNodes(childNode, childResource);
                }
                continue;
            }

            // don't perform any reordering if this particular node does not have reorderable children
            if (!nodeToReorder.getPrimaryNodeType().hasOrderableChildNodes()) {
                getLogger().trace("Node at {0} does not have orderable child nodes, skipping reordering of {1}",
                        nodeToReorder.getPath(), childResource.getPath());
                continue;
            }

            String expectedParentName;
            if (childrenIterator.hasNext()) {
                expectedParentName = Text.getName(childrenIterator.next().getPath());
                childrenIterator.previous(); // move back
            } else {
                expectedParentName = null;
            }

            getLogger().trace("For node at {0} ordering {1} before {2}", nodeToReorder.getPath(),
                    Text.getName(childResource.getPath()), expectedParentName);

            nodeToReorder.orderBefore(Text.getName(childResource.getPath()), expectedParentName);
        }
    }
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

            if (!isSuccessStatus(responseStatus))
                return failureResultForStatusCode(responseStatus);

            JSONObject result = new JSONObject(get.getResponseBodyAsString());

            ResourceProxy resource = new ResourceProxy(path);
            JSONArray names = result.names();
            for (int i = 0; i < names.length(); i++) {
                String name = names.getString(i);
                Object object = result.get(name);
                if (object instanceof String) {
                    resource.addProperty(name, object);
                } else {
                    System.out.println("Property '" + name + "' of type '" + object.getClass().getName()
                            + " is not handled");
                }
            }
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

        return logger;
    }

    protected ResourceProxy nodeToResource(Node node) throws RepositoryException {
   
        ResourceProxy resource = new ResourceProxy(node.getPath());
        resource.addAdapted(Node.class, node);

        PropertyIterator properties = node.getProperties();
        while (properties.hasNext()) {
            Property property = properties.nextProperty();
            String propertyName = property.getName();
            Object propertyValue = ConversionUtils.getPropertyValue(property);
   
            if (propertyValue != null) {
                resource.addProperty(propertyName, propertyValue);
            }
        }
   
        return resource;
   
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

        }

        // phase 3: init property definitions
        for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
            VltNodeType nt = it.next();
            final ResourceProxy child = nt.getResourceProxy();
            initPropertyDefinitions(nt);
            initProperties(nt, child);
        }
       
        // phase 4: initialize the allowed primary childnodetypes
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

            initAllowedPrimaryChildNodeTypes(nt);
        }
    }
   
    private void initDeclaredFields(VltNodeType nt) {
        final ResourceProxy child = nt.getResourceProxy();
        String[] superTypeNamess = (String[]) child.getProperties()
                .get("jcr:supertypes");
        nt.setDeclaredSupertypeNames(superTypeNamess);
        if (superTypeNamess!=null) {
            NodeType[] superTypes = new NodeType[superTypeNamess.length];
            for (int i = 0; i < superTypeNamess.length; i++) {
                superTypes[i] = getNodeType(superTypeNamess[i]);
            }
            nt.setDeclaredSupertypes(superTypes);
        }

        Set<VltNodeDefinition> nds = new HashSet<VltNodeDefinition>();
        for (Iterator<ResourceProxy> it = child.getChildren().iterator(); it
                .hasNext();) {
            ResourceProxy ntChild = it.next();
            String ntChildName = PathUtil.getName(ntChild.getPath());
            if (ntChildName.startsWith("jcr:childNodeDefinition")) {
                VltNodeDefinition nd = handleChildNodeDefinition(ntChild);
                nds.add(nd);
            } else if (ntChildName.startsWith("rep:residualChildNodeDefinitions")) {
                // go through children
                List<ResourceProxy> residualChildren = ntChild.getChildren();
                for (Iterator it2 = residualChildren.iterator(); it2
                        .hasNext();) {
                    ResourceProxy residualChild = (ResourceProxy) it2
                            .next();
                    VltNodeDefinition nd = handleChildNodeDefinition(residualChild);
                    nds.add(nd);
                }
            }
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

    private void initDeclaredPropertyDefinitions(VltNodeType nt, ResourceProxy child) {
        Map<String,VltPropertyDefinition> pds = new HashMap<String,VltPropertyDefinition>();
       
        // load propertyDefinition children
        for (Iterator<ResourceProxy> it = child.getChildren().iterator(); it.hasNext();) {
            ResourceProxy aChild = it.next();
            String childName = PathUtil.getName(aChild.getPath());
            if (childName.startsWith("jcr:propertyDefinition")) {
                String jcrName = (String)aChild.getProperties().get("jcr:name");
                if (jcrName!=null) {
                    VltPropertyDefinition pd = new VltPropertyDefinition();
                    pd.setName(jcrName);
                    Boolean autoCreated = (Boolean)aChild.getProperties().get("jcr:autoCreated");
                    if (autoCreated!=null) {
                        pd.setAutoCreated(autoCreated);
                    }
                    Boolean multiple = (Boolean)aChild.getProperties().get("jcr:multiple");
                    if (multiple!=null) {
                        pd.setMultiple(multiple);
                    }
                    Boolean mandatory = (Boolean)aChild.getProperties().get("jcr:mandatory");
                    if (mandatory!=null) {
                        pd.setMandatory(mandatory);
                    }
                    Boolean isProtected = (Boolean)aChild.getProperties().get("jcr:protected");
                    if (isProtected!=null) {
                        pd.setProtected(isProtected);
                    }
                    final Object object = aChild.getProperties().get("jcr:requiredType");
                    if (object!=null) {
                        String requiredType = (String)object;
                        if (requiredType!=null) {
                            pd.setRequiredType(propertyTypeFromName(requiredType));
                        }
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

    protected ResourceProxy execute0(Session session) throws RepositoryException {

        Node node = session.getNode(getPath());
        NodeIterator nodes = node.getNodes();

        ResourceProxy parent = nodeToResource(node);

        while (nodes.hasNext()) {
            Node childNode = nodes.nextNode();

            // TODO - this should not be needed if we obey the vlt filters
            if (childNode.getPath().equals("/jcr:system")) {
                continue;
            }

            parent.addChild(nodeToResource(childNode));
        }

        return parent;
    }
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

                contentNode.setProperty(PROP_NAME, (String[]) initialPropertyValues);
            }

            session.save();

            ResourceProxy resource = newResource("/content", NodeType.NT_UNSTRUCTURED);
            if (newPropertyValues != null) {
                resource.addProperty(PROP_NAME, newPropertyValues);
            }

            AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo, credentials, null, resource, logger);
            cmd.execute().get();
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

        try {
            session.getRootNode().addNode("content", "nt:folder");

            session.save();

            ResourceProxy resource = newResource("/content", "sling:Folder");
            resource.getProperties().put("newProperty", "some/value");

            AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo, credentials, null, resource, logger);
            cmd.execute().get();

            session.refresh(false);
View Full Code Here

Examples of org.apache.sling.ide.transport.ResourceProxy

            Node content = session.getRootNode().addNode("content", "sling:Folder");
            content.setProperty("newProperty", "some/value");

            session.save();

            ResourceProxy resource = newResource("/content", "nt:folder");

            AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo, credentials, null, resource, logger);
            cmd.execute().get();

            session.refresh(false);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.