Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Spring jBPM - Task Assignment

  1. #1
    Join Date
    Sep 2005
    Location
    Chicago
    Posts
    5

    Default 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. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    From: dev@springmodules.dev.java.net

    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
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  4. #4
    Join Date
    Sep 2005
    Location
    Chicago
    Posts
    5

    Default 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

  5. #5
    Join Date
    Sep 2005
    Location
    Chicago
    Posts
    5

    Default TaskAssginment Problem & 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?

  6. #6
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  7. #7
    Join Date
    Nov 2004
    Location
    Dallas, TX USA
    Posts
    24

    Default

    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.
    -steve

  8. #8
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Steve please create issues on SM JIRA and if possible attach your code as patches as well.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  9. #9
    Join Date
    Nov 2004
    Location
    Dallas, TX USA
    Posts
    24

    Default

    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
    -steve

  10. #10
    Join Date
    Sep 2005
    Location
    India
    Posts
    22

    Default

    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

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 5
    Last Post: Aug 9th, 2008, 05:30 AM
  3. jbpm setup through spring
    By gnic in forum Container
    Replies: 1
    Last Post: Sep 19th, 2005, 09:36 PM
  4. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •