use of org.alfresco.service.cmr.workflow.WorkflowTransition in project acs-community-packaging by Alfresco.
the class ManageTaskDialog method getAdditionalButtons.
@Override
public List<DialogButtonConfig> getAdditionalButtons() {
List<DialogButtonConfig> buttons = null;
if (this.getWorkflowTask() != null) {
// get the transitions available from this task and
// show them in the dialog as additional buttons
this.transitions = this.getWorkflowTask().path.node.transitions;
boolean isPooledTask = isPooledTask();
if (isPooledTask || this.transitions != null) {
buttons = new ArrayList<DialogButtonConfig>(this.transitions.length + 1);
if (isPooledTask) {
if (this.taskNode.getProperties().get(ContentModel.PROP_OWNER) == null) {
buttons.add(new DialogButtonConfig("button_take_ownership", null, "take_ownership", "#{DialogManager.bean.takeOwnership}", "false", null));
} else {
buttons.add(new DialogButtonConfig("button_return_to_pool", null, "return_ownership", "#{DialogManager.bean.returnOwnership}", "false", null));
}
}
if (this.transitions != null) {
Object hiddenTransitions = this.taskNode.getProperties().get(WorkflowModel.PROP_HIDDEN_TRANSITIONS);
for (WorkflowTransition trans : this.transitions) {
if (hiddenTransitions == null || (hiddenTransitions instanceof String && ((String) hiddenTransitions).equals("")) || (hiddenTransitions instanceof String && !((String) hiddenTransitions).equals(trans.id)) || (hiddenTransitions instanceof List<?>) && !((List<?>) hiddenTransitions).contains(trans.id)) {
if (this.taskNode.getProperties().get(ContentModel.PROP_OWNER) != null) {
buttons.add(new DialogButtonConfig(ID_PREFIX + trans.title, trans.title, null, "#{DialogManager.bean.transition}", "false", null));
}
}
}
}
}
}
return buttons;
}
use of org.alfresco.service.cmr.workflow.WorkflowTransition in project alfresco-remote-api by Alfresco.
the class AbstractWorkflowRestApiTest method checkWorkflowTaskDefinition.
private void checkWorkflowTaskDefinition(WorkflowTaskDefinition wfDefinition, JSONObject definition) throws Exception {
assertNotNull(definition);
assertEquals(wfDefinition.getId(), definition.getString("id"));
assertTrue(definition.has("url"));
JSONObject type = definition.getJSONObject("type");
TypeDefinition startType = (wfDefinition).getMetadata();
assertNotNull(type);
assertEquals(startType.getName().toPrefixString(), type.getString("name"));
assertEquals(startType.getTitle(this.dictionaryService), type.getString("title"));
assertEquals(startType.getDescription(this.dictionaryService), type.getString("description"));
assertTrue(type.has("url"));
JSONObject node = definition.getJSONObject("node");
WorkflowNode startNode = wfDefinition.getNode();
assertNotNull(node);
assertEquals(startNode.getName(), node.getString("name"));
assertEquals(startNode.getTitle(), node.getString("title"));
assertEquals(startNode.getDescription(), node.getString("description"));
assertEquals(startNode.isTaskNode(), node.getBoolean("isTaskNode"));
JSONArray transitions = node.getJSONArray("transitions");
WorkflowTransition[] startTransitions = startNode.getTransitions();
assertNotNull(transitions);
assertEquals(startTransitions.length, transitions.length());
for (int i = 0; i < transitions.length(); i++) {
JSONObject transition = transitions.getJSONObject(i);
WorkflowTransition startTransition = startTransitions[i];
assertNotNull(transition);
if (startTransition.getId() == null) {
assertEquals("", transition.getString("id"));
} else {
assertEquals(startTransition.getId(), transition.getString("id"));
}
assertEquals(startTransition.getTitle(), transition.getString("title"));
assertEquals(startTransition.getDescription(), transition.getString("description"));
assertEquals(startTransition.isDefault(), transition.getBoolean("isDefault"));
assertTrue(transition.has("isHidden"));
}
}
Aggregations