1 17 package org.alfresco.jcr.dictionary; 18 19 20 import javax.jcr.nodetype.NodeDefinition; 21 import javax.jcr.nodetype.NodeType; 22 import javax.jcr.version.OnParentVersionAction; 23 24 import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition; 25 import org.alfresco.service.cmr.dictionary.ClassDefinition; 26 27 28 34 public class NodeDefinitionImpl implements NodeDefinition 35 { 36 private NodeTypeManagerImpl typeManager; 37 private ChildAssociationDefinition assocDef; 38 39 45 public NodeDefinitionImpl(NodeTypeManagerImpl typeManager, ChildAssociationDefinition assocDef) 46 { 47 this.typeManager = typeManager; 48 this.assocDef = assocDef; 49 } 50 51 54 public NodeType[] getRequiredPrimaryTypes() 55 { 56 ClassDefinition target = assocDef.getTargetClass(); 58 return new NodeType[] { typeManager.getNodeTypeImpl(target.getName()) }; 59 } 60 61 64 public NodeType getDefaultPrimaryType() 65 { 66 return null; 67 } 68 69 72 public boolean allowsSameNameSiblings() 73 { 74 return assocDef.getDuplicateChildNamesAllowed(); 75 } 76 77 80 public NodeType getDeclaringNodeType() 81 { 82 return typeManager.getNodeTypeImpl(assocDef.getSourceClass().getName()); 83 } 84 85 88 public String getName() 89 { 90 return assocDef.getName().toPrefixString(typeManager.getNamespaceService()); 91 } 92 93 96 public boolean isAutoCreated() 97 { 98 return isMandatory(); 99 } 100 101 104 public boolean isMandatory() 105 { 106 return assocDef.isTargetMandatory(); 107 } 108 109 112 public int getOnParentVersion() 113 { 114 return OnParentVersionAction.INITIALIZE; 116 } 117 118 121 public boolean isProtected() 122 { 123 return assocDef.isProtected(); 124 } 125 126 } 127 | Popular Tags |