Page 1 of 1

setTaskInstace error (workflow)

PostPosted:Fri Jan 13, 2017 2:57 am
by jimac
Good Day!

Forms code:
Code: Select all
<?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="sales_task">
    <input label="Enter Name of Document you uploaded:" name="soname" type="text" />
    <input label="Enter SO number:" name="sonum" type="text"/>
    <input label="Company :" name="company" type="text"/>
    <input label="Date :" name="dateso" type="date"/>
    <input label="Date of P.O :" name="dateposo" type="date"/>
    <select label ="Type" name="type" >
    	<option label = "Hardware" value="Hardware" />
    	<option label = "Software" value="Software" />
    </select>	
    <button label="Submit" name="Submit" transition ="next1" />
  </workflow-form>
 	
  <workflow-form task="pau_po">
    <upload label="Upload P.O : " name="podoc" folderUuid="86cdca58-766d-4ad3-9e16-16cbf6554735" />
    <input label="Enter P.O No. :" name="ponum" type="text" />
    <input label="Date :" name="datepo" type="date"/>
    <input label="To :" name="po_to" type="text" />
    <input label="Attention :" name="po_attn" type="text" />
    <input label="Terms :" name="po_terms" type="text" />
    <button label="Submit" name="Submit" transition ="next2" />
  </workflow-form>
  
  <workflow-form task="ken_dr">
    <upload label="Upload D.R : " name="dr_doc" folderUuid="86cdca58-766d-4ad3-9e16-16cbf6554735" />
    <input label="Enter D.R No. :" name="dr_num" type="text" />
    <input label="Enter S.O No. :" name="dr_sonum" type="text"/>
    <input label="Date :" name="date_dr" type="date"/>
    <input label="Account Manager :" name="dr_acc_manager" type="text" />
    <input label="Reference :" name="dr_reference" type="text"/>
    <button label="Submit" name="Submit" transition ="next3" />
  </workflow-form>
  
  <workflow-form task="eden_invoice_voucher">
    <upload label="Upload S.I : " name="si_doc" folderUuid="86cdca58-766d-4ad3-9e16-16cbf6554735" />
    <upload label="Upload Check Voucher : " name="si_cv_doc" folderUuid="86cdca58-766d-4ad3-9e16-16cbf6554735" />
    
    <separator name="Sales Invoice" label="Sales Invoice"/>
    <input label="Enter S.I No. :" name="si_num" type="text" />
    <input label="Enter S.O No. :" name="si_sonum" type="text" />
    <input label="Enter TIN No. :" name="si_tin" type="text" />
    <input label="Date :" name="date_si" type="date"/>
    <input label="Salesperson :" name="si_sp" type="text" />
   
    <separator name="Check Voucher" label="Check Voucher"/>	
    <input label="Enter CV No. :" name="si_cv_no" type="text" />
    <input label="Payee :" name="si_payee" type="text" />
    <input label="Date :" name="date_si_cv" type="date"/>
    <button label="Submit" name="Submit" transition ="next4" />
  </workflow-form>
</workflow-forms>
This is my code (after eden executed her task).
The part that an error pops out.
Code: Select all
package com.sample.action;

import java.util.HashMap;
import java.util.Map;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import com.openkm.bean.form.Input;
import com.openkm.bean.form.Upload;
import com.openkm.api.OKMDocument;
import com.openkm.api.OKMPropertyGroup;
import com.openkm.module.db.stuff.DbSessionManager;

 public class si_cv implements ActionHandler{

	private static final long serialVersionUID = 1L;

	@Override
	public void execute(ExecutionContext context) throws Exception {
		//String a ="-";
		String so ="S.O ";
	//	String bck="/";
		
		String systemToken = DbSessionManager.getInstance().getSystemToken();
		
		//****************************************INPUTS****************************************
		
		//input SO
		Input sonum = (Input) context.getContextInstance().getVariable("sonum");
		String inputted_sonum = sonum.getValue(); 
		
		//input S.I number
		Input si_num = (Input) context.getContextInstance().getVariable("si_num");
		String inputted_si_num = si_num.getValue(); 
		
		//input S.I , S.O number
	    Input si_sonum = (Input) context.getContextInstance().getVariable("si_sonum");
		String inputted_si_sonum = si_sonum.getValue(); 
		
		//input TIN number
	    Input si_tin = (Input) context.getContextInstance().getVariable("si_tin");
		String inputted_si_tin = si_tin.getValue(); 
		
		//input date_si
		Input date_si = (Input) context.getContextInstance().getVariable("date_si");
	    String inputted_date_si = date_si.getValue(); 
	    
	    //input S.I salesperson
	    Input si_sp = (Input) context.getContextInstance().getVariable("si_sp");
	    String inputted_si_sp = si_sp.getValue();   
	    
	   // ******************************************inputs for CV******************************************************
		//input CV number
	    Input si_cv_no = (Input) context.getContextInstance().getVariable("si_cv_no");
		String inputted_si_cv_no = si_cv_no.getValue(); 
		
		//input SI payee
		Input si_payee = (Input) context.getContextInstance().getVariable("si_payee");
	    String inputted_si_payee = si_payee.getValue(); 
	    
	    //input date SI_CV
	    Input date_si_cv = (Input) context.getContextInstance().getVariable("date_si_cv");
	    String inputted_date_si_cv = date_si_cv.getValue();   
	   
	    //************************************************UPLOADS********************************************************
		// /okm:root/S.O/S.O 000-999/
	   
	    // get Uuid of SI and CV doc.
		String documentUuid_si = ((Upload) context.getContextInstance().getVariable("si_doc")).getDocumentUuid();
		String documentUuid_cv = ((Upload) context.getContextInstance().getVariable("si_cv_doc")).getDocumentUuid();
	   
		//************************************************MOVE AND RENAME************************************************
		
		//move SI and CV document  
		OKMDocument.getInstance().move(systemToken,documentUuid_si,"/okm:root/S.O/"+so+inputted_sonum);
		OKMDocument.getInstance().move(systemToken,documentUuid_cv,"/okm:root/S.O/"+so+inputted_sonum);
		
		//rename Si and CV document
		OKMDocument.getInstance().rename(systemToken, documentUuid_si, "S.I "+inputted_si_num);
		OKMDocument.getInstance().rename(systemToken, documentUuid_cv, "CV No "+inputted_si_cv_no);
		
		//****************************************set the properties' value************************************************
	  
		// get path of SI and CV documents
	    String path_si = OKMDocument.getInstance().getPath(systemToken, documentUuid_si);
	    String path_cv = OKMDocument.getInstance().getPath(systemToken, documentUuid_cv);
		
		Map<String, String> properties = new HashMap<>();
		properties.put("okp:si.sino",inputted_si_num); 
		properties.put("okp:si.sono",inputted_si_sonum); 
		properties.put("okp:si.tin",inputted_si_tin); 
		properties.put("okp:si.date",inputted_date_si); 
		properties.put("okp:si.salesperson",inputted_si_sp); 
        
		// check voucher
		properties.put("okp:cv.cvno",inputted_si_cv_no); 
		properties.put("okp:cv.payee",inputted_si_payee); 
		properties.put("okp:cv.date",inputted_date_si_cv);  
		
//		 add property group 
		OKMPropertyGroup.getInstance().addGroup(systemToken, path_si, "okg:si");
		OKMPropertyGroup.getInstance().addGroup(systemToken, path_cv, "okg:cv");

//		add properties' value 
		OKMPropertyGroup.getInstance().setPropertiesSimple(systemToken, path_si, "okg:si", properties); 
		OKMPropertyGroup.getInstance().setPropertiesSimple(systemToken, path_cv, "okg:cv", properties); 
		//context.getToken().signal();
	}  
 }
Tomcat:
Code: Select all
com.openkm.core.WorkflowException: 
	at com.openkm.module.common.CommonWorkflowModule.setTaskInstanceValues(CommonWorkflowModule.java:716)
	at com.openkm.module.db.DbWorkflowModule.setTaskInstanceValues(DbWorkflowModule.java:689)
	at com.openkm.api.OKMWorkflow.setTaskInstanceValues(OKMWorkflow.java:277)
	at com.openkm.servlet.frontend.WorkflowServlet.setTaskInstanceValues(WorkflowServlet.java:273)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
	at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.jbpm.graph.def.DelegationException: 
	at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:388)
	at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:379)
	at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:301)
	at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:241)
	at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:213)
	at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:196)
	at org.jbpm.graph.def.Transition.take(Transition.java:152)
	at org.jbpm.graph.def.Node.leave(Node.java:479)
	at org.jbpm.graph.node.TaskNode.leave(TaskNode.java:213)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
	at org.jbpm.graph.def.Node_$$_javassist_58.leave(Node_$$_javassist_58.java)
	at org.jbpm.graph.exe.Token.signal(Token.java:223)
	at org.jbpm.graph.exe.Token.signal(Token.java:188)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
	at org.jbpm.graph.exe.Token_$$_javassist_91.signal(Token_$$_javassist_91.java)
	at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:495)
	at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:436)
	at com.openkm.module.common.CommonWorkflowModule.setTaskInstanceValues(CommonWorkflowModule.java:705)
	... 56 more
Caused by: com.openkm.core.PathNotFoundException: 
	at com.openkm.dao.NodeBaseDAO.calculatePathFromUuid(NodeBaseDAO.java:206)
	at com.openkm.dao.NodeBaseDAO.getPathFromUuid(NodeBaseDAO.java:115)
	at com.openkm.dao.NodeBaseDAO.calculatePathFromUuid(NodeBaseDAO.java:184)
	at com.openkm.dao.NodeBaseDAO.getPathFromUuid(NodeBaseDAO.java:108)
	at com.openkm.module.db.DbDocumentModule.move(DbDocumentModule.java:1220)
	at com.openkm.api.OKMDocument.move(OKMDocument.java:305)
	at com.sample.action.si_cv.execute(si_cv.java:74)
	at org.jbpm.graph.def.Action.execute(Action.java:129)
	at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:284)
	... 79 more

I encountered an error (please see the attached file) when I upload 2 files in 1 form .
But when I tried to only indicate 1 upload file (which is for sales invoice) the code works.
also, when I tried to only indicate 1 upload file (which is for check voucher) the code works.

I am wondering why an error pops out when 2 upload files are in 1 form.

Thanks!

Re: setTaskInstace error (workflow)

PostPosted:Sat Jan 14, 2017 8:40 pm
by jllort
I think we have not prepared the forms and UI integration for uploading more than one document into the same task. Correct me if I'm wrong but I think after uploading the document, the task goes to the next stage, no ?

Re: setTaskInstace error (workflow)

PostPosted:Mon Jan 16, 2017 2:36 am
by jimac
jllort wrote:I think we have not prepared the forms and UI integration for uploading more than one document into the same task. Correct me if I'm wrong but I think after uploading the document, the task goes to the next stage, no ?
No, it does not go to the next stage. :D
BTW, Thanks

Please reply in my post about the DUE DATE.
Thank you! :)

Re: setTaskInstace error (workflow)

PostPosted:Thu Jan 19, 2017 4:33 pm
by jllort
I was refering about the case of a single document into the form. In this case, after uploading the document the form goes to the next stage no ?