Hello everyone, I try to make a simple workflow with upload forms, in one task I just upload a file with type="create", in another task I just upload another file with type="update".
The problem is, when I try to update the file, the system throws an error C:/fakepath/file_name OKM-005015.
Reading de source, the 005 is an error originated by "Upload Service" and the 015 is caused by "Path not found", but I define 2 variables for every upload form and the path or uuid for each one.
I use windows 7.
Forms.xml
The problem is, when I try to update the file, the system throws an error C:/fakepath/file_name OKM-005015.
Reading de source, the 005 is an error originated by "Upload Service" and the 015 is caused by "Path not found", but I define 2 variables for every upload form and the path or uuid for each one.
I use windows 7.
Forms.xml
Code: Select all
ActionHandler for the first upload
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.4//EN"
"http://www.openkm.com/dtd/workflow-forms-2.4.dtd">
<workflow-forms>
<workflow-form task="creacion">
<upload name="upload1" label="Subir archivo" data="data_upload1">
</upload>
<button name="aceptar1" label="aceptar"/>
</workflow-form>
<workflow-form task="actualizacion">
<upload name="upload2" label="Subir archivo" data="data_upload2" type="update">
</upload>
<button name="aceptar2" label="aceptar"/>
</workflow-form>
</workflow-forms>
Code: Select all
Actionhandler for the second upload
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import com.openkm.api.OKMRepository;
import com.openkm.bean.form.Upload;
public class PrimerUpload implements ActionHandler {
private static final long serialVersionUID = 1L;
@Override
public void execute(ExecutionContext context) throws Exception {
String uuid = (String) context.getContextInstance().getVariable("uuid");
String token = context.getToken().toString();
String folderPath = OKMRepository.getInstance().getNodePath(token, uuid);
context.getContextInstance().setVariable("document-path", folderPath);
Upload upload = new Upload();
upload.setName("data_upload1");
upload.setFolderPath(folderPath);
context.getContextInstance().setVariable("data_upload1", upload);
}
}
Code: Select all
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import com.openkm.bean.form.Upload;
public class SegundoUpload implements ActionHandler {
private static final long serialVersionUID = 1L;
@Override
public void execute(ExecutionContext context) throws Exception {
String documentUuid = ((Upload) context.getContextInstance().getVariable("upload1")).getDocumentUuid();
String folderPath = ((Upload) context.getContextInstance().getVariable("upload1")).getFolderPath();
Upload upload = new Upload();
upload.setName("data_upload2");
upload.setLabel("Subir archivo");
upload.setDocumentUuid(documentUuid);
upload.setFolderPath(folderPath);
upload.setType(Upload.TYPE_UPDATE);
context.getContextInstance().setVariable("data_upload2", upload);
}
}
Attachments
source code
(13.54 KiB) Downloaded 298 times
(13.54 KiB) Downloaded 298 times
Last edited by voragoth on Tue Aug 13, 2013 6:29 pm, edited 1 time in total.