Re: [jboss-user] [jBPM] - Access to variable via EL ?
by Jaber C. Mourad
Jaber C. Mourad [http://community.jboss.org/people/newbeewan] replied to the discussion
"Access to variable via EL ?"
To view the discussion, visit: http://community.jboss.org/message/546401#546401
--------------------------------------------------------------
Hi,
My need seems to be pretty simple !
First :
I'have a task, owned by a user.
At the end of the task, I want to record the userid of the owner into a process variable using :
public class TaskAssigneeEventListener implements EventListener {
...
@Override
public void notify(EventListenerExecution execution) throws Exception {
TaskService taskService = processEngine.getTaskService();
Task task = taskService.createTaskQuery().processInstanceId(execution.getProcessInstance().getId()).uniqueResult();
if (task == null) {
logger.warn("No task found for ProcessInstance {}", execution.getProcessInstance().getId());
} else {
logger.trace("task name {} ; assignee ", task.getName(),task.getAssignee());
execution.createVariable("MyLastTaskAssignee", task.getAssignee());
}
}
}
Second : I want to retreive that value into an assignment handler to assign that task to that user :
public class MyAssignementHandler implements AssignmentHandler {
//Field I want to inject from my process
private String previousUserId;
@Override
public void assign(Assignable assignable, OpenExecution execution) throws Exception {
logger.trace("Value of previousUserId {} ", previousUserId);
if (previousUserId != null) {
assignable.setAssignee(previousUserId);
} else {
logger.warn("No assignee from the last task !!");
}
}
}
My tasks :
<task assignee="john" g="174,75,92,52" name="taskUser">
<on event="end">
<event-listener expr="#{taskAssigneeEventListener}">
</event-listener>
</on>
<transition name="to taskManager" to="taskManager" g="-126,-24" />
</task>
<task g="337,173,92,52" name="taskManager">
<assignment-handler expr="#{myAssignementHandler}">
<field name="previousUserId">
<object expr="#{variables['MyLastTaskAssignee'}"/>
</field>
</assignment-handler>
<transition name="to end1" to="end1" g="-65,-24" />
</task>
Is it better to understand my need ?
Regards
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/546401#546401]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months
[jBPM] - deleteDeploypment - get SQLGrammarException: could not initialize a collection
by Ming Peng
Ming Peng [http://community.jboss.org/people/tpzstamp] created the discussion
"deleteDeploypment - get SQLGrammarException: could not initialize a collection"
To view the discussion, visit: http://community.jboss.org/message/546398#546398
--------------------------------------------------------------
I wrote a simple test code to deploy/undeploye jpdl definition. There is no issue when deploying one, but I get SQLGrammarException when trying to delete the just deployed definition. Could anyone help with this issue? Thanks.
The error in the console is:
Hibernate: select top ? propertyim0_.KEY_ as KEY1_2_, propertyim0_.VERSION_ as VERSION2_2_, propertyim0_.VALUE_ as VALUE3_2_ from JBPM4_PROPERTY propertyim0_
Hibernate: select this_.KEY_ as KEY1_2_0_, this_.VERSION_ as VERSION2_2_0_, this_.VALUE_ as VALUE3_2_0_ from JBPM4_PROPERTY this_ where this_.KEY_=?
Hibernate: select this_.KEY_ as KEY1_2_0_, this_.VERSION_ as VERSION2_2_0_, this_.VALUE_ as VALUE3_2_0_ from JBPM4_PROPERTY this_ where this_.KEY_=?
Hibernate: select top ? jobimpl0_.DBID_ as DBID1_6_, jobimpl0_.DBVERSION_ as DBVERSION3_6_, jobimpl0_.DUEDATE_ as DUEDATE4_6_, jobimpl0_.STATE_ as STATE5_6_, jobimpl0_.ISEXCLUSIVE_ as ISEXCLUS6_6_, jobimpl0_.LOCKOWNER_ as LOCKOWNER7_6_, jobimpl0_.LOCKEXPTIME_ as LOCKEXPT8_6_, jobimpl0_.EXCEPTION_ as EXCEPTION9_6_, jobimpl0_.RETRIES_ as RETRIES10_6_, jobimpl0_.PROCESSINSTANCE_ as PROCESS11_6_, jobimpl0_.EXECUTION_ as EXECUTION12_6_, jobimpl0_.CFG_ as CFG13_6_, jobimpl0_.SIGNAL_ as SIGNAL14_6_, jobimpl0_.EVENT_ as EVENT15_6_, jobimpl0_.REPEAT_ as REPEAT16_6_, jobimpl0_.CLASS_ as CLASS2_6_ from JBPM4_JOB jobimpl0_ where (jobimpl0_.LOCKEXPTIME_ is null or jobimpl0_.LOCKEXPTIME_<=?) and (jobimpl0_.DUEDATE_ is null or jobimpl0_.DUEDATE_<=?) and jobimpl0_.RETRIES_>0 and jobimpl0_.STATE_<>'suspended' order by jobimpl0_.DUEDATE_ asc
Hibernate: select deployment1_.OBJNAME_ as col_0_0_, deployment1_.DEPLOYMENT_ as col_1_0_ from JBPM4_DEPLOYMENT deployment0_, JBPM4_DEPLOYPROP deployment1_, JBPM4_DEPLOYPROP deployment2_, JBPM4_DEPLOYPROP deployment3_ where deployment1_.KEY_='pdid' and deployment1_.DEPLOYMENT_=deployment0_.DBID_ and deployment2_.KEY_='pdkey' and deployment2_.OBJNAME_=deployment1_.OBJNAME_ and deployment2_.DEPLOYMENT_=deployment0_.DBID_ and deployment3_.KEY_='pdversion' and deployment3_.OBJNAME_=deployment1_.OBJNAME_ and deployment3_.DEPLOYMENT_=deployment0_.DBID_ and deployment1_.DEPLOYMENT_=1
Hibernate: select deployment0_.DBID_ as DBID1_0_0_, deployment0_.NAME_ as NAME2_0_0_, deployment0_.TIMESTAMP_ as TIMESTAMP3_0_0_, deployment0_.STATE_ as STATE4_0_0_ from JBPM4_DEPLOYMENT deployment0_ where deployment0_.DBID_=?
Hibernate: select resources0_.DEPLOYMENT_ as DEPLOYMENT4_1_, resources0_.DBID_ as DBID1_1_, resources0_.NAME_ as NAME5_1_, resources0_.DBID_ as DBID1_5_0_, resources0_.DBVERSION_ as DBVERSION2_5_0_, resources0_.BLOB_VALUE_ as BLOB3_5_0_ from JBPM4_LOB resources0_ where resources0_.DEPLOYMENT_=?
Jun 7, 2010 3:26:18 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: -5561, SQLState: 42561
Jun 7, 2010 3:26:18 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: incompatible data type in conversion
Hibernate: select top ? jobimpl0_.DBID_ as DBID1_6_, jobimpl0_.DBVERSION_ as DBVERSION3_6_, jobimpl0_.DUEDATE_ as DUEDATE4_6_, jobimpl0_.STATE_ as STATE5_6_, jobimpl0_.ISEXCLUSIVE_ as ISEXCLUS6_6_, jobimpl0_.LOCKOWNER_ as LOCKOWNER7_6_, jobimpl0_.LOCKEXPTIME_ as LOCKEXPT8_6_, jobimpl0_.EXCEPTION_ as EXCEPTION9_6_, jobimpl0_.RETRIES_ as RETRIES10_6_, jobimpl0_.PROCESSINSTANCE_ as PROCESS11_6_, jobimpl0_.EXECUTION_ as EXECUTION12_6_, jobimpl0_.CFG_ as CFG13_6_, jobimpl0_.SIGNAL_ as SIGNAL14_6_, jobimpl0_.EVENT_ as EVENT15_6_, jobimpl0_.REPEAT_ as REPEAT16_6_, jobimpl0_.CLASS_ as CLASS2_6_ from JBPM4_JOB jobimpl0_ where (jobimpl0_.LOCKOWNER_ is null) and jobimpl0_.RETRIES_>0 and jobimpl0_.STATE_<>'suspended' order by jobimpl0_.DUEDATE_ asc
Jun 7, 2010 3:26:18 PM org.hibernate.engine.loading.LoadContexts cleanup
WARNING: fail-safe cleanup (collections) : org.hibernate.engine.loading.CollectionLoadContext@11ee017<rs=org.hsqldb.jdbc.JDBCResultSet@790192>
Jun 7, 2010 3:26:18 PM org.hibernate.engine.loading.CollectionLoadContext cleanup
WARNING: On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [1] entries
=======org.hibernate.exception.SQLGrammarException: could not initialize a collection: [org.jbpm.pvm.internal.repository.DeploymentImpl.resources#1]
My Environment is
JBPM: 4.3
Spring: 2.5.6
HsqlDB: 1.9.0 (the hsql jdbc jar file, which is under jbpm/lib, is replaced by this one)
My Code:
public static void main(String[] args) {
try {
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml");
ProcessEngine processEngine = (ProcessEngine)appContext.getBean("processEngine");
RepositoryService repositoryService = processEngine.getRepositoryService();
ExecutionService executionService = processEngine.getExecutionService();
TaskService taskService = processEngine.getTaskService();
// String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("pd.jpdl.xml").deploy();
// System.out.println(deploymentId);
repositoryService.deleteDeployment("1");
}catch(Exception e){
System.out.println("======="+e);
}
}
My Spring:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="springHelper" />
<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
<bean id="sessionFactory">
<!-- <property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
-->
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>jbpm.repository.hbm.xml</value>
<value>jbpm.execution.hbm.xml</value>
<value>jbpm.history.hbm.xml</value>
<value>jbpm.task.hbm.xml</value>
<value>jbpm.identity.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager">
<property name="sessionFactory" ref="sessionFactory" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="dataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:hsql://localhost/jbpm" />
<property name="username" value="SA" />
<property name="password" value="" />
</bean>
</beans>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/546398#546398]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months
[jBPM] - question about jbpm4.3 example installation
by zhang june
zhang june [http://community.jboss.org/people/june20100606] created the discussion
"question about jbpm4.3 example installation"
To view the discussion, visit: http://community.jboss.org/message/546385#546385
--------------------------------------------------------------
Dear Members
I am totally new to JBPM. Following the user guide, I have finshed these steps:
1) I have downloaded JBPM4.3,apache-tomcat-6.0.20.zip,eclipse-jee-galileo-win32.zip,ant1.8.1.
2) I executed ant demo.setup.tomcat . All was OK.
3) install the GPD plugin in Eclipse. It took long time , no error.
4)Configuring the jBPM runtime and user library, adding jPDL 4 schema to the catalog,OK.
5)Importing the example project into eclipse.ok.
Now, questions came
error in file "examples\src\org\jbpm\examples\services\ServicesTest.java", "The type junit.framework.TestCase cannot be resolved. It is indirectly referenced from required .class files ", I found the class in eclipse\plugins\org.junit4_4.5.0.v20090824\junit.jar, added the jar in build path, this error was gone;
then other errors, I added eclipse\plugins\javax.mail_1.4.0.v200905040518.jar and eclipse\plugins\org.apache.commons.collections_3.2.0.v200803061811.jar in build path.
Now the error in file /examples/src/org/jbpm/examples/mail/inline/InlineMailTest.java "*The import org.subethamail cannot be resolved* ", I searched the class, not found jar file containing it.
Who has encountered this question?
Thanks a lot!!!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/546385#546385]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
15 years, 11 months