Search in sources :

Example 1 with EffectiveNodeType

use of org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType in project jackrabbit-oak by apache.

the class ReadOnlyNodeTypeManager method getDefinition.

@Nonnull
@Override
public NodeDefinition getDefinition(@Nonnull Tree parent, @Nonnull Tree targetNode) throws RepositoryException {
    checkNotNull(parent);
    checkNotNull(targetNode);
    String name = dropIndexFromName(targetNode.getName());
    EffectiveNodeType eff = getEffectiveNodeType(parent);
    return eff.getNodeDefinition(name, getEffectiveNodeType(targetNode));
}
Also used : EffectiveNodeType(org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType) Nonnull(javax.annotation.Nonnull)

Example 2 with EffectiveNodeType

use of org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType in project jackrabbit-oak by apache.

the class ReadOnlyNodeTypeManager method getDefinition.

@Nonnull
@Override
public PropertyDefinition getDefinition(Tree parent, PropertyState property, boolean exactTypeMatch) throws RepositoryException {
    Type<?> type = property.getType();
    EffectiveNodeType effective = getEffectiveNodeType(parent);
    return effective.getPropertyDefinition(property.getName(), type.isArray(), type.tag(), exactTypeMatch);
}
Also used : EffectiveNodeType(org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType) Nonnull(javax.annotation.Nonnull)

Example 3 with EffectiveNodeType

use of org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType in project jackrabbit-oak by apache.

the class ReadOnlyNodeTypeManager method getDefinition.

@Nonnull
@Override
public NodeDefinition getDefinition(@Nonnull Tree parent, @Nonnull String nodeName) throws RepositoryException {
    checkNotNull(parent);
    checkNotNull(nodeName);
    EffectiveNodeType effective = getEffectiveNodeType(parent);
    return effective.getNodeDefinition(nodeName, null);
}
Also used : EffectiveNodeType(org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType) Nonnull(javax.annotation.Nonnull)

Example 4 with EffectiveNodeType

use of org.apache.jackrabbit.oak.spi.nodetype.EffectiveNodeType 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

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