Package de.mhus.lib.bpm

Examples of de.mhus.lib.bpm.BpmInstance


      this.variables = variables;
    }

    @Override
    public void doit() throws Exception {
      BpmInstance instance = mBpm.getInstance(instanceId);
      if (instance == null) {
        log().t("timer",instanceId,"instance not found");
        return;
      }
      log().t("timer","execute",instanceId,activity,action,variables);
      instance.execute(activity, action,variables);
     
    }
View Full Code Here


    assertNotNull(bpm);
   
    BpmWorkflow testWorkflow = bpm.getWorkflow("test01");
    assertNotNull(testWorkflow);
   
    BpmInstance testInstance = testWorkflow.start(new AttributeMap("v01","value01"));
    assertNotNull(testInstance);
   
    //start
    System.out.println(testInstance.getCurrentActivities());
    System.out.println("v01=" + testInstance.getContext().getString("v01", null));
   
    testInstance.execute();
    System.out.println(testInstance.getCurrentActivities() + " " + testInstance.getStatus());
    System.out.println("v01=" + testInstance.getContext().getString("v01", null));

    assertEquals("value01", testInstance.getContext().getString("v01", null));

    testInstance.getCurrentActivities()[0].execute();
    // testInstance.execute("a");

    // testInstance.waitForActivity   
   
    System.out.println(testInstance.getCurrentActivities() + " " + testInstance.getStatus());
    System.out.println("v01=" + testInstance.getContext().getString("v01", null));
    assertEquals("AA", testInstance.getContext().getString("v01", null));
   
    // wait for scheduling
    BpmActivity activityC = testInstance.waitForActivity("c",-1);
   
    System.out.println("");
   
    System.out.println(testInstance.getCurrentActivities() + " " + testInstance.getStatus());
    System.out.println("v01=" + testInstance.getContext().getString("v01", null));

    // testInstance.execute("c");
    activityC.execute();
   
    System.out.println(testInstance.getCurrentActivities() + " " + testInstance.getStatus());
    System.out.println("v01=" + testInstance.getContext().getString("v01", null));

    testInstance.execute("d");
   
    System.out.println(testInstance.getCurrentActivities() + " " + testInstance.getStatus());
    System.out.println("v01=" + testInstance.getContext().getString("v01", null));
   
    try {
      testInstance.execute();
      System.out.println(testInstance.getCurrentActivities() + " " + testInstance.getStatus());
      fail();
    } catch (BpmException e) {
    }
   
    testInstance.destroy();
   
  }
View Full Code Here

  }


  @Override
  public void updateInstance(InstanceInfo info) throws Exception {
    BpmInstance instance = getInstance(info.getId());
    if (instance == null) throw new MException("instance not found", info.getId());
    if (!instance.getWorkflow().getName().equals(info.getWorkflowName()))
      throw new MException("wrong workflow",info.getId(),info.getWorkflowName(),instance.getWorkflow().getName());
    String[] activities = info.getActivities();
    if (activities.length == 1) {
      ((JBpmInstance)instance).setActivity(activities[0]);
    }
    //TODO remove other keys first
    for ( Entry<String, Object> x : info.getContext()) {
      instance.getContext().setProperty(x.getKey(), x.getValue());
    }
  }
View Full Code Here

TOP

Related Classes of de.mhus.lib.bpm.BpmInstance

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.