001: /*
002: * Copyright 2006 Day Management AG, Switzerland. All rights reserved.
003: */
004: package javax.jcr.nodetype;
005:
006: import javax.jcr.Value;
007:
008: /**
009: * A <code>NodeType</code> object represents a "live" node type that is
010: * registered in the repository.
011: *
012: */
013: public interface NodeType extends NodeTypeDefinition {
014:
015: /**
016: * Returns all supertypes of this node type in the node type inheritance hierarchy.
017: * For primary types apart from <code>nt:base</code>, this list will always include
018: * at least <code>nt:base</code>. For mixin types, there is no required supertype.
019: *
020: * @see #getDeclaredSupertypes
021: *
022: * @return an array of <code>NodeType</code> objects.
023: */
024: public NodeType[] getSupertypes();
025:
026: /**
027: * Returns the <i>direct</i> supertypes of this node type in the node type inheritance hierarchy,
028: * that is, those actually declared in this node type. In single-inheritance systems, this
029: * will always be an array of size 0 or 1. In systems that support multiple inheritance of
030: * node types this array may be of size greater than 1.
031: *
032: * @see #getSupertypes
033: *
034: * @return an array of <code>NodeType</code> objects.
035: */
036: public NodeType[] getDeclaredSupertypes();
037:
038: /**
039: * Returns <code>true</code> if this node type is <code>nodeTypeName</code>
040: * or a subtype of <code>nodeTypeName</code>, otherwise returns
041: * <code>false</code>.
042: * @param nodeTypeName the name of a node type.
043: * @return a boolean
044: */
045: public boolean isNodeType(String nodeTypeName);
046:
047: /**
048: * Returns an array containing the property definitions of this node type.
049: * This includes both those property definitions actually declared in this
050: * node type and those inherited from the supertypes of this type.
051: *
052: * @see #getDeclaredPropertyDefinitions()
053: *
054: * @return an array containing the property definitions.
055: */
056: public PropertyDefinition[] getPropertyDefinitions();
057:
058: /**
059: * Returns an array containing the child node definitions of this node type.
060: * This includes both those child node definitions actually declared in this
061: * node type and those inherited from the supertypes of this node type.
062: *
063: * @see #getDeclaredChildNodeDefinitions()
064: *
065: * @return an array containing the child node definitions.
066: */
067: public NodeDefinition[] getChildNodeDefinitions();
068:
069: /**
070: * Returns <code>true</code> if setting <code>propertyName</code> to
071: * <code>value</code> is allowed by this node type. Otherwise returns
072: * <code>false</code>.
073: *
074: * @param propertyName The name of the property
075: * @param value A <code>Value</code> object.
076: * @return a boolean
077: */
078: public boolean canSetProperty(String propertyName, Value value);
079:
080: /**
081: * Returns <code>true</code> if setting <code>propertyName</code> to
082: * <code>values</code> is allowed by this node type. Otherwise returns
083: * <code>false</code>.
084: *
085: * @param propertyName The name of the property
086: * @param values A <code>Value</code> array.
087: * @return a boolean
088: */
089: public boolean canSetProperty(String propertyName, Value[] values);
090:
091: /**
092: * Returns <code>true</code> if this node type allows the addition of a
093: * child node called <code>childNodeName</code> without specific node type
094: * information (that is, given the definition of this parent node type, the
095: * child node name is sufficient to determine the intended child node type).
096: * Returns <code>false</code> otherwise.
097: *
098: * @param childNodeName The name of the child node.
099: * @return a boolean
100: */
101: public boolean canAddChildNode(String childNodeName);
102:
103: /**
104: * Returns <code>true</code> if this node type allows the addition of a
105: * child node called <code>childNodeName</code> of node type
106: * <code>nodeTypeName</code>. Returns <code>false</code> otherwise.
107: *
108: * @param childNodeName The name of the child node.
109: * @param nodeTypeName The name of the node type of the child node.
110: * @return a boolean
111: */
112: public boolean canAddChildNode(String childNodeName,
113: String nodeTypeName);
114:
115: /**
116: * Returns <code>true</code> if removing the child item called
117: * <code>itemName</code> is allowed by this node type. Returns
118: * <code>false</code> otherwise.
119: *
120: * @deprecated As of JCR 2.0, clients should use {@link #canRemoveNode(String)}
121: * and {@link #canRemoveProperty(String)} instead.
122: *
123: * @param itemName The name of the child item
124: * @return a boolean
125: */
126: public boolean canRemoveItem(String itemName);
127:
128: /**
129: * Returns <code>true</code> if removing the child node called
130: * <code>nodeName</code> is allowed by this node type. Returns
131: * <code>false</code> otherwise.
132: *
133: * @param nodeName The name of the child node
134: * @return a boolean
135: * @since JCR 2.0
136: */
137: public boolean canRemoveNode(String nodeName);
138:
139: /**
140: * Returns <code>true</code> if removing the property called
141: * <code>propertyName</code> is allowed by this node type. Returns
142: * <code>false</code> otherwise.
143: *
144: * @param propertyName The name of the property
145: * @return a boolean
146: * @since JCR 2.0
147: */
148: public boolean canRemoveProperty(String propertyName);
149: }
|