-
1. Re: How to apply process variable to custom java class?
salaboy21 Sep 9, 2014 11:44 AM (in response to catherinesjy)1 of 1 people found this helpfulHi Catherine,
You should try to follow the example called customer-relationships located in the jbpm playground repository
droolsjbpm/jbpm-playground · GitHub
Open the process with the web process designer in the kie workbench and look at the mappings in the work items:
It is important for you to understand how the process variables are mapped to local variables in each task, so you can access to data inside the workitemhandler implementations.
Notice that what you are describing in your question is just the configuration for the editor inside the web designer but it is not the real mapping of the process variables to the task.
Once you understand the mappings you need to get the information inside the WorkItemHandler implementation (so you can interact with the Pipeline object).
Look at the WorkItemHandlers implementations to do something similar:
jbpm-playground/customer-relationships-workitems at master · droolsjbpm/jbpm-playground · GitHub
Hope this helps!
-
2. Re: How to apply process variable to custom java class?
catherinesjy Sep 9, 2014 12:12 PM (in response to salaboy21)Hi Mauricio,
Can the customer-relationships example be run in jbpm eclipse plugin? Since I am not familiar with Kie WorkBench right now. It will get longer to get start with Kie WorkBench.
Looking forward to your suggestion!
Best,
Catherine
-
3. Re: How to apply process variable to custom java class?
salaboy21 Sep 9, 2014 12:16 PM (in response to catherinesjy)I will suggest you to try the kie workbench, but feel free to try it out on the eclipse plugin.. it should work but the one that we are trying to keep up to date is the web process designer.
Regards
-
4. Re: How to apply process variable to custom java class?
catherinesjy Sep 9, 2014 2:14 PM (in response to salaboy21)Ok. I will try kie workbench. Thank you for your suggestion!
Best,
Catherine
-
5. Re: How to apply process variable to custom java class?
catherinesjy Sep 11, 2014 6:15 PM (in response to salaboy21)Mauricio Salatino wrote:
Hi Catherine,
You should try to follow the example called customer-relationships located in the jbpm playground repository
droolsjbpm/jbpm-playground · GitHub
Open the process with the web process designer in the kie workbench and look at the mappings in the work items:
It is important for you to understand how the process variables are mapped to local variables in each task, so you can access to data inside the workitemhandler implementations.
Notice that what you are describing in your question is just the configuration for the editor inside the web designer but it is not the real mapping of the process variables to the task.
Once you understand the mappings you need to get the information inside the WorkItemHandler implementation (so you can interact with the Pipeline object).
Look at the WorkItemHandlers implementations to do something similar:
jbpm-playground/customer-relationships-workitems at master · droolsjbpm/jbpm-playground · GitHub
Hope this helps!
Thank you so much for your help! Finally I solve my problem after reading all the materials you gave me!
To other person who is looking at this post, I have a little hint for them:
In order to avoid weird problem while using process variable, please use 'BPMN2 Diagram Editor' (new in jbpm6) to draw and set up the process instead of using 'BPMN2 Process Editor'.
Mauricio, thank you again! You helped me a lot.
Best,
Catherine
-
6. Re: How to apply process variable to custom java class?
backerst Oct 30, 2018 6:42 AM (in response to catherinesjy)Hi all!
I have the same problem. I have the project with jbpm work item handlers. There I define class ApprovalStage.
I downloaded jar file of project with jbpm work item handlers into artifact repository. Then I add dependency on it artifact from project with my business process. Also I add new row of Import (in BPMN-Diagram properties).
In process with help of one of work item handlers I get a list of objects of ApprovalStage type. Variable with this list have a type - "java.util.List". I logged count of this list elements. I see that list had 2 items. It is right.
Then I need call a loop by this list. There I use multiinnstance sub-process. Into I need call reusable sub-process. I send current item of a list in reusable sub-process.
And I get errors:
TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff0a000003:-6081d12c:5ba373b3:902b32, org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList@2bb96ea7 >: java.lang.IllegalArgumentException: IOException while storing process instance 11377: ru.perm.ics.zs.ApprovalStage
at org.jbpm.persistence.processinstance.ProcessInstanceInfo.transform(ProcessInstanceInfo.java:247)
at org.drools.persistence.TriggerUpdateTransactionSynchronization.beforeCompletion(TriggerUpdateTransactionSynchronization.java:57)
at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.beforeCompletion(JtaTransactionSynchronizationAdapter.java:54)
at org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList.beforeCompletion(JCAOrderedLastSynchronizationList.java:116)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:371)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1200)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:89)
at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:178)
at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:236)
at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:607)
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41)
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:82)
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41)
at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:73)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:397)
at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.execute(CommandBasedStatefulKnowledgeSession.java:520)
at org.jbpm.kie.services.impl.ProcessServiceImpl.execute(ProcessServiceImpl.java:488)
at org.jbpm.services.cdi.impl.ProcessServiceCDIImpl$Proxy$_$$_WeldClientProxy.execute(Unknown Source)
at org.kie.remote.services.cdi.ProcessRequestBean.doKieSessionOperation(ProcessRequestBean.java:298)
at org.kie.remote.services.cdi.ProcessRequestBean$Proxy$_$$_WeldClientProxy.doKieSessionOperation(Unknown Source)
at org.kie.remote.services.rest.RuntimeResourceImpl.startProcessInstance(RuntimeResourceImpl.java:437)
at org.kie.remote.services.rest.RuntimeResourceImpl.startProcessInstance(RuntimeResourceImpl.java:127)
at org.kie.remote.services.rest.RuntimeResourceImpl$Proxy$_$$_WeldClientProxy.startProcessInstance(Unknown Source)
at sun.reflect.GeneratedMethodAccessor254.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at org.kie.remote.services.rest.jaxb.DynamicJaxbContextFilter.doFilter(DynamicJaxbContextFilter.java:67)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.uberfire.ext.security.server.BasicAuthSecurityFilter.doFilter(BasicAuthSecurityFilter.java:70)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.uberfire.ext.security.server.SecureHeadersFilter.doFilter(SecureHeadersFilter.java:69)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.uberfire.ext.security.server.SecurityIntegrationFilter.doFilter(SecurityIntegrationFilter.java:57)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.NotSerializableException: ru.perm.ics.zs.ApprovalStage
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:762)
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 java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at java.util.ArrayList.writeObject(ArrayList.java:762)
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 java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
at org.drools.core.marshalling.impl.SerializablePlaceholderResolverStrategy$SerializablePlaceholderStrategyContext.write(SerializablePlaceholderResolverStrategy.java:97)
at org.drools.core.marshalling.impl.PersisterHelper.writeStrategiesIndex(PersisterHelper.java:248)
at org.drools.core.marshalling.impl.PersisterHelper.writeToStreamWithHeader(PersisterHelper.java:203)
at org.jbpm.persistence.processinstance.ProcessInstanceInfo.transform(ProcessInstanceInfo.java:241)
... 82 more
Could anybody please help me?
// jBPM 6.5.0
-
7. Re: How to apply process variable to custom java class?
pnairatl Oct 30, 2018 10:51 AM (in response to backerst)1 of 1 people found this helpfulThis is a NotSerializableException. Make 'ApprovalStage' class serializable.
-
8. Re: How to apply process variable to custom java class?
backerst Oct 31, 2018 5:13 AM (in response to pnairatl)Thank you very much! It helped me a lot.