use of org.alfresco.repo.dictionary.M2Constraint in project records-management by Alfresco.
the class RecordsManagementAdminServiceImpl method removeCustomConstraintDefinition.
/**
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomConstraintDefinition(org.alfresco.service.namespace.QName)
*/
public void removeCustomConstraintDefinition(QName constraintName) {
mandatory("constraintName", constraintName);
NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService());
M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString);
if (customConstraint == null) {
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString));
}
deserializedModel.removeConstraint(constraintNameAsPrefixString);
writeCustomContentModel(modelRef, deserializedModel);
if (logger.isInfoEnabled()) {
logger.info("deleteCustomConstraintDefinition: " + constraintNameAsPrefixString);
}
}
Aggregations