Search in sources :

Example 1 with ProtectedPropertyImporter

use of org.apache.jackrabbit.oak.spi.xml.ProtectedPropertyImporter in project jackrabbit-oak by apache.

the class ImporterImpl method importProperties.

private void importProperties(@Nonnull Tree tree, @Nonnull List<PropInfo> propInfos, boolean ignoreRegular) throws RepositoryException {
    // process properties
    for (PropInfo pi : propInfos) {
        // find applicable definition
        // TODO find better heuristics?
        EffectiveNodeType ent = effectiveNodeTypeProvider.getEffectiveNodeType(tree);
        PropertyDefinition def = ent.getPropertyDefinition(pi.getName(), pi.getType(), pi.isUnknownMultiple());
        if (def.isProtected()) {
            // skip protected property
            log.debug("Protected property {}", pi.getName());
            // notify the ProtectedPropertyImporter.
            for (ProtectedPropertyImporter ppi : getPropertyImporters()) {
                if (ppi.handlePropInfo(tree, pi, def)) {
                    log.debug("Protected property -> delegated to ProtectedPropertyImporter");
                    break;
                }
            /* else: p-i-Importer isn't able to deal with this property. try next pp-importer */
            }
        } else if (!ignoreRegular) {
            // regular property -> create the property
            createProperty(tree, pi, def);
        }
    }
    for (ProtectedPropertyImporter ppi : getPropertyImporters()) {
        ppi.propertiesCompleted(tree);
    }
}
Also used : EffectiveNodeType(org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType) ProtectedPropertyImporter(org.apache.jackrabbit.oak.spi.xml.ProtectedPropertyImporter) PropInfo(org.apache.jackrabbit.oak.spi.xml.PropInfo) PropertyDefinition(javax.jcr.nodetype.PropertyDefinition)

Aggregations

PropertyDefinition (javax.jcr.nodetype.PropertyDefinition)1 EffectiveNodeType (org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType)1 PropInfo (org.apache.jackrabbit.oak.spi.xml.PropInfo)1 ProtectedPropertyImporter (org.apache.jackrabbit.oak.spi.xml.ProtectedPropertyImporter)1