Services Documentation Manager for version 6

1
0
-1

hi,

In version 5.10 of Bonita I have the following script:

import org.ow2.bonita.services.DocumentationManager; "final DocumentationManager manager EnvTool.getDocumentationManager = ();" ...

I am studying a possible migration to version 6 of the software, however I have not found org.ow2.bonita.services.DocumentationManager in version 6.

How can I find an example or documentation of this object in the new version?

I appreciate any help!

2 answers

1
+1
-1

You are right that this does not exist in 6, that is because 6 has a completely new method of doing documents.

My suggestion is to follow the steps in http://documentation.bonitasoft.com/migrate-bonita-open-solution get the report and then re-code the offending parts.

Yes, this will be a major headache, but it's the only way I know of doing it right.

Good luck,

1
0
-1

thanks for the answer. I continue searching...

Comments

Submitted by Sean McP on Thu, 04/30/2015 - 15:22

Searching? Searching for what?

5 to 6 was a big leap and re-coding will be required. What are you searching for? May be we can help.

regards

Submitted by rafa brito on Wed, 05/06/2015 - 20:35

so, at a certain stage of a process I need to read a csv file that the User uploaded. For reading the file I have no problems, but I need to read the file's full path. As you know Firefox and Chrome do not provide this information through the file widget that way I can not read the file. In version 5 I used the Document method and Attachment and so I was reading the file. Can you understand me?You can help me or give a suggestion?

regards.

Submitted by Sean McP on Thu, 05/07/2015 - 06:37

I'm confused a little, you say:

...I need to read a csv file that the User uploaded. For reading the file I have no problems...

then you say

...I can not read the file...

either you can or you can't... :)

Whichever you cannot get the path C:\user\my documents\thisfile.csv to a local users file

I posted this on a different post before http://community.bonitasoft.com/answers/upload-file-get-its-source-path :

The whole idea of web services is that the browser/web will not have access to local files, only those in the web servers path.

We struggled with this I now remember, spent a long time figuring it out and found it was impossible.

Our process is now quite simple

User loads the file, we save it to either a webserver folder (under tomcat/Catalina) or to a database (in our case Postgres) then later in many other processes we access and edit the files as necessary... * *No need for any client access at all, with all the necessary security benefits as well.

If you want the INTERNAL path to the uploaded file then use getURL() (see the javadoc).

I do this a lot and have no problems at all reading writing files without the path being known. For example reading, opening and processing a file I do something like this, you will need to change it as it's not complete... :) can't give away all my secrets :)

//Open input Stream
ByteArrayInputStream str = new ByteArrayInputStream(documentData.getContent()); // documentData is the Document uploaded

//read the whole file
 StringBuilder sb = new StringBuilder();
 int ch;
 while((ch = str.read()) != -1) {
          sb.append(Character.toString((char) ch));
 }

//read file into a ArrayList splitting each line into a separate line
 String tempL = sb.toString();
 String[] tempLA = tempL.split("\r?\n");
 ArrayList<String> configLines = new ArrayList<String>(Arrays.asList(tempLA));

 //process each line of the input file
 for (int lNo=0; lNo<configLines.size(); lNo++){
//do what you need to do
 }

Hope that helps, but your quest for the path is a vain one, and not possible purely for security reasons, this is true of all browsers now.

regards

Submitted by rafa brito on Thu, 05/07/2015 - 14:27

You understand perfectly.

That's exactly what I need!

I was so obsessed with finding something like what we have in the previous version did not see the getContent () method in DocumentValue ...

I was in my face and I did not see ... My mind just exploded now ... lol

In version 5 I did not use the file path. As I was not finding anything like I decide to go one way I see now I was wrong.

Just out of curiosity, I was doing well in version 5.10:

                        Gson gson= new Gson();
                        String json="";
                        final DocumentationManager manager = EnvTool.getDocumentationManager();
                        List<org.ow2.bonita.services.Document> result= DocumentService.getDocuments(manager, processInstance.getProcessInstanceUUID(), 'attachmentFile');
                        Document doc;
                       
                           if(result!=null&&result.size()>0)
                           {
                                  // org.ow2.bonita.services.Document doc=result.get(0);
                                        final DocumentUUID documentUUID = new DocumentUUID(result.get(0).getId());
                                        doc = AccessorUtil.getQueryRuntimeAPI().getDocument(documentUUID);
                                       
                                        if (doc.getContentFileName() != "" && doc.getContentFileName() != null){
                                                //bla bla bla
                       
                           }
                               
                        byte[] rawData=   AccessorUtil.getQueryRuntimeAPI().getDocumentContent(doc.getUUID());
                        json= new String(rawData);

No more not to put code also reveal all my secrets. ;)

Thank you Sean!

Regards!

Submitted by Sean McP on Thu, 05/07/2015 - 15:20

Glad I could help,

regards

Notifications