1 Reply Latest reply on Mar 21, 2013 4:32 AM by kklg

    what different ksession.getWorkItemManager().completeWorkItem  and TaskClient.complete?

    kklg Newbie

      hi !

       

       

      when i put variable in map(data), my variableinstancelog table is nothing,

       

          public void completeTask(long taskId, Map<?, ?> data, String userId, Map<String, Object> results )

                  throws InterruptedException {

              connect();

       

              BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();

              client.start(taskId, userId, responseHandler);

              responseHandler.waitTillDone(2000);

       

       

              responseHandler = new BlockingTaskOperationResponseHandler();

              ContentData contentData = null;

              if (data != null) {

                  ByteArrayOutputStream bos = new ByteArrayOutputStream();

                  ObjectOutputStream out;

                  try {

                      out = new ObjectOutputStream(bos);

                      out.writeObject(data);

                      out.close();

                      contentData = new ContentData();

                      contentData.setContent(bos.toByteArray());

                      contentData.setAccessType(AccessType.Inline);

                  } catch (IOException e) {

                      e.printStackTrace();

                  }

              }

       

       

              client.complete(taskId, userId, contentData, responseHandler);

       

             }

       

       

      but  i add this code  ,

       

      when i put variable in map(results) ,it work,

       

       

              BlockingGetTaskResponseHandler responseHandlerGetTask = new BlockingGetTaskResponseHandler();

              client.getTask(taskId, responseHandlerGetTask);

              responseHandlerGetTask.waitTillDone(1000);

              Task task = responseHandlerGetTask.getTask();

              ksession.getWorkItemManager().completeWorkItem(

                      task.getTaskData().getWorkItemId(), results);

       

       

      I I do not understand, I see other people are like  first code. I used jBPM5.4.  Thanks  For any help in adcance.

       

            what different ksession.getWorkItemManager().completeWorkItem  and TaskClient.complete?