Alfresco - 是否可以使用Java API从工作流任务获取bpm:comment属性?

时间:2018-04-13 05:24:59

标签: alfresco

我尝试从WorkflowTask Object获取属性但没有获取comment属性。目前引用此API文档:https://dev.alfresco.com/resource/AlfrescoOne/5.1/PublicAPI/org/alfresco/service/cmr/workflow/WorkflowTask.html

List<WorkflowTask> allTasks;
allTasks = workflowService.queryTasks(taskQuery,true);
for(int i=0; i<allTasks.size(); i++)
    {
        HashMap<String, Object> taskInfo = new HashMap<String, Object>();
        task = allTasks.get(i);
        Map<QName,Serializable> taskProperties =  task.getProperties();
    }

我运行了调试模式并检查了taskProperties的内容。

1 个答案:

答案 0 :(得分:2)

您似乎正在尝试检索活动任务的注释,这些任务尚未完成。对于这些任务,您需要用户编写注释并保存。 保存后,您将能够看到它。

如果它不是您正在获得的活动任务,则注释不应为null。 当我尝试使用相同的代码检索活动任务和打印属性时,输出如下。

{http://www.alfresco.org/model/content/1.0}created = Fri Mar 16 12:56:26 IST 2018
{http://www.alfresco.org/model/bpm/1.0}percentComplete = 0
{http://www.alfresco.org/model/bpm/1.0}pooledActors = []
{http://www.alfresco.org/model/content/1.0}name = Task
{http://www.alfresco.org/model/bpm/1.0}packageActionGroup = 
{http://www.alfresco.org/model/bpm/1.0}reassignable = true
{http://www.alfresco.org/model/bpm/1.0}outcomePropertyName = {http://www.alfresco.org/model/workflow/1.0}reviewOutcome
{http://www.alfresco.org/model/content/1.0}owner = test
{http://www.alfresco.org/model/workflow/1.0}reviewOutcome = Reject
{http://www.alfresco.org/model/bpm/1.0}taskId = 1889
{http://www.alfresco.org/model/bpm/1.0}packageItemActionGroup = edit_package_item_actions
{http://www.alfresco.org/model/bpm/1.0}dueDate = null
{http://www.alfresco.org/model/bpm/1.0}completionDate = null
{http://www.alfresco.org/model/bpm/1.0}description = asd
{http://www.alfresco.org/model/bpm/1.0}priority = 2
{http://www.alfresco.org/model/bpm/1.0}status = Not Yet Started
{http://www.alfresco.org/model/bpm/1.0}package = workspace://SpacesStore/ee203aff-9842-4d7b-b7e9-0f40b0b8a3b3
{http://www.alfresco.org/model/bpm/1.0}startDate = Fri Mar 16 12:56:26 IST 2018
{http://www.alfresco.org/model/bpm/1.0}comment = sdadasdasdasd
{http://www.alfresco.org/model/bpm/1.0}hiddenTransitions =