@SuppressWarnings( "unchecked" ) public NodeTypeDefinition readNodeTypeDefinition( CachedNode nodeType ) { try { NodeTypeTemplate defn = new JcrNodeTypeTemplate(context()); defn.setMixin(booleans.create(first(nodeType, JcrLexicon.IS_MIXIN))); defn.setAbstract(booleans.create(first(nodeType, JcrLexicon.IS_ABSTRACT)));
@SuppressWarnings( "unchecked" ) public NodeTypeDefinition readNodeTypeDefinition( CachedNode nodeType ) { try { NodeTypeTemplate defn = new JcrNodeTypeTemplate(context()); defn.setMixin(booleans.create(first(nodeType, JcrLexicon.IS_MIXIN))); defn.setAbstract(booleans.create(first(nodeType, JcrLexicon.IS_ABSTRACT)));
protected NodeDefinition readChildNodeDefinition( CachedNode childDefn ) throws ConstraintViolationException { NodeDefinitionTemplate defn = new JcrNodeDefinitionTemplate(context()); defn.setName(strings.create(first(childDefn, JcrLexicon.NAME, JcrNodeType.RESIDUAL_ITEM_NAME))); defn.setAutoCreated(booleans.create(first(childDefn, JcrLexicon.AUTO_CREATED))); defn.setMandatory(booleans.create(first(childDefn, JcrLexicon.MANDATORY))); defn.setSameNameSiblings(booleans.create(first(childDefn, JcrLexicon.SAME_NAME_SIBLINGS))); defn.setProtected(booleans.create(first(childDefn, JcrLexicon.PROTECTED))); defn.setOnParentVersion(OnParentVersionAction.valueFromName(strings.create(first(childDefn, JcrLexicon.ON_PARENT_VERSION)))); String defaultPrimaryType = strings.create(first(childDefn, JcrLexicon.DEFAULT_PRIMARY_TYPE)); if (defaultPrimaryType != null) defn.setDefaultPrimaryTypeName(defaultPrimaryType); Property requiredPrimaryTypes = childDefn.getProperty(JcrLexicon.REQUIRED_PRIMARY_TYPES, system); if (requiredPrimaryTypes != null && !requiredPrimaryTypes.isEmpty()) { String[] values = new String[requiredPrimaryTypes.size()]; int i = 0; for (Object op : requiredPrimaryTypes) { values[i++] = strings.create(op); } defn.setRequiredPrimaryTypeNames(values); } return defn; }
protected NodeDefinition readChildNodeDefinition( CachedNode childDefn ) throws ConstraintViolationException { NodeDefinitionTemplate defn = new JcrNodeDefinitionTemplate(context()); defn.setName(strings.create(first(childDefn, JcrLexicon.NAME, JcrNodeType.RESIDUAL_ITEM_NAME))); defn.setAutoCreated(booleans.create(first(childDefn, JcrLexicon.AUTO_CREATED))); defn.setMandatory(booleans.create(first(childDefn, JcrLexicon.MANDATORY))); defn.setSameNameSiblings(booleans.create(first(childDefn, JcrLexicon.SAME_NAME_SIBLINGS))); defn.setProtected(booleans.create(first(childDefn, JcrLexicon.PROTECTED))); defn.setOnParentVersion(OnParentVersionAction.valueFromName(strings.create(first(childDefn, JcrLexicon.ON_PARENT_VERSION)))); String defaultPrimaryType = strings.create(first(childDefn, JcrLexicon.DEFAULT_PRIMARY_TYPE)); if (defaultPrimaryType != null) defn.setDefaultPrimaryTypeName(defaultPrimaryType); Property requiredPrimaryTypes = childDefn.getProperty(JcrLexicon.REQUIRED_PRIMARY_TYPES, system); if (requiredPrimaryTypes != null && !requiredPrimaryTypes.isEmpty()) { String[] values = new String[requiredPrimaryTypes.size()]; int i = 0; for (Object op : requiredPrimaryTypes) { values[i++] = strings.create(op); } defn.setRequiredPrimaryTypeNames(values); } return defn; }
protected PropertyDefinition readPropertyDefinition( CachedNode propDefn ) throws ConstraintViolationException { PropertyDefinitionTemplate defn = new JcrPropertyDefinitionTemplate(context()); defn.setName(strings.create(first(propDefn, JcrLexicon.NAME, JcrNodeType.RESIDUAL_ITEM_NAME))); defn.setAutoCreated(booleans.create(first(propDefn, JcrLexicon.AUTO_CREATED)));
protected PropertyDefinition readPropertyDefinition( CachedNode propDefn ) throws ConstraintViolationException { PropertyDefinitionTemplate defn = new JcrPropertyDefinitionTemplate(context()); defn.setName(strings.create(first(propDefn, JcrLexicon.NAME, JcrNodeType.RESIDUAL_ITEM_NAME))); defn.setAutoCreated(booleans.create(first(propDefn, JcrLexicon.AUTO_CREATED)));