mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
It was not possible to edit/delete a custom meta data
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0-BUG-FIX@40904 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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())
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user