2017-04-26 2 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"); 
     } 

나는 널 (null) 파일을받을 때마다이 생성됩니다 .

업로드 된 파일을 검색 할 수 없습니다. 내가 뭘 잘못하고 있는지 모르겠다. 첨부 파일을 어떻게 얻을 수 있습니까?

+0

try - 태스크의 모든 첨부 파일을 얻기 위해 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를 얻는 방법. String attachment_id = ...... // 여기에서 가져 오는 방법 – Kangkan

관련 문제