Page 1 of 1

Set path (upload) in the newly created folder

PostPosted:Fri Jan 06, 2017 5:33 am
by jimac
Good Day! :) :D

Is this possible?

When my workflow starts, a folder is automatically created and is renamed by user1 based on what he/she will input in the form.
Then that newly created folder will be the storage for all the users who is tasked to upload a document.

I don't know how to set the upload path of all users (who is tasked to upload a file) in the created folder.

by the way this is my code in the creation of the folder:
Code: Select all
package com.sample.action;

import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
//import com.openkm.bean.form.Input;
import com.openkm.api.OKMFolder;
import com.openkm.bean.form.Input;
import com.openkm.module.db.stuff.DbSessionManager;

 public class foldercreate implements ActionHandler{

	private static final long serialVersionUID = 1L;

	@Override
	public void execute(ExecutionContext context) throws Exception {
		String fldpath = "/okm:root/";
		
		Input sn = (Input) context.getContextInstance().getVariable("sn");
		String in = sn.getValue();
		String systemToken = DbSessionManager.getInstance().getSystemToken();
		OKMFolder.getInstance().createSimple(systemToken,fldpath +in);	
		 context.getToken().signal();
	}  
 }
Thank you! :D :lol:

Re: Set path (upload) in the newly created folder

PostPosted:Mon Jan 09, 2017 8:22 am
by jllort
In the upload form you can set the uuid of the folder ( the attribute data ( what is expected to be an object of Upload type ) is used for this mapping )

Re: Set path (upload) in the newly created folder

PostPosted:Mon Jan 09, 2017 8:45 am
by jimac
jllort wrote:In the upload form you can set the uuid of the folder ( the attribute data ( what is expected to be an object of Upload type ) is used for this mapping )

update:


Hello Jllort,

what is the code to get a document that is uploaded in a folder?

in my case:
that particular folder always contain 1 document only.

My plan is, when user1 uploaded a document in folder1, the workflow will start immeadiately ( Iam using automation) then get that document and move it in
the newly created folder.

what I dont know is , how to get that uploaded document in folder1.
Thanks!

Re: Set path (upload) in the newly created folder

PostPosted:Wed Jan 11, 2017 7:33 pm
by jllort
Take a look at our api documentation at https://docs.openkm.com/apidoc/ look for classes into package com.openkm.api ( specially in your case the method getChildren from OKMDocument class )

Re: Set path (upload) in the newly created folder

PostPosted:Wed Nov 11, 2020 8:40 pm
by az123
hello jimac,

do you find the solution to modify the path(code source)

Re: Set path (upload) in the newly created folder

PostPosted:Sat Nov 14, 2020 1:22 pm
by jllort