2 Replies Latest reply on Mar 16, 2010 6:18 AM by kmsk_1318

    How to differentiate State and Task

      Hi,

      I am new to JBPM. Iam using JBPM 4.3. I have read userguide and tried some of your test cases examples given.

      But still i have some doubts regarding Jbpm State and Task.

      1. Can a process definition contains both state and task.

       

      <process name="TaskAssignee" xmlns="http://jbpm.org/4.3/jpdl">

       

        <start>
          <transition to="review" />
        </start>

       

        <task name="review"
              assignee="#{order.owner}">
           <transition to="wait" />
        </task>
       
        <state name="wait for response">
          <transition name="accept" to="Submit Document"/>
          <transition name="reject" to="Try Again"/>
        </state>
       
        <state name="Submit Document"/>
        <state name="Try Again"/>

       

      </process>

       

       

      2. If so, how can i know that the current execution is in state or task so that

      i'll call their corresponding api's(ExecutionService's signalByExecution or TaskService's completeTask) to perform transition.

       

      Please guide me if anything is wrong here.

       

      Thanks & Regards

        • 1. Re: How to differentiate State and Task
          swiderski.maciej

          Hi,

           

          I am not sure that there is a public API for this or anything planned (perhaps you could browse jira) but it can be done by casting to internal types.

          Execution executionInA = processInstance.findActiveExecutionIn("review");
          String type = ((ExecutionImpl)executionInA).getActivity().getType();
          

          This returns the type coresponding to xml tag.

           

          It is not the best way (by using internal classes) but it can do what you need and perhaps such functionality is on its way if not, maybe create a new request for it would be good idea.

           

          HTH

          Maciej

          • 2. Re: How to differentiate State and Task

            Hi Maciej,

            Thanks a lot for your quick response and it works.

             

            Regards

            Karthikeyan