2017-04-26 17 views
0

这是上传文件Alfresco Activiti - 如何在户外活动中获得附件ID?

"fieldType":"AttachFileFieldRepresentation", 
     "id":"upload_file", 
     "name":"Upload source project (project folder or zip file)", 
     "type":"upload", 

的形式,并且在执行监听器类中的方法json的代码,我创建了我有这样的代码

taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); 
    Attachment attach = taskService.getAttachment("upload_file"); 
if(attach!=null){ 
    System.out.println("Attachment not null"); 
    } else { 
     System.out.println("Null file attached"); 
     } 

每次我得到一个空文件

我无法检索上传的文件。 我不知道我在做什么错误 你能帮我怎么得到附件吗?

+0

尝试从TaskService的'getTaskAttachments(String taskId)'方法获取任务的所有附件。 –

回答

1

请尝试此代码可能会帮助您获取附件ID。

ActivitiScriptNode scriptNode =(ActivitiScriptNode)execution.getVariable(WorkflowNotificationUtils.PROP_PACKAGE);
NodeRef packagenode = scriptNode.getNodeRef(); NodeRef docRef = Configuration.serviceRegistry.getNodeService()。getChildAssocs(packagenode).get(0).getChildRef();

+0

谢谢。但我需要更多的帮助。喜欢,如何获得附件ID。字符串attachment_id = ...... //如何在这里获取它 – Kangkan

相关问题