/** * {@inheritDoc} */ public PropertyDefinition[] getPropertyDefinitions() { QPropertyDefinition[] pda = ent.getAllPropDefs(); PropertyDefinition[] propDefs = new PropertyDefinition[pda.length]; for (int i = 0; i < pda.length; i++) { propDefs[i] = ntMgr.getPropertyDefinition(pda[i]); } return propDefs; }
/** * {@inheritDoc} */ public PropertyDefinition[] getPropertyDefinitions() { QPropertyDefinition[] pda = ent.getAllPropDefs(); PropertyDefinition[] propDefs = new PropertyDefinition[pda.length]; for (int i = 0; i < pda.length; i++) { propDefs[i] = ntMgr.getPropertyDefinition(pda[i]); } return propDefs; }
Node parent = (Node)session.getItem(path);//Jcr path to the parent node Node added = parent.addNode(newNodeName);//Add new node Workspace workspace = session.getWorkspace(); NodeTypeManager ntMgr = workspace.getNodeTypeManager(); NodeTypeRegistry ntReg=null; try { ntReg = ((NodeTypeManagerImpl) ntMgr).getNodeTypeRegistry(); } catch (ClassCastException e) { e.printStackTrace(); } NameFactory nameFactory = NameFactoryImpl.getInstance(); Name namejcr = nameFactory.create(type); EffectiveNodeType effnodetype = ntReg.getEffectiveNodeType(namejcr); //Here i get all the property definition for this type of node, so from here i //can know which of them are mandatory PropDef[] pdefs = effnodetype.getAllPropDefs();
/** * Returns <code>true</code> if the property with the given name is * indexed according to this rule. * * @param state the node state. * @param propertyName the name of a property. * @return <code>true</code> if the property is indexed; * <code>false</code> otherwise. */ public boolean isIndexed(NodeState state, Name propertyName) { if (mixinNodeType && effectiveNodeType != null) { QPropertyDefinition[] allPropDefs = effectiveNodeType.getAllPropDefs(); for (QPropertyDefinition propertyDefinition : allPropDefs) { if (propertyDefinition.getName().equals(propertyName)) { return getConfig(propertyName) != null; } } return true; } else { return getConfig(propertyName) != null; } }
/** * Returns <code>true</code> if the property with the given name is * indexed according to this rule. * * @param state the node state. * @param propertyName the name of a property. * @return <code>true</code> if the property is indexed; * <code>false</code> otherwise. */ public boolean isIndexed(NodeState state, Name propertyName) { if (mixinNodeType && effectiveNodeType != null) { QPropertyDefinition[] allPropDefs = effectiveNodeType.getAllPropDefs(); for (QPropertyDefinition propertyDefinition : allPropDefs) { if (propertyDefinition.getName().equals(propertyName)) { return getConfig(propertyName) != null; } } return true; } else { return getConfig(propertyName) != null; } }