Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeDefinition.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeDefinition.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeDefinition.java (working copy)
@@ -94,6 +94,13 @@ class JcrNodeDefinition extends JcrItemDefinition implements NodeDefinition {
this.requiredPrimaryTypeNames = requiredPrimaryTypeNames;
}
+ private final String string( Name name ) {
+ if (name == null) return null;
+ if (this.context == null) return name.getString();
+
+ return name.getString(context.getNamespaceRegistry());
+ }
+
/**
* Checks that the fields derived from requiredPrimaryTypeNames are initialized.
*
@@ -189,12 +196,32 @@ class JcrNodeDefinition extends JcrItemDefinition implements NodeDefinition {
*
* @return the required primary type names
*/
- Set getRequiredPrimaryTypeNames() {
+ Set requiredPrimaryTypeNameSet() {
ensureRequiredPrimaryTypesLoaded();
return requiredPrimaryTypesByName.keySet();
}
/**
+ * @return the names of the required primary types for this child node definition; never null
+ */
+ public String[] getRequiredPrimaryTypeNames() {
+ if (requiredPrimaryTypeNames == null) return new String[0];
+
+ String[] rptNames = new String[requiredPrimaryTypeNames.length];
+ for (int i = 0; i < requiredPrimaryTypeNames.length; i++) {
+ rptNames[i] = string(requiredPrimaryTypeNames[i]);
+ }
+ return rptNames;
+ }
+
+ /**
+ * @return the name of the default primary type for this child node definition; may be null
+ */
+ public String getDefaultPrimaryTypeName() {
+ return string(this.defaultPrimaryTypeName);
+ }
+
+ /**
* Determine if this node definition will allow a child with the supplied primary type. This method checks this definition's
* {@link #getRequiredPrimaryTypes()} against the supplied primary type and its supertypes. The supplied primary type for the
* child must be or extend all of the types defined by the {@link #getRequiredPrimaryTypes() required primary types}.
Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeType.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeType.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeType.java (working copy)
@@ -36,8 +36,9 @@ import java.util.Set;
import javax.jcr.PropertyType;
import javax.jcr.Value;
import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
import javax.jcr.nodetype.PropertyDefinition;
-import net.jcip.annotations.Immutable;
+import net.jcip.annotations.ThreadSafe;
import org.modeshape.common.util.CheckArg;
import org.modeshape.graph.ExecutionContext;
import org.modeshape.graph.property.Name;
@@ -46,7 +47,7 @@ import org.modeshape.graph.property.basic.BasicName;
/**
* ModeShape implementation of JCR {@link NodeType}s.
*/
-@Immutable
+@ThreadSafe
class JcrNodeType implements NodeType {
public static final String RESIDUAL_ITEM_NAME = "*";
@@ -74,9 +75,15 @@ class JcrNodeType implements NodeType {
private final Set thisAndAllSupertypesNames;
/** Indicates whether this node type is a mixin type (as opposed to a primary type). */
- private boolean mixin;
+ private final boolean mixin;
/** Indicates whether the child nodes of nodes of this type can be ordered. */
- private boolean orderableChildNodes;
+ private final boolean orderableChildNodes;
+
+ /** Indicates whether this node type is abstract */
+ private final boolean isAbstract;
+
+ /** Indicates whether this node is queryable (i.e., should be included in query results) */
+ private final boolean queryable;
/**
* The child node definitions that are defined on this node type.
@@ -112,6 +119,8 @@ class JcrNodeType implements NodeType {
Collection childNodeDefinitions,
Collection propertyDefinitions,
boolean mixin,
+ boolean isAbstract,
+ boolean queryable,
boolean orderableChildNodes ) {
assert context != null;
@@ -121,6 +130,8 @@ class JcrNodeType implements NodeType {
this.primaryItemName = primaryItemName;
this.declaredSupertypes = declaredSupertypes != null ? declaredSupertypes : Collections.emptyList();
this.mixin = mixin;
+ this.queryable = queryable;
+ this.isAbstract = isAbstract;
this.orderableChildNodes = orderableChildNodes;
this.propertyDefinitions = new ArrayList(propertyDefinitions.size());
for (JcrPropertyDefinition property : propertyDefinitions) {
@@ -212,8 +223,8 @@ class JcrNodeType implements NodeType {
JcrNodeDefinition childNodeDefinition( NodeDefinitionId nodeDefnId ) {
List requiredPrimaryTypeNames = Arrays.asList(nodeDefnId.getRequiredPrimaryTypes());
for (JcrNodeDefinition nodeDefn : allChildNodeDefinitions(nodeDefnId.getChildDefinitionName())) {
- if (nodeDefn.getRequiredPrimaryTypeNames().size() == requiredPrimaryTypeNames.size()
- && nodeDefn.getRequiredPrimaryTypeNames().containsAll(requiredPrimaryTypeNames)) {
+ if (nodeDefn.requiredPrimaryTypeNameSet().size() == requiredPrimaryTypeNames.size()
+ && nodeDefn.requiredPrimaryTypeNameSet().containsAll(requiredPrimaryTypeNames)) {
return nodeDefn;
}
}
@@ -397,6 +408,27 @@ class JcrNodeType implements NodeType {
}
/**
+ * @return the array of names of supertypes declared for this node; possibly empty, never null
+ */
+ public String[] getDeclaredSupertypeNames() {
+ List supertypeNames = new ArrayList(declaredSupertypes.size());
+
+ for (JcrNodeType declaredSupertype : declaredSupertypes) {
+ supertypeNames.add(declaredSupertype.getName());
+ }
+
+ // Always have to make a copy to prevent changes ...
+ return supertypeNames.toArray(new String[supertypeNames.size()]);
+ }
+
+ public NodeTypeIterator getSubtypes() {
+ return new JcrNodeTypeIterator(nodeTypeManager.subtypesFor(this));
+ }
+
+ public NodeTypeIterator getDeclaredSubtypes() {
+ return new JcrNodeTypeIterator(nodeTypeManager.declaredSubtypesFor(this));
+ }
+ /**
* {@inheritDoc}
*
* @see javax.jcr.nodetype.NodeType#getName()
@@ -476,6 +508,14 @@ class JcrNodeType implements NodeType {
return mixin;
}
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ public boolean isQueryable() {
+ return queryable;
+ }
+
/**
* {@inheritDoc}
*
@@ -536,7 +576,8 @@ class JcrNodeType implements NodeType {
*/
final JcrNodeType with( RepositoryNodeTypeManager nodeTypeManager ) {
return new JcrNodeType(this.context, nodeTypeManager, this.name, this.declaredSupertypes, this.primaryItemName,
- this.childNodeDefinitions, this.propertyDefinitions, this.mixin, this.orderableChildNodes);
+ this.childNodeDefinitions, this.propertyDefinitions, this.mixin, this.isAbstract, this.queryable,
+ this.orderableChildNodes);
}
/**
@@ -548,7 +589,8 @@ class JcrNodeType implements NodeType {
*/
final JcrNodeType with( ExecutionContext context ) {
return new JcrNodeType(context, this.nodeTypeManager, this.name, this.declaredSupertypes, this.primaryItemName,
- this.childNodeDefinitions, this.propertyDefinitions, this.mixin, this.orderableChildNodes);
+ this.childNodeDefinitions, this.propertyDefinitions, this.mixin, this.isAbstract, this.queryable,
+ this.orderableChildNodes);
}
final RepositoryNodeTypeManager nodeTypeManager() {
Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeTemplate.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeTemplate.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeTemplate.java (working copy)
@@ -44,6 +44,7 @@ public class JcrNodeTypeTemplate implements NodeTypeTemplate {
private final List nodeDefinitionTemplates = new ArrayList();
private final List propertyDefinitionTemplates = new ArrayList();
private boolean isAbstract;
+ private boolean queryable = true;
private boolean mixin;
private boolean orderableChildNodes;
private String[] declaredSupertypeNames;
@@ -206,4 +207,22 @@ public class JcrNodeTypeTemplate implements NodeTypeTemplate {
return mixin;
}
+ /**
+ * Get whether this node is queryable
+ *
+ * @return true if the node is queryable; false otherwise
+ */
+ public boolean isQueryable() {
+ return queryable;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.modeshape.jcr.nodetype.NodeTypeTemplate#setQueryable(boolean)
+ */
+ public void setQueryable( boolean queryable ) {
+ this.queryable = queryable;
+ }
+
}
Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrPropertyDefinition.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrPropertyDefinition.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrPropertyDefinition.java (working copy)
@@ -58,6 +58,9 @@ class JcrPropertyDefinition extends JcrItemDefinition implements PropertyDefinit
private final boolean multiple;
private final boolean fullTextSearchable;
private final boolean isPrivate;
+ private final boolean queryOrderable;
+ private final String[] queryOperators;
+
private PropertyDefinitionId id;
private ConstraintChecker checker = null;
@@ -72,13 +75,17 @@ class JcrPropertyDefinition extends JcrItemDefinition implements PropertyDefinit
int requiredType,
String[] valueConstraints,
boolean multiple,
- boolean fullTextSearchable ) {
+ boolean fullTextSearchable,
+ boolean queryOrderable,
+ String[] queryOperators ) {
super(context, declaringNodeType, name, onParentVersion, autoCreated, mandatory, protectedItem);
this.defaultValues = defaultValues;
this.requiredType = requiredType;
this.valueConstraints = valueConstraints;
this.multiple = multiple;
this.fullTextSearchable = fullTextSearchable;
+ this.queryOrderable = queryOrderable;
+ this.queryOperators = queryOperators;
this.isPrivate = name.getNamespaceUri().equals(ModeShapeIntLexicon.Namespace.URI);
}
@@ -144,6 +151,14 @@ class JcrPropertyDefinition extends JcrItemDefinition implements PropertyDefinit
return fullTextSearchable;
}
+ public boolean isQueryOrderable() {
+ return queryOrderable;
+ }
+
+ public String[] getQueryOperators() {
+ return queryOperators;
+ }
+
/**
* Creates a new JcrPropertyDefinition
that is identical to the current object, but with the given
* declaringNodeType
. Provided to support immutable pattern for this class.
@@ -156,7 +171,7 @@ class JcrPropertyDefinition extends JcrItemDefinition implements PropertyDefinit
return new JcrPropertyDefinition(this.context, declaringNodeType, this.name, this.getOnParentVersion(),
this.isAutoCreated(), this.isMandatory(), this.isProtected(), this.getDefaultValues(),
this.getRequiredType(), this.getValueConstraints(), this.isMultiple(),
- this.isFullTextSearchable());
+ this.isFullTextSearchable(), this.isQueryOrderable(), this.getQueryOperators());
}
/**
@@ -171,7 +186,7 @@ class JcrPropertyDefinition extends JcrItemDefinition implements PropertyDefinit
return new JcrPropertyDefinition(context, this.declaringNodeType, this.name, this.getOnParentVersion(),
this.isAutoCreated(), this.isMandatory(), this.isProtected(), this.getDefaultValues(),
this.getRequiredType(), this.getValueConstraints(), this.isMultiple(),
- this.isFullTextSearchable());
+ this.isFullTextSearchable(), this.isQueryOrderable(), this.getQueryOperators());
}
/**
Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrPropertyDefinitionTemplate.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrPropertyDefinitionTemplate.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrPropertyDefinitionTemplate.java (working copy)
@@ -24,6 +24,7 @@
package org.modeshape.jcr;
import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
import javax.jcr.Value;
import org.modeshape.common.util.CheckArg;
import org.modeshape.graph.ExecutionContext;
@@ -38,6 +39,9 @@ class JcrPropertyDefinitionTemplate extends JcrItemDefinitionTemplate implements
private String[] defaultValues;
private int requiredType = PropertyType.STRING;
private String[] valueConstraints = new String[0];
+ private boolean fullTextSearchable = true;
+ private boolean queryOrderable = true;
+ private String[] availableQueryOperators;
JcrPropertyDefinitionTemplate( ExecutionContext context ) {
super(context);
@@ -56,6 +60,24 @@ class JcrPropertyDefinitionTemplate extends JcrItemDefinitionTemplate implements
/**
* {@inheritDoc}
*
+ * @see org.modeshape.jcr.nodetype.PropertyDefinitionTemplate#setDefaultValues(Value[])
+ */
+ public void setDefaultValues( Value[] defaultValues ) {
+ CheckArg.isNotNull(defaultValues, "defaultValues");
+ this.defaultValues = new String[defaultValues.length];
+
+ try {
+ for (int i = 0; i < defaultValues.length; i++) {
+ this.defaultValues[i] = defaultValues[i].getString();
+ }
+ } catch (RepositoryException re) {
+ throw new IllegalStateException(re);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.modeshape.jcr.nodetype.PropertyDefinitionTemplate#setMultiple(boolean)
*/
public void setMultiple( boolean multiple ) {
@@ -125,4 +147,42 @@ class JcrPropertyDefinitionTemplate extends JcrItemDefinitionTemplate implements
return multiple;
}
+ public boolean isFullTextSearchable() {
+ return this.fullTextSearchable;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see PropertyDefinitionTemplate#setFullTextSearchable(boolean)
+ */
+ public void setFullTextSearchable( boolean fullTextSearchable ) {
+ this.fullTextSearchable = fullTextSearchable;
+ }
+
+ public String[] getAvailableQueryOperators() {
+ return this.availableQueryOperators;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see PropertyDefinitionTemplate#setAvailableQueryOperators(String[])
+ */
+ public void setAvailableQueryOperators( String[] queryOperators ) {
+ this.availableQueryOperators = queryOperators;
+ }
+
+ public boolean isQueryOrderable() {
+ return this.queryOrderable;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see PropertyDefinitionTemplate#setQueryOrderable(boolean)
+ */
+ public void setQueryOrderable( boolean queryOrderable ) {
+ this.queryOrderable = queryOrderable;
+ }
}
Index: modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryNodeTypeManager.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryNodeTypeManager.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryNodeTypeManager.java (working copy)
@@ -1150,6 +1150,8 @@ class RepositoryNodeTypeManager {
List propsList = new ArrayList();
propsList.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.NODE_TYPE));
propsList.add(propertyFactory.create(JcrLexicon.IS_MIXIN, nodeType.isMixin()));
+ propsList.add(propertyFactory.create(JcrLexicon.IS_ABSTRACT, nodeType.isAbstract()));
+ propsList.add(propertyFactory.create(JcrLexicon.IS_QUERYABLE, nodeType.isQueryable()));
if (nodeType.getPrimaryItemName() != null) {
propsList.add(propertyFactory.create(JcrLexicon.PRIMARY_ITEM_NAME, nodeType.getPrimaryItemName()));
@@ -1274,7 +1276,7 @@ class RepositoryNodeTypeManager {
propsList.add(propertyFactory.create(JcrLexicon.DEFAULT_PRIMARY_TYPE, jcrNodeDef.getDefaultPrimaryType().getName()));
}
- propsList.add(propertyFactory.create(JcrLexicon.REQUIRED_PRIMARY_TYPES, jcrNodeDef.getRequiredPrimaryTypeNames()));
+ propsList.add(propertyFactory.create(JcrLexicon.REQUIRED_PRIMARY_TYPES, jcrNodeDef.requiredPrimaryTypeNameSet()));
propsList.add(propertyFactory.create(JcrLexicon.SAME_NAME_SIBLINGS, jcrNodeDef.allowsSameNameSiblings()));
propsList.add(propertyFactory.create(JcrLexicon.ON_PARENT_VERSION,
OnParentVersionAction.nameFromValue(jcrNodeDef.getOnParentVersion())));
@@ -1347,7 +1349,7 @@ class RepositoryNodeTypeManager {
nodeType.getName(),
childNode.getName()));
}
- if (childNode.getRequiredPrimaryTypeNames().contains(nodeTypeName)) {
+ if (childNode.requiredPrimaryTypeNameSet().contains(nodeTypeName)) {
throw new InvalidNodeTypeDefinitionException(
JcrI18n.cannotUnregisterRequiredPrimaryType.text(name,
nodeType.getName(),
@@ -1719,7 +1721,8 @@ class RepositoryNodeTypeManager {
// Create a new node type that also has the correct property and child node definitions associated
JcrNodeType newNodeType = new JcrNodeType(this.context, this, nodeType.getInternalName(), supertypes,
nodeType.getInternalPrimaryItemName(), nodeDefs, propertyDefs,
- nodeType.isMixin(), nodeType.hasOrderableChildNodes());
+ nodeType.isMixin(), nodeType.isAbstract(), nodeType.isQueryable(),
+ nodeType.hasOrderableChildNodes());
typesPendingRegistration.add(newNodeType);
}
@@ -1796,9 +1799,12 @@ class RepositoryNodeTypeManager {
Name name = nameFactory.create(getFirstPropertyValue(nodeProperties.get(JcrLexicon.NODE_TYPE_NAME)));
Name primaryItemName = nameFactory.create(getFirstPropertyValue(nodeProperties.get(JcrLexicon.PRIMARY_ITEM_NAME)));
boolean mixin = booleanFactory.create(getFirstPropertyValue(nodeProperties.get(JcrLexicon.IS_MIXIN)));
+ boolean isAbstract = booleanFactory.create(getFirstPropertyValue(nodeProperties.get(JcrLexicon.IS_ABSTRACT)));
+ boolean queryable = booleanFactory.create(getFirstPropertyValue(nodeProperties.get(JcrLexicon.IS_QUERYABLE)));
boolean orderableChildNodes = booleanFactory.create(getFirstPropertyValue(nodeProperties.get(JcrLexicon.HAS_ORDERABLE_CHILD_NODES)));
- return new JcrNodeType(this.context, this, name, supertypes, primaryItemName, childNodes, properties, mixin,
+ return new JcrNodeType(this.context, this, name, supertypes, primaryItemName, childNodes, properties, mixin, isAbstract,
+ queryable,
orderableChildNodes);
}
@@ -1821,6 +1827,8 @@ class RepositoryNodeTypeManager {
boolean isProtected = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.PROTECTED)));
Boolean ftsObj = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.IS_FULL_TEXT_SEARCHABLE)));
boolean fullTextSearchable = ftsObj != null ? ftsObj.booleanValue() : false;
+ Boolean qoObj = booleanFactory.create(getFirstPropertyValue(properties.get(JcrLexicon.IS_QUERY_ORDERABLE)));
+ boolean queryOrderable = qoObj != null ? qoObj.booleanValue() : false;
Value[] defaultValues;
Property defaultValuesProperty = properties.get(JcrLexicon.DEFAULT_VALUES);
@@ -1848,8 +1856,21 @@ class RepositoryNodeTypeManager {
valueConstraints = new String[0];
}
+ String[] queryOperators;
+ Property operatorsProperty = properties.get(JcrLexicon.QUERY_OPERATORS);
+ if (operatorsProperty != null) {
+ List operators = new ArrayList();
+
+ for (Object value : operatorsProperty) {
+ operators.add((String)value);
+ }
+ queryOperators = operators.toArray(new String[operators.size()]);
+ } else {
+ queryOperators = new String[0];
+ }
return new JcrPropertyDefinition(this.context, null, propertyName, onParentVersionBehavior, autoCreated, mandatory,
- isProtected, defaultValues, requiredType, valueConstraints, multiple, fullTextSearchable);
+ isProtected, defaultValues, requiredType, valueConstraints, multiple,
+ fullTextSearchable, queryOrderable, queryOperators);
}
private JcrNodeDefinition childNodeDefinitionFrom( Subgraph nodeTypeGraph,
@@ -1956,6 +1977,57 @@ class RepositoryNodeTypeManager {
}
/**
+ * Returns the list of subtypes for the given node.
+ *
+ * @param nodeType the node type for which subtypes should be returned; may not be null
+ * @return the subtypes for the node
+ */
+ final Collection subtypesFor( JcrNodeType nodeType ) {
+ CheckArg.isNotNull(nodeType, "nodeType");
+
+ try {
+ nodeTypeManagerLock.readLock().lock();
+
+ List subtypes = new LinkedList();
+ for (JcrNodeType type : this.nodeTypes.values()) {
+ if (type.supertypes().contains(nodeType)) {
+ subtypes.add(type);
+ }
+ }
+
+ return subtypes;
+ } finally {
+ nodeTypeManagerLock.readLock().unlock();
+ }
+ }
+
+ /**
+ * Returns the list of declared subtypes for the given node.
+ *
+ * @param nodeType the node type for which declared subtypes should be returned; may not be null
+ * @return the subtypes for the node
+ */
+ final Collection declaredSubtypesFor( JcrNodeType nodeType ) {
+ CheckArg.isNotNull(nodeType, "nodeType");
+
+ try {
+ nodeTypeManagerLock.readLock().lock();
+
+ String nodeTypeName = nodeType.getName();
+ List subtypes = new LinkedList();
+ for (JcrNodeType type : this.nodeTypes.values()) {
+ if (Arrays.asList(type.getDeclaredSupertypeNames()).contains(nodeTypeName)) {
+ subtypes.add(type);
+ }
+ }
+
+ return subtypes;
+ } finally {
+ nodeTypeManagerLock.readLock().unlock();
+ }
+ }
+
+ /**
* Validates that the supertypes are compatible under ModeShape restrictions.
*
* ModeShape imposes the following rules on the supertypes of a type:
Index: modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/NodeTypeDefinition.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/NodeTypeDefinition.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/NodeTypeDefinition.java (working copy)
@@ -56,6 +56,13 @@ public interface NodeTypeDefinition {
public boolean isAbstract();
/**
+ * Get whether this node type is abstract.
+ *
+ * @return true if this node type is abstract, or false if it is concrete
+ */
+ public boolean isQueryable();
+
+ /**
* Get whether this node type is a mixin.
*
* @return true if this node type is a mixin, or false if it is concrete
Index: modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/NodeTypeTemplate.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/NodeTypeTemplate.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/NodeTypeTemplate.java (working copy)
@@ -56,6 +56,13 @@ public interface NodeTypeTemplate extends NodeTypeDefinition {
public void setAbstract( boolean isAbstract );
/**
+ * Sets whether this node is queryable
+ *
+ * @param queryable true if the node should be included in query results; false otherwise
+ */
+ public void setQueryable( boolean queryable );
+
+ /**
* Set whether this node type is a mixin.
*
* @param mixin true if this node type is a mixin, or false otherwise
Index: modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/PropertyDefinitionTemplate.java
===================================================================
--- modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/PropertyDefinitionTemplate.java (revision 1792)
+++ modeshape-jcr/src/main/java/org/modeshape/jcr/nodetype/PropertyDefinitionTemplate.java (working copy)
@@ -24,6 +24,8 @@
package org.modeshape.jcr.nodetype;
import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
import javax.jcr.nodetype.PropertyDefinition;
import javax.jcr.version.OnParentVersionAction;
import net.jcip.annotations.NotThreadSafe;
@@ -99,9 +101,58 @@ public interface PropertyDefinitionTemplate extends PropertyDefinition {
public void setDefaultValues( String[] defaultValues );
/**
+ * Set the default values for the property, using their {link Value} representation. See
+ * {@link PropertyDefinition#getDefaultValues()} for more details.
+ *
+ * @param defaultValues the value representation of the default values, or null or an empty array if there are no default
+ * values
+ */
+ public void setDefaultValues( Value[] values ) throws RepositoryException;
+
+ /**
* Set whether the properties described by this definition may have multiple values.
*
* @param multiple true if the properties may have multiple values, or false if they are limited to one value each
*/
public void setMultiple( boolean multiple );
+
+ /**
+ * @return whether the properties described by this definition should be searchable in a full-text search
+ */
+ public boolean isFullTextSearchable();
+
+ /**
+ * Set whether the properties described by this definition should be searchable in a full-text search
+ *
+ * @param fullTextSearchable whether the properties described by this definition should be searchable in a full-text search
+ */
+ public void setFullTextSearchable( boolean fullTextSearchable );
+
+ /**
+ * @return whether the query results containing properties described by this definition should be able to be ordered by those
+ * properties.
+ */
+ public boolean isQueryOrderable();
+
+ /**
+ * Set whether the query results containing properties described by this definition should be able to be ordered by those
+ * properties.
+ *
+ * @param queryOrderable whether the query results containing properties described by this definition should be able to be
+ * ordered by those properties.
+ */
+ public void setQueryOrderable( boolean queryOrderable );
+
+ /**
+ * @return the available operators for use in property constraints that reference properties described by this definition.
+ */
+ public String[] getAvailableQueryOperators();
+
+ /**
+ * Sets the available operators for use in property constraints that reference properties described by this definition.
+ *
+ * @param queryOperators the available operators for use in property constraints that reference properties described by this
+ * definition.
+ */
+ public void setAvailableQueryOperators( String[] queryOperators );
}
Index: modeshape-jcr/src/test/java/org/modeshape/jcr/RepositoryNodeTypeManagerTest.java
===================================================================
--- modeshape-jcr/src/test/java/org/modeshape/jcr/RepositoryNodeTypeManagerTest.java (revision 1792)
+++ modeshape-jcr/src/test/java/org/modeshape/jcr/RepositoryNodeTypeManagerTest.java (working copy)
@@ -216,7 +216,7 @@ public class RepositoryNodeTypeManagerTest extends AbstractSessionTest {
assertThat(nodeDef.getName(), is(JcrNodeType.RESIDUAL_ITEM_NAME));
}
- Set requiredPrimaryTypeNames = nodeDef.getRequiredPrimaryTypeNames();
+ Set requiredPrimaryTypeNames = nodeDef.requiredPrimaryTypeNameSet();
try {
Value[] requiredPrimaryTypes = childNodeNode.getProperty(JcrLexicon.REQUIRED_PRIMARY_TYPES.getString(registry))
.getValues();