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:
Tuna Aksoy
2012-08-26 20:54:37 +00:00
parent 4806ecab33
commit 76ef6c3f33
3 changed files with 28 additions and 22 deletions

View File

@@ -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,6 +766,8 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
if (newName == null) return propQName; if (newName == null) return propQName;
QName newPropQName = getQNameForClientId(newName); QName newPropQName = getQNameForClientId(newName);
if (newPropQName != null)
{
propDefn = dictionaryService.getProperty(newPropQName); propDefn = dictionaryService.getProperty(newPropQName);
if (propDefn != null) if (propDefn != null)
{ {
@@ -772,13 +775,14 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
String propIdAsString = newPropQName.toPrefixString(namespaceService); String propIdAsString = newPropQName.toPrefixString(namespaceService);
throw new PropertyAlreadyExistsMetadataException(propIdAsString); 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())

View File

@@ -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);

View File

@@ -136,12 +136,6 @@ public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript
"Could not find property definition for: " + propId); "Could not find property definition for: " + propId);
} }
if (params.containsKey(PARAM_LABEL))
{
String label = (String)params.get(PARAM_LABEL);
result = rmAdminService.updateCustomPropertyDefinitionName(propQName, label);
}
if (params.containsKey(PARAM_CONSTRAINT_REF)) if (params.containsKey(PARAM_CONSTRAINT_REF))
{ {
String constraintRef = (String)params.get(PARAM_CONSTRAINT_REF); String constraintRef = (String)params.get(PARAM_CONSTRAINT_REF);
@@ -156,6 +150,13 @@ public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript
result = rmAdminService.setCustomPropertyDefinitionConstraint(propQName, constraintRefQName); result = rmAdminService.setCustomPropertyDefinitionConstraint(propQName, constraintRefQName);
} }
} }
if (params.containsKey(PARAM_LABEL))
{
String label = (String)params.get(PARAM_LABEL);
result = rmAdminService.updateCustomPropertyDefinitionName(propQName, label);
}
return result; return result;
} }