private void setAuthorizableProperties()

in src/main/java/org/apache/sling/jcr/repoinit/impl/NodePropertiesVisitor.java [256:283]


    private void setAuthorizableProperties(String nodePath, List<PropertyLine> propertyLines) throws RepositoryException {
        int lastHashIndex = nodePath.lastIndexOf(SUBTREE_DELIMINATOR);
        if (lastHashIndex == -1) {
            throw new IllegalStateException("Invalid format of authorizable path: # deliminator expected.");
        }
        String ids = nodePath.substring(PATH_AUTHORIZABLE.length(), lastHashIndex);
        String subTreePath = nodePath.substring(lastHashIndex + 1);
        for (Authorizable a : getAuthorizables(session, ids)) {
            log.info("Setting properties on authorizable '{}'", a.getID());
            for (PropertyLine pl : propertyLines) {
                final String pName = pl.getPropertyName();
                final String pRelPath = toRelPath(subTreePath, pName);
                if (needToSetProperty(session, a, pRelPath, pl)) {
                    final List<Object> values = pl.getPropertyValues();
                    if (values.size() > 1) {
                        Value[] pValues = convertToValues(values);
                        a.setProperty(pRelPath, pValues);
                    } else {
                        Value pValue = convertToValue(values.get(0));
                        a.setProperty(pRelPath, pValue);
                    }
                } else {
                    log.info("Property '{}' already set on authorizable '{}', existing value will not be overwritten in 'default' mode",
                        pRelPath, a.getID());
                }
            }
        }
    }