Package org.fireflow.engine

Examples of org.fireflow.engine.IWorkItem


     * Test of findWorkItemById method, of class PersistenceServiceHibernateImpl.
     */
    @Test
    public void testFindWorkItemById() {
        System.out.println("--------findWorkItemById--------");
        IWorkItem wi = persistenceService.findWorkItemById(workItemId);
        assertNotNull(wi);
    }
View Full Code Here


     * Test of findDeadWorkItemsWithoutJoinForTaskInstance method, of class PersistenceServiceHibernateImpl.
     */
    @Test
    public void testFindDeadWorkItemsWithoutJoinForTaskInstance() {
        System.out.println("--------findDeadWorkItemsWithoutJoinForTaskInstance--------");
        IWorkItem workItem1 = (IWorkItem) transactionTemplate.execute(new TransactionCallback() {

            public Object doInTransaction(TransactionStatus arg0) {
                WorkItem wi = new WorkItem();
                wi.setActorId(actorId);
                wi.setComments(comments);
View Full Code Here

    @Test
    public void testCancelAliveWorkItemsForTaskInstance() {
        System.out.println("--------cancelAliveWorkItemsForTaskInstance--------");

        IWorkItem workItem1 = (IWorkItem) transactionTemplate.execute(new TransactionCallback() {

            public Object doInTransaction(TransactionStatus arg0) {
                WorkItem wi = new WorkItem();
                wi.setActorId(actorId);
                wi.setComments(comments);
                wi.setCreatedTime(createdTime);
                wi.setEndTime(endTime);
                wi.setClaimedTime(claimedTime);
                wi.setState(state);
                wi.setTaskInstance(taskInstance);

                persistenceService.saveOrUpdateWorkItem(wi);
                return wi;
            }
        });
        final String workItemIdTmp = workItem1.getId();

        transactionTemplate.execute(new TransactionCallbackWithoutResult() {

            @Override
            protected void doInTransactionWithoutResult(TransactionStatus arg0) {
//                persistenceService.abortTaskInstance(aliveTaskInstanceId, cancelComments);
            }
        });

        IWorkItem workItem2 = persistenceService.findWorkItemById(workItemIdTmp);
        assertEquals(new Integer(IWorkItem.CANCELED), workItem2.getState());
        assertEquals(cancelComments, workItem2.getComments());
    }
View Full Code Here

public class AssignToCurrentUserAndCompleteWorkItemHandler implements
    IAssignmentHandler {

    public static final String ACTOR_ID = "Fireflow JUnit Tester";
    public void assign(IAssignable asignable, String performerName) throws EngineException, KernelException {
        IWorkItem wi = asignable.assignToActor(ACTOR_ID);
        wi.claim();
        wi.complete();
    }
View Full Code Here

      TaskInstance taskInstance = (TaskInstance)asignable;
      IWorkflowSession workflowSession = ((IWorkflowSessionAware)taskInstance).getCurrentWorkflowSession();
     
      System.out.println("+++++++++++++Current Workflow Session is "+workflowSession.hashCode());
      System.out.println("+++++++++++ x in current workflow session is "+workflowSession.getAttribute("x"));
        IWorkItem wi = asignable.assignToActor(ACTOR_ID);
        wi.claim();
    }
View Full Code Here

   */
  @Override
  public void assign(IAssignable assignable, String performerName) throws EngineException,
      KernelException {

    IWorkItem wi = assignable.asignToActor(APPLICANT);//将TaskInstance分配给zhang ,并创WorkItem。

  }
View Full Code Here

   * @param performerName 该参数是流程定义文件中的Performer的name属性。name可以作为角色的名称,可以作为部门名称,或者业务系统约定的其他含义。
   */ 
  @Override
  public void assign(IAssignable assignable, String performerName) throws EngineException,
      KernelException {
    IWorkItem wi = assignable.asignToActor(DEPARTMENT_MANAGER);//将TaskInstance分配给manager_chen ,并创WorkItem。
  }
View Full Code Here

                    IWorkflowSession workflowSession = runtimeContext.getWorkflowSession();
                   
                    List myWorkItemsList = workflowSession.findMyTodoWorkItems(CurrentUserAssignmentHandler.APPLICANT);
                    System.out.println("我(zhang)的待办workitem列表如下:");
                    for (int i=0;myWorkItemsList!=null && i<myWorkItemsList.size();i++){
                      IWorkItem wi = (IWorkItem)myWorkItemsList.get(i);
                      System.out.println("序号:"+i+"; id="+wi.getId()+"; name="+wi.getTaskInstance().getDisplayName()+"; actorId="+wi.getActorId()+"; state="+wi.getState());
                    }
                   
                    //选择第一个workitem进行操作
                    if (myWorkItemsList!=null && myWorkItemsList.size()>0){
                      IWorkItem wi = (IWorkItem)myWorkItemsList.get(0);
                      //1、首先签收
                      wi.claim();
                     
                      //2、然后设置流程变量
                      //在实际业务中,申请人应该需要填写一个表单,在这个简单的测试中就省略了……
                      IProcessInstance processInstance =
                        ((TaskInstance)wi.getTaskInstance()).getAliveProcessInstance();
                      processInstance.setProcessInstanceVariable("applicant",
                          CurrentUserAssignmentHandler.APPLICANT);//申请人
                      processInstance.setProcessInstanceVariable("leaveDays",
                          LEAVE_DAYS);//请假天数
                     
                      //3、结束WorkItem
                      //结束workItem会触发流程实例向下一个环节流转,
                      wi.complete();
                    }
                  
                    return null;
                } catch (EngineException ex) {
                    Logger.getLogger(LeaveApplicationTester.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

                    IWorkflowSession workflowSession = runtimeContext.getWorkflowSession();
                   
                    List myWorkItemsList = workflowSession.findMyTodoWorkItems(RoleDepartmentBasedAssignmentHandler.DEPARTMENT_MANAGER);
                    System.out.println("我(manager_chen)的待办workitem列表如下:");
                    for (int i=0;myWorkItemsList!=null && i<myWorkItemsList.size();i++){
                      IWorkItem wi = (IWorkItem)myWorkItemsList.get(i);
                      System.out.println("序号:"+i+"; id="+wi.getId()+"; name="+wi.getTaskInstance().getDisplayName()+"; actorId="+wi.getActorId()+"; state="+wi.getState());
                    }
                   
                    //选择第一个workitem进行操作
                    if (myWorkItemsList!=null && myWorkItemsList.size()>0){
                      IWorkItem wi = (IWorkItem)myWorkItemsList.get(0);
                      //1、首先签收
                      wi.claim();
                     
                      //2、然后设置流程变量
                      //在实际业务中,审批人应该需要填写一个表单,在这个简单的测试中就省略了……
                      IProcessInstance processInstance =
                        ((TaskInstance)wi.getTaskInstance()).getAliveProcessInstance();
                      processInstance.setProcessInstanceVariable("approvalFlag",
                          APPROVAL_FLAG);//审批意见
                     
                      //3、结束WorkItem
                      //结束workItem会触发流程实例向下一个环节流转,
                      //由于下一个环节是ToolTask,流程引擎会自动调用其ApplicationHandler.
                      wi.complete();
                    }
                  
                    return null;
                } catch (EngineException ex) {
                    Logger.getLogger(LeaveApplicationTester.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

TOP

Related Classes of org.fireflow.engine.IWorkItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.