Upload Multiple Documents to Alfresco

1
0
-1

I am using uploading multiple documents using bonita ui by using Multiple file uploading example given at link : http://community.bonitasoft.com/project/file-upload-and-download-process... I required to upload multiple documents to alfresco. How can i do that ?.I am new to bonita and alfresco so help kindly. Thanks in advance.

Comments

Submitted by Sean McP on Tue, 11/15/2016 - 00:51

You need to learn alfresco as well... :)

First things first is what version of Alfresco? If 5 then it may be possible, if 6 then the wizard will not work.

regards
Seán

Submitted by mainamaan77 on Tue, 11/15/2016 - 16:51

Yes i have successfully uploaded single document to alfresco 5.0c. But i need help for how to upload multiple document to alfresco 5.0c using bonita 7.3.1.

2 answers

1
0
-1
This one is the BEST answer!

The way we create the list is as follows (as per our requirement):

  1. List<Long> xList = new ArrayList<Long>();
  2. def x;
  3.  
  4. if(1<=outputFiles){if (outputDoc01 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc01").getId(); xList.add(x);}}
  5. if(2<=outputFiles){if (outputDoc02 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc02").getId(); xList.add(x);}}
  6. if(3<=outputFiles){if (outputDoc03 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc03").getId(); xList.add(x);}}
  7. if(4<=outputFiles){if (outputDoc04 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc04").getId(); xList.add(x);}}
  8. if(5<=outputFiles){if (outputDoc05 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc05").getId(); xList.add(x);}}
  9. if(6<=outputFiles){if (outputDoc06 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc06").getId(); xList.add(x);}}
  10. if(7<=outputFiles){if (outputDoc07 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc07").getId(); xList.add(x);}}
  11. if(8<=outputFiles){if (outputDoc08 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc08").getId(); xList.add(x);}}
  12. if(9<=outputFiles){if (outputDoc09 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc09").getId(); xList.add(x);}}
  13. if(10<=outputFiles){if(outputDoc10 == null){ /* do nothing */ } else{x = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "outputDoc10").getId(); xList.add(x);}}
  14.  
  15. return xList;

In the Caller Step we use this list with iterator docID (type Long) which is Mapped to Target docID.

This works perfectly with us and all our documents get processes correctly by the subroutine.

...then in first automatic step in operations i used following code to get document from docId and assigned it to myDocument Variable in subprocess. But i don't get Any value in myDocument variable in next step.

I would only use the docID in the subprocess to access the document directly, do not try to manipulate it to another variable, it is not necessary.

You should then be able to do what you want to do, we do this all the time (but not with Alfresco).

regards
Seán

PS: As this reply answers your question, please mark as resolved by ticking the tick mark on the left of this reply.

Comments

Submitted by mainamaan77 on Thu, 11/24/2016 - 09:48

is it possible to hide and show these input documents on button clcik??

Submitted by Sean McP on Thu, 11/24/2016 - 10:25

Sure but that's another question...

Use a page variable, add the documents to a container, set the container hidden value to the page variable. Create a button widget to toggle the page variable.

Regards
Seán

1
0
-1

What you have to do is add another step that calls a subroutine to do the work

For example I have a list of documents [doc01, ... doc10]

You have to multiinstantiate a call to the upload step with the docID. The upload step then does an individual upload at a time.

See here http://documentation.bonitasoft.com/?page=documents and look for documents and called processes.

Depending on your server you can either do this sequentially, or in parallel.

regards
Seán

PS: As this reply answers your question, please mark as resolved by ticking the tick mark on the left of this reply.

Comments

Submitted by mainamaan77 on Wed, 11/16/2016 - 11:05

As i mentioned that i have used 1.2.0 version example at http://community.bonitasoft.com/project/file-upload-and-download-process to upload and download document.
I have added multi-instantiation a call activity after step mentioned in example "Step download latest. version".selected option of "create instance from a list" and add a doclist contaning docId by using following code:

import java.util.logging.Logger;

import org.bonitasoft.engine.bpm.contract.FileInputValue
import org.bonitasoft.engine.bpm.document.Document
import org.bonitasoft.engine.bpm.document.DocumentValue

List xList = new ArrayList();
def x;

int index = 0
int numberOfResult = 1
List documents

while((documents = apiAccessor.processAPI.getDocumentList(processInstanceId, "myMultipleDocuments", index, numberOfResult)).size()) {
for(Document currentDocument : documents) {
x=currentDocument.getId();
xList.add(x);

}
index += numberOfResult

}

return xList;
I added all document ids to doclist in operation of step befre call activty means in "step upload new Version".
Then i map docId to subprocess docId then in first automatic step in operations i used following code to get document from docId and assigned it to myDocument Variable in subprocess. But i don't get Any value in myDocument variable in next step. Kindly hep in finding out what can be the problem. I don't understand i completely follow the link http://documentation.bonitasoft.com/?page=documents.Help kindly.

Submitted by Sean McP on Wed, 11/16/2016 - 22:26

A Tip on displaying CODE/LOGS correctly in Posts:

Do not use the Supplied Buttons above, for some reason they refuse to work correctly, and despite bringing it to Bonitasofts attention, it's low priority.

To Show Code/Logs correctly use

< code >
your code/log
< /code >

removing the spaces to allow the showing of code/logs correctly as here:

  1. your code/log

Thanks and regards
Seán

Notifications