Package org.apache.sling.api.resource

Examples of org.apache.sling.api.resource.Resource.listChildren()


                                        final Iterator<Resource> minuteIter = hourResource.listChildren();
                                        while ( caps.isActive() && minuteIter.hasNext() ) {
                                            final Resource minuteResource = minuteIter.next();

                                            // check if we can delete the minute
                                            if ( !minuteResource.listChildren().hasNext() ) {
                                                resolver.delete(minuteResource);
                                                resolver.commit();
                                            }
                                        }
                                    }
View Full Code Here


        try {
            final Resource baseResource = resolver.getResource(this.configuration.getLocalJobsPath());

            // sanity check - should never be null
            if ( baseResource != null ) {
                final Iterator<Resource> topicIter = baseResource.listChildren();
                while ( topicIter.hasNext() ) {
                    final Resource topicResource = topicIter.next();
                    final String topic = topicResource.getName().replace('.', '/');
                    logger.debug("Found topic {}", topic);
                    topics.add(topic);
View Full Code Here

                Type type = Type.getType(propertyValueMap.get(Constants.PROPERTY_TYPE, String.class));
                Boolean propertyMultiple = PropertiesUtil.toBoolean(propertyValueMap.get(Constants.PROPERTY_MULTIPLE), false);
                Resource validators = property.getChild(Constants.VALIDATORS);
                Map<Validator, Map<String, String>> validatorsMap = new HashMap<Validator, Map<String, String>>();
                if (validators != null) {
                    Iterator<Resource> validatorsIterator = validators.listChildren();
                    while (validatorsIterator.hasNext()) {
                        Resource validator = validatorsIterator.next();
                        ValueMap validatorProperties = validator.adaptTo(ValueMap.class);
                        String validatorName = validator.getName();
                        Validator v = vls.getValidator(validatorName);
View Full Code Here

   
    @Test
    public void testListChildren() throws IOException {
        Resource resource1 = resourceResolver.getResource(testRoot.getPath() + "/node1");

        List<Resource> children = Lists.newArrayList(resource1.listChildren());
        assertEquals(2, children.size());
        assertEquals("node11", children.get(0).getName());
        assertEquals("node12", children.get(1).getName());
    }
View Full Code Here

        // the actual property name
        String propertyName = PathInfoUtil.getSelector(request, 2, "tags");

        Resource root = request.getResourceResolver().getResource(rootPath);
        if (root != null) {
            Iterator<Resource> children = root.listChildren();
            while (children.hasNext()) {
                Resource child = children.next();
                if (matches(componentPath, child)) {
                    boolean isDefault = false;
                    Resource config = child.getChild(configName);
View Full Code Here

        // the actual property name
        String rteName = PathInfoUtil.getSelector(request, 2, "text");

        Resource root = request.getResourceResolver().getResource(rootPath);
        if (root != null) {
            Iterator<Resource> children = root.listChildren();
            while (children.hasNext()) {
                Resource child = children.next();
                if (matches(componentPath, child)) {
                    boolean isDefault = false;
                    Resource config = child.getChild(configName);
View Full Code Here

                log.debug("Included by pattern [ {} ]", repPolicy.getPath());
            } else {
                continue;
            }

            final Iterator<Resource> aces = repPolicy.listChildren();

            while (aces.hasNext()) {
                final Resource ace = aces.next();
                final ValueMap props = ace.adaptTo(ValueMap.class);
                final String repPrincipalName = props.get("rep:principalName", String.class);
View Full Code Here

      return Collections.emptyList();
    }

    String resourceName = resource.getName();
    List<Resource> prevResources = new ArrayList<Resource>();
    Iterator<Resource> siblings = parent.listChildren();
    while (siblings.hasNext()) {
      Resource sibling = siblings.next();
      if (sibling.getName().equals(resourceName)) {
        break;
      }
View Full Code Here

  public Iterator<Resource> apply(Resource resource) {
    Resource parent = resource.getParent();
    if (parent == null) {
      return new ArrayIterator<Resource>(resource);
    } else {
      return parent.listChildren();
    }
  }
}
View Full Code Here

    String resourceName = resource.getName();
    Resource parent = resource.getParent();
    if (parent == null) {
      return EmptyIterator.INSTANCE;
    }
    Iterator<Resource> siblings = parent.listChildren();
    while (siblings.hasNext()) {
      Resource sibling = siblings.next();
      if (sibling.getName().equals(resourceName)) {
        break;
      }
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.