JBoss Community

Re: User Task Assignment and Assignment Restrictions

created by jemmerling in jBPM - View the full discussion

Here is a code snippet from the Human Task Example in jbpm-examples that accesses content via the API. Is this what you have in mind?

 

 



  BlockingGetTaskResponseHandler getTaskResponseHandler = new BlockingGetTaskResponseHandler();
  taskClient.getTask(task4.getId(), getTaskResponseHandler);
  Task task = getTaskResponseHandler.getTask();
  BlockingGetContentResponseHandler getContentResponseHandler = new BlockingGetContentResponseHandler();
  taskClient.getContent(task.getTaskData().getDocumentContentId(), getContentResponseHandler);
  Content content = getContentResponseHandler.getContent();
  ByteArrayInputStream bis = new ByteArrayInputStream(content.getContent());
  ObjectInputStream in;
  try {
    in = new ObjectInputStream(bis);
    Object result = in.readObject();
    in.close();
    Map<?, ?> map = (Map<?, ?>) result;
    for (Map.Entry<?, ?> entry: map.entrySet()) {
    System.out.println(entry.getKey() + " = " + entry.getValue());
    }
  } catch (IOException e) {
    e.printStackTrace();
  } catch (ClassNotFoundException e) {
    e.printStackTrace();
  }

Reply to this message by going to Community

Start a new discussion in jBPM at Community