コード例 #1
0
 public void testAddAttachment() {
   try {
     String sampleProcessId = "150001"; // replace this with a valid id
     IBPMContext ctx = Fixture.getIBPMContext("pino", "password1");
     IInstanceQueryService queryService = Fixture.getBPMServiceClient().getInstanceQueryService();
     IProcessInstance instance = queryService.getProcessInstance(ctx, sampleProcessId);
     IInstanceManagementService service =
         Fixture.getBPMServiceClient().getInstanceManagementService();
     IProcessComment comment = new ProcessComment();
     IIdentityType identity = new IdentityType();
     identity.setDisplayName(ctx.getUser());
     identity.setId(ctx.getUser());
     identity.setType("user");
     comment.setUpdatedBy(identity);
     comment.setComment("my programmatic comment5");
     comment.setUpdatedDate(Calendar.getInstance());
     service.addComment(ctx, instance, comment);
     // check if persisted
     IProcessInstance updatedInstance = queryService.getProcessInstance(ctx, sampleProcessId);
     List<IProcessComment> comments = updatedInstance.getUserComment();
     for (IProcessComment c : comments) {
       System.out.println(c.getComment()); // the new comment should appear
     }
   } catch (BPMServiceClientException bpmsce) {
     // TODO: Add catch code
     bpmsce.printStackTrace();
   } catch (BPMException bpme) {
     // TODO: Add catch code
     bpme.printStackTrace();
   } catch (Exception e) {
     // TODO: Add catch code
     e.printStackTrace();
   }
 }
コード例 #2
0
  public void testGetProcessInstance() {
    try {
      String sampleProcessId = "150001"; // replace this with a valid id
      IBPMContext ctx = Fixture.getIBPMContext("pino", "password1");
      IInstanceQueryService queryService = Fixture.getBPMServiceClient().getInstanceQueryService();
      System.out.println("retrieve sample instance");
      IProcessInstance instance = queryService.getProcessInstance(ctx, sampleProcessId);

      printProcessInstance(instance);

    } catch (Exception e) {
      // TODO: Add catch code
      e.printStackTrace();
    }
  }