}
}
protected void processProperty(NodeState node, PropInfo pInfo) throws RepositoryException {
PropertyState prop;
QPropertyDefinition def;
Name name = pInfo.getName();
int type = pInfo.getType();
if (node.hasPropertyName(name)) {
// a property with that name already exists...
PropertyId idExisting = new PropertyId(node.getNodeId(), name);
prop = (PropertyState) itemOps.getItemState(idExisting);
def = itemOps.findApplicablePropertyDefinition(prop.getName(), prop.getType(), prop.isMultiValued(), node);
if (def.isProtected()) {
// skip protected property
log.debug("skipping protected property "
+ itemOps.safeGetJCRPath(idExisting));
return;
}
if (!def.isAutoCreated()
|| (prop.getType() != type && type != PropertyType.UNDEFINED)
|| def.isMultiple() != prop.isMultiValued()) {
throw new ItemExistsException(itemOps.safeGetJCRPath(prop.getPropertyId()));
}
} else {
// there's no property with that name,
// find applicable definition
def = pInfo.getApplicablePropertyDef(itemOps.getEffectiveNodeType(node));
if (def.isProtected()) {
// skip protected property
log.debug("skipping protected property " + name);
return;
}
// create new property
prop = itemOps.createPropertyState(node, name, type, def);
}
// check multi-valued characteristic
TextValue[] values = pInfo.getTextValues();
if (values.length != 1 && !def.isMultiple()) {
throw new ConstraintViolationException(itemOps.safeGetJCRPath(prop.getPropertyId())
+ " is not multi-valued");
}
// convert serialized values to InternalValue objects