mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Changing workflow REST API URLs to be plural for consistency with other services and also some minor formatting of FTL
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21127 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -4,14 +4,7 @@
|
|||||||
Lists all Workflow Task Instances associated with an authority and of a given State.
|
Lists all Workflow Task Instances associated with an authority and of a given State.
|
||||||
The list of returned tasks also includes pooled tasks which the specified authority is eligible to claim.
|
The list of returned tasks also includes pooled tasks which the specified authority is eligible to claim.
|
||||||
</description>
|
</description>
|
||||||
<url>/api/task-instance</url>
|
<url>/api/task-instances?authority={authority?}&state={state?}&properties={properties?}</url>
|
||||||
<url>/api/task-instance?authority={authority?}</url>
|
|
||||||
<url>/api/task-instance?state={state?}</url>
|
|
||||||
<url>/api/task-instance?properties={properties?}</url>
|
|
||||||
<url>/api/task-instance?authority={authority?}&?state={state?}</url>
|
|
||||||
<url>/api/task-instance?authority={authority?}&?properties={properties?}</url>
|
|
||||||
<url>/api/task-instance?state={state?}&?properties={properties?}</url>
|
|
||||||
<url>/api/task-instance?authority={authority?}&?state={state?}&?properties={properties?}</url>
|
|
||||||
<format default="json"/>
|
<format default="json"/>
|
||||||
<authentication>user</authentication>
|
<authentication>user</authentication>
|
||||||
<transaction allow="readonly">required</transaction>
|
<transaction allow="readonly">required</transaction>
|
||||||
|
@@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
<#import "task.lib.ftl" as taskLib />
|
<#import "task.lib.ftl" as taskLib />
|
||||||
{
|
{
|
||||||
"data": [
|
"data":
|
||||||
<#list taskInstances as task>
|
[
|
||||||
<@taskLib.taskJSON task=task />
|
<#list taskInstances as task>
|
||||||
<#if task_has_next>,</#if>
|
<@taskLib.taskJSON task=task />
|
||||||
</#list>
|
<#if task_has_next>,</#if>
|
||||||
]
|
</#list>
|
||||||
|
]
|
||||||
}
|
}
|
@@ -1,55 +1,53 @@
|
|||||||
<#-- Renders a task instance. -->
|
<#-- Renders a task instance. -->
|
||||||
<#macro taskJSON task >
|
<#macro taskJSON task >
|
||||||
{
|
{
|
||||||
"id": "${task.id}",
|
"id": "${task.id}",
|
||||||
"url": "${task.url}",
|
"url": "${task.url}",
|
||||||
"name": "${task.name}",
|
"name": "${task.name}",
|
||||||
"title": "${task.title}",
|
"title": "${task.title}",
|
||||||
"description": "${task.description}",
|
"description": "${task.description}",
|
||||||
"state": "${task.state}",
|
"state": "${task.state}",
|
||||||
"typeDefinitionTitle": "${task.typeDefinitionTitle}",
|
"typeDefinitionTitle": "${task.typeDefinitionTitle}",
|
||||||
"isPooled": ${task.isPooled?string},
|
"isPooled": ${task.isPooled?string},
|
||||||
"owner":
|
"owner":
|
||||||
<#if task.owner??>
|
<#if task.owner??>
|
||||||
{
|
{
|
||||||
"userName": "${task.owner.userName}",
|
"userName": "${task.owner.userName}",
|
||||||
"firstName": "${task.owner.firstName}",
|
"firstName": "${task.owner.firstName}",
|
||||||
"lastName": "${task.owner.lastName}"
|
"lastName": "${task.owner.lastName}"
|
||||||
},
|
},
|
||||||
<#else>
|
<#else>
|
||||||
null,
|
null,
|
||||||
</#if>
|
</#if>
|
||||||
"properties":
|
"properties":
|
||||||
<@propertiesJSON properties=task.properties />
|
<@propertiesJSON properties=task.properties />
|
||||||
}
|
}
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
<#-- Renders a map of properties -->
|
<#-- Renders a map of properties -->
|
||||||
<#macro propertiesJSON properties>
|
<#macro propertiesJSON properties>
|
||||||
{
|
{
|
||||||
<#list properties?keys as key>
|
<#list properties?keys as key>
|
||||||
"${key}" :
|
"${key}" :
|
||||||
<#if properties[key]??>
|
<#if properties[key]??>
|
||||||
<#assign val=properties[key]>
|
<#assign val=properties[key]>
|
||||||
<#if val?is_boolean == true>
|
<#if val?is_boolean == true>
|
||||||
${val?string}
|
${val?string}
|
||||||
<#elseif val?is_number == true>
|
<#elseif val?is_number == true>
|
||||||
${val?c}
|
${val?c}
|
||||||
<#elseif val?is_sequence>
|
<#elseif val?is_sequence>
|
||||||
[
|
[
|
||||||
<#list val as element>
|
<#list val as element>
|
||||||
"${jsonUtils.encodeJSONString(element?string)}"<#if (element_has_next)>,</#if>
|
"${jsonUtils.encodeJSONString(element?string)}"<#if (element_has_next)>,</#if>
|
||||||
</#list>
|
</#list>
|
||||||
]
|
]
|
||||||
<#else>
|
<#else>
|
||||||
"${jsonUtils.encodeJSONString(shortQName(val?string))}"
|
"${jsonUtils.encodeJSONString(shortQName(val?string))}"
|
||||||
</#if>
|
</#if>
|
||||||
<#else>
|
<#else>
|
||||||
null
|
null
|
||||||
</#if>
|
</#if>
|
||||||
<#if (key_has_next)>,</#if>
|
<#if (key_has_next)>,</#if>
|
||||||
</#list>
|
</#list>
|
||||||
}
|
}
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
|
|
@@ -232,12 +232,12 @@ public class WorkflowModelBuilder
|
|||||||
|
|
||||||
private String getUrl(WorkflowTask task)
|
private String getUrl(WorkflowTask task)
|
||||||
{
|
{
|
||||||
return "api/task-instance/" + task.id;
|
return "api/task-instances/" + task.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getUrl(WorkflowDefinition workflowDefinition)
|
private String getUrl(WorkflowDefinition workflowDefinition)
|
||||||
{
|
{
|
||||||
return "api/workflow-definition/" + workflowDefinition.id;
|
return "api/workflow-definitions/" + workflowDefinition.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ public class WorkflowModelBuilderTest extends TestCase
|
|||||||
Object id = model.get(WorkflowModelBuilder.TASK_ID);
|
Object id = model.get(WorkflowModelBuilder.TASK_ID);
|
||||||
assertEquals(task.id, id);
|
assertEquals(task.id, id);
|
||||||
Object url = model.get(WorkflowModelBuilder.TASK_URL);
|
Object url = model.get(WorkflowModelBuilder.TASK_URL);
|
||||||
assertEquals("api/task-instance/"+task.id, url);
|
assertEquals("api/task-instances/"+task.id, url);
|
||||||
assertEquals(task.name, model.get(WorkflowModelBuilder.TASK_NAME));
|
assertEquals(task.name, model.get(WorkflowModelBuilder.TASK_NAME));
|
||||||
assertEquals(task.title, model.get(WorkflowModelBuilder.TASK_TITLE));
|
assertEquals(task.title, model.get(WorkflowModelBuilder.TASK_TITLE));
|
||||||
assertEquals(task.description, model.get(WorkflowModelBuilder.TASK_DESCRIPTION));
|
assertEquals(task.description, model.get(WorkflowModelBuilder.TASK_DESCRIPTION));
|
||||||
@@ -143,7 +143,7 @@ public class WorkflowModelBuilderTest extends TestCase
|
|||||||
|
|
||||||
Map<String, Object> model = builder.buildSimple(workflowDefinition);
|
Map<String, Object> model = builder.buildSimple(workflowDefinition);
|
||||||
assertEquals(workflowDefinition.id, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_ID));
|
assertEquals(workflowDefinition.id, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_ID));
|
||||||
assertEquals("api/workflow-definition/" + workflowDefinition.id, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_URL));
|
assertEquals("api/workflow-definitions/" + workflowDefinition.id, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_URL));
|
||||||
assertEquals(workflowDefinition.name, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_NAME));
|
assertEquals(workflowDefinition.name, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_NAME));
|
||||||
assertEquals(workflowDefinition.title, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_TITLE));
|
assertEquals(workflowDefinition.title, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_TITLE));
|
||||||
assertEquals(workflowDefinition.description, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_DESCRIPTION));
|
assertEquals(workflowDefinition.description, model.get(WorkflowModelBuilder.WORKFLOW_DEFINITION_DESCRIPTION));
|
||||||
|
Reference in New Issue
Block a user