Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Spring jBPM - Task Assignment Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring jBPM - Task Assignment

    Has anyone gotten task assignment to work with spring-jbpm? When I call my task assignment handler a record shows up in the database. However the only data it has is the id and name. There's nothing for actor id or create date. When I don't use spring jBPM these get populated with my same assignment handler. If anyone can point out what I'm doing wrong, I'd appreciate it.

    Here's my handler:

    public class TestTaskAssignmentHandler implements AssignmentHandler {

    private static final long serialVersionUID = 1L;

    public void assign(Assignable assignable, ExecutionContext executionContext)
    {
    assignable.setActorId("test");
    }

    }

    And here's my process:

    <?xml version="1.0" encoding="UTF-8"?>

    <process-definition
    xmlns="http://jbpm.org/3/jpdl"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
    name="test task">
    <start-state name="start">
    <transition name="begin" to="task"></transition>
    </start-state>
    <task-node name="task">
    <task name="test">
    <assignment
    class="com.receller.bpm.TestTaskAssignmentHandler" />
    </task>
    <transition name="task" to="end"/>
    </task-node>
    <end-state name="end"></end-state>
    </process-definition>

  • #2
    AFAIK, rob has done an update to jBPM to spring modules about 2 days ago. Have you got the latest version? maybe it will help you with this problem.

    Comment


    • #3
      From: [email protected]

      The code for the JBPM integration is now in the main Spring CVS in
      spring-projects/spring-jbpm. You should be able to configure the standard OSIV
      filter in Spring and then use the supplier JBPM classes you have JBPM use the
      Spring-supplied session.

      Be aware that this code is uber-early access and is basically a dump of my
      current prototype. I am on vacation next week for two weeks and full development
      will start on this again when I return.

      Rob

      Comment


      • #4
        Getting Spring Context with jBPM

        Thanks for letting me know about the new release. I'll take a look.

        On a related note, I would like to access my Spring beans from within my jBPM AssignmentHandler and custom Actions. I'm trying to figure out how I can get a handle to Spring's ApplicationContext. My first guess is that I can somehow get this through jBPM's ExecutionContext, but I'm not sure how. Maybe the new release documents this too, but I thought I'd throw it out there in case someone else has figure this out.

        Matt

        Comment


        • #5
          TaskAssginment Problem &amp; Passing ApplicationContext

          1. After getting the latest code from CVS, I still have the same problem as before with not all the data getting populated in the jbpm_taskinstance table when my AssignmentHandler is called through spring-jbpm.

          2. Figured out how to pass around the spring ApplicationContext. It always helps to read the docs . For those that are interested, you just need to pass it into the ContextInstance setTransientVariable method. I created my own version of signal() that looks like this:

          public void signal(long processId, ApplicationContext ctx)
          {
          JbpmSession jbpmSession = sessionFactory.openJbpmSession();
          jbpmSession.beginTransaction();

          ProcessInstance process = jbpmSession.getGraphSession()
          .loadProcessInstance(processId);
          ContextInstance context = process.getContextInstance();
          context.setTransientVariable("springCtx", ctx);
          jbpmSession.getGraphSession().saveProcessInstance( process);
          process.signal();
          jbpmSession.getGraphSession().saveProcessInstance( process);
          jbpmSession.commitTransaction();
          jbpmSession.close();
          }

          I can then retrieve this from the EnvironmentContext in any of my custom jbpm handlers or actions.

          The signal method seemed to make the most sense, at least so far for me. I would think this would be a common situation for users of Spring and jBPM. Are there any plans to put something like this into spring-jbpm?

          Comment


          • #6
            AFAIK Rob who's the maintainer, is on vacation. However you are free to submit code to the project or at least raise an issue on jira to make sure this topic is not forgotten.

            Comment


            • #7
              Costin,

              I've been using spring-jbpm since Sep 15th and I haven't seen any new code checked in since then. I have a few suggestions for the current code. One suggestion is regarding access to the ApplicationContext inside of an AssignmentHandler or ActionHander.
              I would like to access my Spring beans from within my jBPM AssignmentHandler and custom Actions
              I came up with a proxy technique that gets you around this. And, yes I'd be glad to help with anything.

              Comment


              • #8
                Steve please create issues on SM JIRA and if possible attach your code as patches as well.

                Comment


                • #9
                  On the topic of ApplicationContext, Matt already created a feature request, it's just in the wrong place.
                  http://opensource2.atlassian.com/pro...rowse/SPR-1320

                  I posted a bug regarding jBPM DB Transaction Management.
                  http://opensource2.atlassian.com/pro.../browse/MOD-52

                  Comment


                  • #10
                    Matt,
                    I would like to know more about "signal" method implementation you suggested.
                    First, To call this "signal" method of bean "A" I need to invoke "getBean("A")" explicitly.
                    This call should be placed in the "Task Handler"? Or where?

                    Second, in the method itself you referred application context and process ID as arguments . What is this processId?

                    The name of the method has to be "signal"? Is it connected to ProcessInstance.signal()?

                    It would be helpful if you explained this with an example.

                    Thanks,
                    Anagha

                    Comment


                    • #11
                      Steve, see this thread (in case you have missed my 'spam'). I've addressed both issues.

                      Comment

                      Working...
                      X