RM-550 (JS Error while declaring a record)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0-BUG-FIX@43661 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2012-11-16 15:05:06 +00:00
parent 08cc495c65
commit d4a6a842ba
2 changed files with 325 additions and 341 deletions

View File

@@ -29,6 +29,7 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.AspectDefinition;
@@ -56,8 +57,7 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
private static Log logger = LogFactory.getLog(DeclareRecordAction.class); private static Log logger = LogFactory.getLog(DeclareRecordAction.class);
/** /**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
* org.alfresco.service.cmr.repository.NodeRef)
*/ */
@Override @Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
@@ -81,7 +81,8 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
} }
else else
{ {
throw new AlfrescoRuntimeException(buildMissingPropertiesErrorString(missingProperties)); logger.debug(buildMissingPropertiesErrorString(missingProperties));
action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, "missingProperties");
} }
} }
} }
@@ -107,8 +108,7 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
/** /**
* Helper method to check whether all the mandatory properties of the node have been set * Helper method to check whether all the mandatory properties of the node have been set
* *
* @param nodeRef * @param nodeRef node reference
* node reference
* @return boolean true if all mandatory properties are set, false otherwise * @return boolean true if all mandatory properties are set, false otherwise
*/ */
private boolean mandatoryPropertiesSet(NodeRef nodeRef, List<String> missingProperties) private boolean mandatoryPropertiesSet(NodeRef nodeRef, List<String> missingProperties)
@@ -203,23 +203,9 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
{ {
return true; return true;
} }
else
{
if (throwException)
{
throw new AlfrescoRuntimeException(buildMissingPropertiesErrorString(missingProperties));
} }
else
{
return false; return false;
} }
}
}
else
{
return false;
}
}
else else
{ {
if (throwException) if (throwException)

View File

@@ -86,7 +86,7 @@ public class RmActionPost extends DeclarativeWebScript
} }
String actionName = null; String actionName = null;
List<NodeRef> targetNodeRefs = null; List<NodeRef> targetNodeRefs = new ArrayList<NodeRef>(1);
Map<String, Serializable> actionParams = new HashMap<String, Serializable>(3); Map<String, Serializable> actionParams = new HashMap<String, Serializable>(3);
try try
@@ -103,7 +103,6 @@ public class RmActionPost extends DeclarativeWebScript
if (jsonObj.has(PARAM_NODE_REF) == true) if (jsonObj.has(PARAM_NODE_REF) == true)
{ {
NodeRef nodeRef = new NodeRef(jsonObj.getString(PARAM_NODE_REF)); NodeRef nodeRef = new NodeRef(jsonObj.getString(PARAM_NODE_REF));
targetNodeRefs = new ArrayList<NodeRef>(1);
targetNodeRefs.add(nodeRef); targetNodeRefs.add(nodeRef);
} }
if (jsonObj.has(PARAM_NODE_REFS) == true) if (jsonObj.has(PARAM_NODE_REFS) == true)
@@ -124,10 +123,9 @@ public class RmActionPost extends DeclarativeWebScript
if (jsonObj.has(PARAM_PARAMS)) if (jsonObj.has(PARAM_PARAMS))
{ {
JSONObject paramsObj = jsonObj.getJSONObject(PARAM_PARAMS); JSONObject paramsObj = jsonObj.getJSONObject(PARAM_PARAMS);
for (Iterator iter = paramsObj.keys(); iter.hasNext(); ) for (Iterator<String> iter = paramsObj.keys(); iter.hasNext(); )
{ {
Object nextKey = iter.next(); String nextKeyString = iter.next();
String nextKeyString = (String)nextKey;
Object nextValue = paramsObj.get(nextKeyString); Object nextValue = paramsObj.get(nextKeyString);
// Check for date values // Check for date values