5 Replies Latest reply on Jan 12, 2016 2:11 AM by L P

    Started new processes cannot retriview as task

    L P Newbie

      Hi,

       

      I'm running a example process using jBPM 6.3 Final and it works well.

      However, if i change the actorId of the first task from "john" to "X",  i got an empty task list using below code.  I checked database, the actualOwner_id in table "Task" is blank, while "john" as actorId, actualOwner_id is "john".

       

      List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("X", "en-UK");

       

      I have implemented UserGroupCallback and embeded to RunEnvironment, and tested using below code. It returned True.

       

      System.out.println("Check User X:"+runEnv.getUserGroupCallback().existsUser("X"));


      However, i didn't see myUserGroupCallbackImpl getting called while i debug the process in either of occasions("john" and "X").


      RuntimeEngine engine =runTimeManager.getRuntimeEngine(null);

      KieSession ksession = engine.getKieSession();

      TaskService taskService = engine.getTaskService();

      ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");

      List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("X", "en-UK");

       

      Spring Config

       

      <bean id="jbpmEMF" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

        <property name="persistenceUnitName" value="org.jbpm.persistence.jpa"/>

        <property name="dataSource" ref="dataSource"/>

        <property name="packagesToScan"> 

         <array> 

         <value>org.jbpm.services.task.impl.model</value> 

         <value>org.jbpm.executor.entities</value> 

         <value>org.jbpm.services.task.audit.impl.model</value> 

         <value>org.drools.persistence.info</value> 

         <value>org.jbpm.persistence.processinstance</value> 

         <value>org.jbpm.persistence.correlation</value> 

         <value>org.jbpm.runtime.manager.impl.jpa</value> 

         <value>org.jbpm.process.audit</value> 

         <value>org.jbpm.services.task.identity</value>

         </array> 

           </property>

      <property name="jpaVendorAdapter"> 

         <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> 

        </property>

        <property name="jpaProperties"> 

         <props> 

         <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> 

         <prop key="hibernate.show_sql">true</prop> 

         <prop key="hibernate.connection.pool_size">300</prop> 

         <prop key="hibernate.order_inserts">true</prop> 

         <prop key="hibernate.order_updates">true</prop> 

         <prop key="hibernate.connection.autocommit">true</prop> 

         <prop key="hibernate.hbm2ddl.auto">update</prop> 

         <!-- Enable the second-level cache --> 

         <prop key="hibernate.cache.use_second_level_cache">false</prop> 

         <prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.BTMTransactionManagerLookup  

         </prop> 

         </props> 

        </property>

        <property name="mappingResources"> 

         <array> 

          <value>META-INF/Taskorm.xml</value>

          <value>META-INF/JBPMorm.xml</value> 

          <value>META-INF/Executor-orm.xml</value>  

          <value>META-INF/Servicesorm.xml</value>  

          <value>META-INF/TaskAuditorm.xml</value>  

         </array> 

           </property>

        </bean>

       

      <bean id="userGroupCallback" class="com.puck.JBPM.extension.JBPMUserGroupCallBack"></bean>

      <bean id="taskService" class="org.kie.spring.factorybeans.TaskServiceFactoryBean" destroy-method="close">

           <property name="entityManagerFactory" ref="jbpmEMF"/>

           <property name="transactionManager" ref="jbpmTxManager"/>

           <property name="listeners">

             <list>

             <bean class="org.jbpm.services.task.audit.JPATaskLifeCycleEventListener">

               <constructor-arg value="true"/>

             </bean>

             </list>

           </property>

      </bean>

      <bean id="btmConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices"></bean>

       

      <bean id="BitronixTransactionManager" factory-method="getTransactionManager"

             class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig" destroy-method="shutdown" />

        

      <bean id="jbpmTxManager" class="org.springframework.transaction.jta.JtaTransactionManager">

         <property name="transactionManager" ref="BitronixTransactionManager" />

         <property name="userTransaction" ref="BitronixTransactionManager" />

        </bean>

      <bean id="process" factory-method="newClassPathResource" class="org.kie.internal.io.ResourceFactory">

           <constructor-arg>

             <value>com/puck/JBPM/sample.bpmn</value>

           </constructor-arg>

        </bean>

      <bean id="runtimeEnvironment" class="org.kie.spring.factorybeans.RuntimeEnvironmentFactoryBean">

         <property name="type" value="DEFAULT"/>

         <property name="entityManagerFactory" ref="jbpmEMF"/>

         <property name="transactionManager" ref="jbpmTxManager"/>

        

         <property name="userGroupCallback" ref="userGroupCallback" />

         <property name="taskService" ref="taskService"/>    

         <property name="assets">

           <map>

             <entry key-ref="process"><util:constant static-field="org.kie.api.io.ResourceType.BPMN2"/></entry>

           </map>

         </property>

        

        </bean>

      <bean id="runtimeManager" class="org.kie.spring.factorybeans.RuntimeManagerFactoryBean" destroy-method="close">

         <property name="identifier" value="spring-rm"/>

         <property name="runtimeEnvironment" ref="runtimeEnvironment"/>

        </bean>

       

      Appreciate your advise