diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminServiceImpl.java index 0a876180cd..789ee3bb1e 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminServiceImpl.java @@ -83,6 +83,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.extensions.surf.util.I18NUtil; import org.springframework.extensions.surf.util.ParameterCheck; +import org.springframework.extensions.surf.util.URLDecoder; /** * Records Management AdminService Implementation. @@ -765,20 +766,23 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin if (newName == null) return propQName; QName newPropQName = getQNameForClientId(newName); - propDefn = dictionaryService.getProperty(newPropQName); - if (propDefn != null) + if (newPropQName != null) { - // The requested QName is already in use - String propIdAsString = newPropQName.toPrefixString(namespaceService); - throw new PropertyAlreadyExistsMetadataException(propIdAsString); + propDefn = dictionaryService.getProperty(newPropQName); + if (propDefn != null) + { + // The requested QName is already in use + String propIdAsString = newPropQName.toPrefixString(namespaceService); + throw new PropertyAlreadyExistsMetadataException(propIdAsString); + } } NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); M2Model deserializedModel = readCustomContentModel(modelRef); M2Property targetProperty = findProperty(propQName, deserializedModel); - targetProperty.setName(newName); - targetProperty.setTitle(newName); + targetProperty.setName(new StringBuilder().append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX).append(QName.NAMESPACE_PREFIX).append(newName).toString()); + targetProperty.setTitle(URLDecoder.decode(newName)); writeCustomContentModel(modelRef, deserializedModel); if (logger.isInfoEnabled()) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java index bf529306db..1ddace840a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java @@ -33,6 +33,7 @@ import org.alfresco.service.namespace.QName; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; +import org.springframework.extensions.surf.util.URLDecoder; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptException; @@ -152,7 +153,7 @@ public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript String customisableElement = (String)params.get(PARAM_ELEMENT); QName customisableType = mapToTypeQName(customisableElement); - String label = (String)params.get(PARAM_LABEL); + String label = URLDecoder.decode((String)params.get(PARAM_LABEL)); //According to the wireframes, type here can only be date|text|number Serializable serializableParam = params.get(PARAM_DATATYPE); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java index 2dc8f1155a..71f11e7c68 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java @@ -136,26 +136,27 @@ public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript "Could not find property definition for: " + propId); } + if (params.containsKey(PARAM_CONSTRAINT_REF)) + { + String constraintRef = (String)params.get(PARAM_CONSTRAINT_REF); + + if (constraintRef == null) + { + result = rmAdminService.removeCustomPropertyDefinitionConstraints(propQName); + } + else + { + QName constraintRefQName = QName.createQName(constraintRef, namespaceService); + result = rmAdminService.setCustomPropertyDefinitionConstraint(propQName, constraintRefQName); + } + } + if (params.containsKey(PARAM_LABEL)) { String label = (String)params.get(PARAM_LABEL); result = rmAdminService.updateCustomPropertyDefinitionName(propQName, label); } - if (params.containsKey(PARAM_CONSTRAINT_REF)) - { - String constraintRef = (String)params.get(PARAM_CONSTRAINT_REF); - - if (constraintRef == null) - { - result = rmAdminService.removeCustomPropertyDefinitionConstraints(propQName); - } - else - { - QName constraintRefQName = QName.createQName(constraintRef, namespaceService); - result = rmAdminService.setCustomPropertyDefinitionConstraint(propQName, constraintRefQName); - } - } return result; }