Skip to content

Latest commit

 

History

History
 
 

activiti-merge-attached-word-documents

This project contains all the components required to merge the attached doc files (.doc/.docx) in a process

Use-Case / Requirement

The workflow should create a cover page, with the names from the attached .doc/.docx documents. Store the cover page in Alfresco Content Repo. Generate another document by combining the cover page and the merged documents.

Prerequisites to run this demo end-2-end

Configuration Steps

Activiti Setup and Process Deployment

  1. Setup Alfresco Activiti if you don't have one already. Instructions & help available at Activiti Docs, Alfresco BPM Community

  2. Import the Merge-Documents.zip app available in this project into Activiti.

  3. The process flow. Process-Flow

  4. The REST API configuration. Process-Configuration-2

  5. The REST Call's Endpoint configuration. Process-Configuration-3

  6. Configure Endpoint in Tentant Process-Configuration-4

  7. The Generate Document configuration. Process-Configuration-1

  8. Javascript code to extract info of attached documents Process-Configuration-5

    import groovy.json.JsonSlurper;
    
    def jsonSlurper = new JsonSlurper();
    def attachedFileList = jsonSlurper.parseText(execution.getVariable('attachedFiles'));
    def attachedFileNames = attachedFileList.findAll().collect{it.name};
    execution.setVariable('attachedFileNames', attachedFileNames);

    Process-Configuration-6

  9. The javascript code to merge document.

    java.lang.System.out.println("***  Started - Merge document *** ");
    documentMergeBean.mergeDocuments('coverLetterDoc;file1;file2', 'coverLetterDoc', execution);
    java.lang.System.out.println("***  Finished - Merge document *** ");

    Javascript

  10. Publish to Alfresco configuration. Publish

  11. Publish/Deploy the App.

Run the DEMO

References

  1. http://docs.alfresco.com/process-services1.6/topics/document_merge_bean_documentmergebean.html
  2. https://docs.alfresco.com/activiti/docs/dev-guide/1.4.0/#_document_merge_bean_documentmergebean
  3. http://docs.alfresco.com/process-services1.6/topics/document_templates.html
  4. https://docs.alfresco.com/activiti/docs/dev-guide/1.5.0/#_document_templates