} else {
// the transient item is a property
PropertyState propState = (PropertyState) itemState;
ItemId propId = propState.getId();
PropertyImpl prop = (PropertyImpl) itemMgr.getItem(propId);
PropertyDefinitionImpl def =
(PropertyDefinitionImpl) prop.getDefinition();
/**
* check value constraints
* (no need to check value constraints of protected properties
* as those are set by the implementation only, i.e. they
* cannot be set by the user through the api)
*/
if (!def.isProtected()) {
String[] constraints = def.getValueConstraints();
if (constraints != null) {
InternalValue[] values = propState.getValues();
try {
EffectiveNodeType.checkSetPropertyValueConstraints(
def.unwrap(), values);
} catch (RepositoryException e) {
// repack exception for providing verboser error message
String msg = prop.safeGetJCRPath() + ": " + e.getMessage();
log.debug(msg);
throw new ConstraintViolationException(msg);
}
/**
* need to manually check REFERENCE value constraints
* as this requires a session (target node needs to
* be checked)
*/
if (constraints.length > 0
&& def.getRequiredType() == PropertyType.REFERENCE) {
for (int i = 0; i < values.length; i++) {
boolean satisfied = false;
try {
UUID targetUUID = (UUID) values[i].internalValue();
Node targetNode = session.getNodeByUUID(targetUUID.toString());