} else if (op.equals(Constants.GE_ENTITY)) {
queryOps.add(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO);
} else if (op.equals(Constants.LIKE_ENTITY)) {
queryOps.add(QueryObjectModelConstants.JCR_OPERATOR_LIKE);
} else {
throw new InvalidNodeTypeDefException("'" + op + "' is not a valid query operator");
}
}
def.setAvailableQueryOperators((String[]) queryOps.toArray(new String[queryOps.size()]));
}
def.setRequiredType(PropertyType.valueFromName(
walker.getAttribute(Constants.REQUIREDTYPE_ATTRIBUTE)));
// value constraints
if (walker.enterElement(Constants.VALUECONSTRAINTS_ELEMENT)) {
List constraints = new ArrayList();
int type = def.getRequiredType();
while (walker.iterateElements(Constants.VALUECONSTRAINT_ELEMENT)) {
String constraint = walker.getContent();
try {
constraints.add(ValueConstraint.create(
type, constraint.trim(), resolver));
} catch (InvalidConstraintException e) {
throw new InvalidNodeTypeDefException(
"Invalid value constraint " + constraint, e);
}
}
def.setValueConstraints((ValueConstraint[]) constraints.toArray(
new ValueConstraint[constraints.size()]));
walker.leaveElement();
}
// default values
if (walker.enterElement(Constants.DEFAULTVALUES_ELEMENT)) {
List<InternalValue> values = new ArrayList();
int type = def.getRequiredType();
if (type == PropertyType.UNDEFINED) {
type = PropertyType.STRING;
}
while (walker.iterateElements(Constants.DEFAULTVALUE_ELEMENT)) {
String value = walker.getContent();
try {
Value v = ValueHelper.convert(value, type, valueFactory);
values.add((InternalValue) ValueFormat.getQValue(v, resolver, qValueFactory));
} catch (RepositoryException e) {
throw new InvalidNodeTypeDefException(
"Unable to create default value: " + value, e);
}
}
def.setDefaultValues((InternalValue[])
values.toArray(new InternalValue[values.size()]));