ALF-800 Externalized the exception messages for JB PMEngine.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19806 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
N Smith
2010-04-12 09:46:34 +00:00
parent 54dc7f28ca
commit b9df501ad7

View File

@@ -2,18 +2,34 @@ function main()
{
// Task ID
var taskId = url.templateArgs.taskId;
if (taskId === undefined)
if (taskId === undefined || taskId == null )
{
status.setCode(status.STATUS_BAD_REQUEST, "TaskID missing when ending task.");
return;
}
// TODO Quick-fix, workaround to handle $ being removed from taskId.
// C;heck taskId contains $ and add if not.
var separatorIndex = taskId.indexOf('$');
if(separatorIndex == -1)
{
if(taskId.indexOf('jbpm') == 0)
{
taskId = 'jbpm$' + taskId.substring(4);
}
else
{
status.setCode(status.STATUS_BAD_REQUEST, "TaskID missing when ending task.");
return;
}
}
// Check TaskId is valid
var task = workflow.getTask(taskId);
if (task === null)
{
status.setCode(status.STATUS_BAD_REQUEST, "Invalid TaskID when ending task.");
return;
status.setCode(status.STATUS_BAD_REQUEST, "Invalid TaskID when ending task.");
return;
}
model.taskId = taskId;