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.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
import org.springframework.extensions.surf.util.ParameterCheck;
|
import org.springframework.extensions.surf.util.ParameterCheck;
|
||||||
|
import org.springframework.extensions.surf.util.URLDecoder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Records Management AdminService Implementation.
|
* Records Management AdminService Implementation.
|
||||||
@@ -765,20 +766,23 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
|||||||
if (newName == null) return propQName;
|
if (newName == null) return propQName;
|
||||||
|
|
||||||
QName newPropQName = getQNameForClientId(newName);
|
QName newPropQName = getQNameForClientId(newName);
|
||||||
propDefn = dictionaryService.getProperty(newPropQName);
|
if (newPropQName != null)
|
||||||
if (propDefn != null)
|
|
||||||
{
|
{
|
||||||
// The requested QName is already in use
|
propDefn = dictionaryService.getProperty(newPropQName);
|
||||||
String propIdAsString = newPropQName.toPrefixString(namespaceService);
|
if (propDefn != null)
|
||||||
throw new PropertyAlreadyExistsMetadataException(propIdAsString);
|
{
|
||||||
|
// The requested QName is already in use
|
||||||
|
String propIdAsString = newPropQName.toPrefixString(namespaceService);
|
||||||
|
throw new PropertyAlreadyExistsMetadataException(propIdAsString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI());
|
NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI());
|
||||||
M2Model deserializedModel = readCustomContentModel(modelRef);
|
M2Model deserializedModel = readCustomContentModel(modelRef);
|
||||||
|
|
||||||
M2Property targetProperty = findProperty(propQName, deserializedModel);
|
M2Property targetProperty = findProperty(propQName, deserializedModel);
|
||||||
targetProperty.setName(newName);
|
targetProperty.setName(new StringBuilder().append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX).append(QName.NAMESPACE_PREFIX).append(newName).toString());
|
||||||
targetProperty.setTitle(newName);
|
targetProperty.setTitle(URLDecoder.decode(newName));
|
||||||
writeCustomContentModel(modelRef, deserializedModel);
|
writeCustomContentModel(modelRef, deserializedModel);
|
||||||
|
|
||||||
if (logger.isInfoEnabled())
|
if (logger.isInfoEnabled())
|
||||||
|
@@ -33,6 +33,7 @@ import org.alfresco.service.namespace.QName;
|
|||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONTokener;
|
import org.json.JSONTokener;
|
||||||
|
import org.springframework.extensions.surf.util.URLDecoder;
|
||||||
import org.springframework.extensions.webscripts.Cache;
|
import org.springframework.extensions.webscripts.Cache;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
import org.springframework.extensions.webscripts.WebScriptException;
|
import org.springframework.extensions.webscripts.WebScriptException;
|
||||||
@@ -152,7 +153,7 @@ public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript
|
|||||||
String customisableElement = (String)params.get(PARAM_ELEMENT);
|
String customisableElement = (String)params.get(PARAM_ELEMENT);
|
||||||
QName customisableType = mapToTypeQName(customisableElement);
|
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
|
//According to the wireframes, type here can only be date|text|number
|
||||||
Serializable serializableParam = params.get(PARAM_DATATYPE);
|
Serializable serializableParam = params.get(PARAM_DATATYPE);
|
||||||
|
@@ -136,26 +136,27 @@ public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript
|
|||||||
"Could not find property definition for: " + propId);
|
"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))
|
if (params.containsKey(PARAM_LABEL))
|
||||||
{
|
{
|
||||||
String label = (String)params.get(PARAM_LABEL);
|
String label = (String)params.get(PARAM_LABEL);
|
||||||
result = rmAdminService.updateCustomPropertyDefinitionName(propQName, 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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user