public boolean add()

in src/main/java/org/apache/sling/resource/collection/impl/ResourceCollectionImpl.java [128:148]


    public boolean add(Resource res) throws PersistenceException {
        if (res != null && !contains(res)) {
        	ModifiableValueMap vm = membersResource.adaptTo(ModifiableValueMap.class);
        	String[] order = vm.get(ResourceCollectionConstants.REFERENCES_PROP, new String[]{});

        	order = ArrayUtils.add(order, res.getPath());
        	vm.put(ResourceCollectionConstants.REFERENCES_PROP, order);

        	Map<String, Object> properties = new HashMap<>();
        	properties.put(ResourceCollectionConstants.REF_PROPERTY, res.getPath());
            resolver.create(
                membersResource,
                ResourceUtil.createUniqueChildName(membersResource,
                    res.getName()), properties);
            log.debug("added member to resource {} to collection {}",
                new String[] { res.getPath(), resource.getPath() });
            return true;
        }

        return false;
    }