// check properties for validity
TypeValidator.validateProperties(typeDef, properties, false);
if (changeToken != null && changeToken.getValue() != null
&& Long.valueOf(so.getChangeToken()) > Long.valueOf(changeToken.getValue())) {
throw new CmisUpdateConflictException(" updateProperties failed: outdated changeToken");
}
// update properties
boolean hasUpdatedName = false;
boolean hasUpdatedOtherProps = false;
for (String key : properties.getProperties().keySet()) {
if (key.equals(PropertyIds.NAME))
{
continue; // ignore here
}
PropertyData<?> value = properties.getProperties().get(key);
PropertyDefinition<?> propDef = typeDef.getPropertyDefinitions().get(key);
if (value.getValues() == null || value.getFirstValue() == null) {
// delete property
// check if a required a property
if (propDef.isRequired()) {
throw new CmisConstraintException(
"updateProperties failed, following property can't be deleted, because it is required: "
+ key);
}
oldProperties.remove(key);
hasUpdatedOtherProps = true;
} else {
if (propDef.getUpdatability().equals(Updatability.WHENCHECKEDOUT)) {
if (!isCheckedOut)
throw new CmisUpdateConflictException(
"updateProperties failed, following property can't be updated, because it is not checked-out: "
+ key);
} else if (!propDef.getUpdatability().equals(Updatability.READWRITE)) {
throw new CmisConstraintException(
"updateProperties failed, following property can't be updated, because it is not writable: "