REPO-1309: Execute an action asynchronously

- targetId is now optional, however, currently targetId must be a valid node ID.
This commit is contained in:
Cristian Turlica
2018-01-16 17:53:18 +02:00
parent 6d07efafa2
commit 35a5dbd044
2 changed files with 9 additions and 18 deletions

View File

@@ -216,18 +216,17 @@ public class ActionsImpl implements Actions
throw new EntityNotFoundException(action.getActionDefinitionId()); throw new EntityNotFoundException(action.getActionDefinitionId());
} }
// Check target id. // targetId is optional, however, currently targetId must be a valid node ID.
NodeRef actionedUponNodeRef = null;
if (action.getTargetId() == null || action.getTargetId().isEmpty()) if (action.getTargetId() != null && !action.getTargetId().isEmpty())
{ {
throw new InvalidArgumentException("targetId missing"); // Does it exist in the repo?
} actionedUponNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, action.getTargetId());
// Does it exist in the repo? if (!nodeService.exists(actionedUponNodeRef))
NodeRef actionedUponNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, action.getTargetId()); {
if (!nodeService.exists(actionedUponNodeRef)) throw new EntityNotFoundException(action.getTargetId());
{ }
throw new EntityNotFoundException(action.getTargetId());
} }
org.alfresco.service.cmr.action.Action cmrAction; org.alfresco.service.cmr.action.Action cmrAction;

View File

@@ -536,14 +536,6 @@ public class TestActions extends AbstractBaseApiTest
actions.executeAction(action, emptyParams, 404); actions.executeAction(action, emptyParams, 404);
} }
// targetId missing but required by the action.
{
Action action = new Action();
action.setActionDefinitionId(AddFeaturesActionExecuter.NAME);
actions.executeAction(action, emptyParams, 400);
}
// Non-existent targetId // Non-existent targetId
{ {
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "750a2867-ecfa-478c-8343-fa0e39d27be3"); NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "750a2867-ecfa-478c-8343-fa0e39d27be3");