1 2 Previous Next 21 Replies Latest reply on Jun 1, 2006 1:50 PM by julian_k

    How to use pooledActors without Identity Component

    julian_k

      Hi all,

      I am tring to set a few actorIds/assignment expressions for a newly created task's pooledActors field, but when I save I get the following hibernate exception:

      org.hibernate.PropertyAccessException: could not get a field value by reflection getter of org.jbpm.taskmgmt.exe.PooledActor.id
      org.hibernate.PropertyAccessException: could not get a field value by reflection getter of org.jbpm.taskmgmt.exe.PooledActor.id
      

      I have not configured the identity component so the jBPM database doesn't have any data in the "jbpm_taskactorpool" or any other "identity" related tables. I am using jBPM 3.0. Do I need to set these tables up with data relating to users for this functionality?

      Thanks.

        • 1. Re: How to use pooledActors without Identity Component
          julian_k

          bump, thx

          • 2. Re: How to use pooledActors without Identity Component
            vsuarez

            We are using jBPM 3.1, and in this code try-catch-finally block is ignored:

            TaskMgmtSession tmSession = jbpmContext.getTaskMgmtSession();
            TaskInstance ti = tmSession.loadTaskInstance(taskId);
            
            ti.setPooledActors(actorIds); //String[] actorIds;
            ti.setActorId(null); //No unique actor
            
            jbpmContext.close(); //Hibernate update DB
            
            




            • 3. Re: How to use pooledActors without Identity Component
              julian_k

              I have code that does exactly what you have written above, however when closing the jBPMSession I get the above hibernate error.

              • 4. Re: How to use pooledActors without Identity Component
                julian_k

                ok, so I dug a little deeper and it appears that there is no way to do this without replicating the entire identity/demographic data in the jbpm database. So in order to achieve this functionality and only have one set of data to manage, I see only two ways:

                1. Drop the foreign key constraint that leads from the jbpm_pooledactor table to the jbpm_taskactorpool table.

                2. Create a new table very similar to the jbpm_taskactorpool without a constraint to the jbpm_pooledactor table. This could be linked via a custom TaskInstance class.

                In both the above scenarios a foreign key will exist to link the task instance to the task actor pool, and each actor in the pool table will be stored alongside that foreign key. The only difference will be the lack of constraints to the identity model of jBPM (e.g. the jbpm_pooledactor table as constraint fk_tskactpol_plact). I presume to have this functionality without adopting the "optional" jBPM identity model, such a change will be required in the jBPM code. I look forward to any feedback, esp if anyone has an arguement for redundantly storing the identity model. Thanks again.

                Thanks

                • 5. Re: How to use pooledActors without Identity Component
                  kukeltje

                   

                  ok, so I dug a little deeper and it appears that there is no way to do this without replicating the entire identity/demographic data in the jbpm database.


                  Not quite. It is not to difficult to implement your own identity provider. You just have to implement a few classes.

                  I look forward to any feedback, esp if anyone has an arguement for redundantly storing the identity model.


                  So here is the feedback. I (in the company I work for) also have implemented our own identity wrapper around some exisiting code we have. We hate duplication ;-)

                  Thanks


                  You're welcome

                  • 6. Re: How to use pooledActors without Identity Component
                    julian_k

                    Ronald, could you point me to the resources that need to be understood in order to achieve this? Adding an Identity wrapper to my classes will not override the hibernate mappings existing in jBPM. I imagine I can change these without violating the legal terms of use. The only issue to be aware of is that I have jBPM in a separate database from my users. Are these the actions you are reffering to?

                    Thanks once more.

                    • 7. Re: How to use pooledActors without Identity Component
                      kukeltje

                      I'm sure (don't disappoint me ;-) ) you've read 11.11 from the docs, more specifically 11.11.3 which adresses your question about the mappings

                      • 8. Re: How to use pooledActors without Identity Component
                        julian_k

                        Ok I re-read it and realize I should have been clearer about this before (sorry). I am unsure as how jBPM knows which ExpressionAssignmentHandler to use (aka mine versus jBPMs) when creating tasks without process instances. See

                        1) http://www.jboss.com/index.html?module=bb&op=viewtopic&t=68876
                        2) http://www.jboss.com/index.html?module=bb&op=viewtopic&t=68881

                        From what I gather the process of writing my own ExpressionHandler will only work when running within a process instance that invokes the custom AssignmentHandler vis-a-vis the XML declaration. So in order for me to achieve this in the above context, I would need to invoke a custom ExpressionAssignmentHandler upon creating a custom task in Java. Does this sound right?

                        Thanks,
                        Julian

                        • 9. Re: How to use pooledActors without Identity Component
                          kukeltje

                          independent process tasks using the API should be passed an actor, pooledactor etc. afaik, it is not using the assignmenthandler etc, since it is not part of a processdefinition. Just implement your own code for this.

                          The identitymodule is not configurable yet, imo it should be confiugurable as a service just like the others. (I'll file a jira issue for this)

                          I currently implemented this by changing the source of JpdlXmlReader to not use the defaultimplementations. This way we do not have to specifically add assignmenthandlers in each process.

                          • 10. Re: How to use pooledActors without Identity Component
                            julian_k

                            So we came to two options here for overriding the identity component:

                            1) Change the core identity component by extending various components (e.g. ExpressionAssignmentHandler and creating some wrappers for my Identity model).

                            2) Create a custom Task Instance class, override the pooledActor's methods to use my own custom pooledActors class, and then create a hibernate mapping for that.

                            I believe you are suggesting option number 2 at this point. As I delve more into defined processes and begin to have greater numbers of assignment expressions, option 1 will also have to be achieved for ease of programming. Are we on the same page here? If so, will overriding the pooledActors implemetation adversly affect defined processes that have swimlanes (due to foreign key fk_pooledactor_sli on jbpm_pooledactor)? btw, I hope this discussion is helping you as much it is me :)

                            Thanks,
                            Julian

                            p.s. configuring the identity module in one spot would be spectacular

                            • 11. In regards to the aforementioned option 2
                              julian_k

                              Ok, in regards to my above question about affecting swimlanes, it appears that it will disrupt the swimlane functionality as the swimlane classes are not themselves configurable. IOW, the swimlane class is directly linked to the pooledActor class...so I think I am SOL on option number two. So change option two from overriding pooledActors in TaskInstance to create a new field for a separate, custom, and new type of pooledActor. This will be a real shame b/c now I will have to forms of pooledActors :(

                              • 12. Re: How to use pooledActors without Identity Component
                                kukeltje

                                hmm.... I do not (in one go) exactely see what your intentions are since I do not have access to the code (atm) I'll respond later, but feel there should not be a need to override the PooledActor.... At least I've not missed anything without overriding it.

                                • 13. Re: How to use pooledActors without Identity Component
                                  koen.aers

                                  Consider the following assigment handler:

                                  public class MyCustomExpressionAssignmentHandler ... {
                                   String expression;
                                   ...
                                   public void assign(Assignable assignable, ExecutionContext ctx) {
                                   // you can probably reuse a lot of the stuff of
                                   // the real ExpressionAssignmentHandler to do
                                   // your work here...
                                   }
                                   ...
                                  }
                                  

                                  and the following task:
                                  <task ...>
                                   <assignment class='MyCustomExpressionAssignmentHandler'>
                                   <expression>expression-in-your-own-format-goes-here</expression>
                                   </assignmetn>
                                   ..
                                  </task>
                                  

                                  IMO this is the simplest solution to provide your own expression assignmenthandler that navigates your own identity module. Or do I miss something?

                                  Regards,
                                  Koen

                                  • 14. Re: How to use pooledActors without Identity Component
                                    julian_k

                                    Koen, you are correct, but this is not the use case I am speaking of. I am talking about tasks that are created dynamically via the Java API independently of a process definition/instance. Being the case, this makes it impossible (afaik) to use the assignmenthandler.

                                    1 2 Previous Next