}
int requiredType = builder.getRequiredType();
Element child = DomUtil.getChildElement(pdefElement, DEFAULTVALUES_ELEMENT, null);
if (child != null) {
ElementIterator it = DomUtil.getChildren(child, DEFAULTVALUE_ELEMENT, null);
while (it.hasNext()) {
String jcrVal = DomUtil.getText(it.nextElement());
if (jcrVal == null) {
jcrVal = "";
}
QValue qValue;
if (requiredType == PropertyType.BINARY) {
// TODO: improve
Value v = new ValueFactoryQImpl(qValueFactory, resolver).createValue(jcrVal, requiredType);
qValue = ValueFormat.getQValue(v, resolver, qValueFactory);
} else {
qValue = ValueFormat.getQValue(jcrVal, requiredType, resolver, qValueFactory);
}
builder.addDefaultValue(qValue);
}
} // else: no default values defined.
child = DomUtil.getChildElement(pdefElement, VALUECONSTRAINTS_ELEMENT, null);
if (child != null) {
ElementIterator it = DomUtil.getChildren(child, VALUECONSTRAINT_ELEMENT, null);
while (it.hasNext()) {
String qValue = DomUtil.getText(it.nextElement());
// in case of name and path constraint, the value must be
// converted to SPI values
// TODO: tobefixed. path-constraint may contain trailing *
builder.addValueConstraint(ValueConstraint.create(requiredType, qValue, resolver));
}
}
child = DomUtil.getChildElement(pdefElement, AVAILABLE_QUERY_OPERATORS_ELEMENT, null);
if (child == null) {
builder.setAvailableQueryOperators(new String[0]);
} else {
List<String> names = new ArrayList<String>();
ElementIterator it = DomUtil.getChildren(child, AVAILABLE_QUERY_OPERATOR_ELEMENT, null);
while (it.hasNext()) {
String str = DomUtil.getText(it.nextElement());
names.add(str);
}
builder.setAvailableQueryOperators(names.toArray(new String[names.size()]));
}