Package org.jbpm.task.service

Examples of org.jbpm.task.service.ContentData


    assignments.setBusinessAdministrators(businessAdministrators);
    task.setPeopleAssignments(assignments);
       
    task.setTaskData(taskData);

    ContentData content = null;
    Object contentObject = workItem.getParameter("Content");
    if (contentObject == null) {
      contentObject = workItem.getParameters();
    }
    if (contentObject != null) {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ObjectOutputStream out;
      try {
        out = new ObjectOutputStream(bos);
        out.writeObject(contentObject);
        out.close();
        content = new ContentData();
        content.setContent(bos.toByteArray());
        content.setAccessType(AccessType.Inline);
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
View Full Code Here


    assignments.setBusinessAdministrators(businessAdministrators);
    task.setPeopleAssignments(assignments);
       
    task.setTaskData(taskData);

    ContentData content = null;
    Object contentObject = workItem.getParameter("Content");
    if (contentObject != null) {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ObjectOutputStream out;
      try {
        out = new ObjectOutputStream(bos);
        out.writeObject(contentObject);
        out.close();
        content = new ContentData();
        content.setContent(bos.toByteArray());
        content.setAccessType(AccessType.Inline);
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
                // If the content is not set we will automatically copy all the input objects into
                // the task content
                else {
                    contentObject = workItem.getParameters();
                    ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ObjectOutputStream out;
      try {
        out = new ObjectOutputStream(bos);
        out.writeObject(contentObject);
        out.close();
        content = new ContentData();
        content.setContent(bos.toByteArray());
        content.setAccessType(AccessType.Inline);
                                content.setType("java.util.map");
      } catch (IOException e) {
        e.printStackTrace();
      }
                }
    client.addTask(task, content, null);
View Full Code Here

    operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    System.out.println("Started task " + task.getId());

    System.out.println("Completing task " + task.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    ContentData result = new ContentData();
    result.setAccessType(AccessType.Inline);
    result.setType("java.lang.String");
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bos);
    out.writeObject("This is the result");
    out.close();
    result.setContent(bos.toByteArray());
    getClient().complete(task.getId(), "Darth Vader", result, operationResponseHandler);
    operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    System.out.println("Completed task " + task.getId());

    assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME));
View Full Code Here

    operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    System.out.println("Started task " + task.getId());

    System.out.println("Completing task " + task.getId());
    operationResponseHandler = new BlockingTaskOperationResponseHandler();
    ContentData result = new ContentData();
    result.setAccessType(AccessType.Inline);
    result.setType("java.lang.String");
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bos);
    out.writeObject("This is the result");
    out.close();
    result.setContent(bos.toByteArray());
    getClient().complete(task.getId(), "Darth Vader", result, operationResponseHandler);
    operationResponseHandler.waitTillDone(DEFAULT_WAIT_TIME);
    System.out.println("Completed task " + task.getId());

    assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME));
View Full Code Here

    taskData.setStatus(Status.Created);
    taskData.setCreatedBy(new User("usr0"));
    taskData.setActualOwner(new User("usr0"));
    task.setTaskData(taskData);
   
    ContentData data = new ContentData();
    BlockingAddTaskResponseHandler addTaskHandler = new BlockingAddTaskResponseHandler();
    client.addTask(task, data, addTaskHandler);
   
    long taskId = addTaskHandler.getTaskId();

    client.disconnect();
   
    client.connect();
   
    assertTrue("taskId debe ser un valor mayor a cero", taskId > 0);
   
    Task task2 = new Task();
    List<I18NText> names2 = new ArrayList<I18NText>();
    I18NText text2 = new I18NText("en-UK", "tarea1");
    names2.add(text2);
    task2.setNames(names2);
    TaskData taskData2 = new TaskData();
    taskData2.setStatus(Status.Created);
    taskData2.setCreatedBy(new User("usr0"));
    taskData2.setActualOwner(new User("usr0"));
    task2.setTaskData(taskData2);
     
    ContentData data2 = new ContentData();
    BlockingAddTaskResponseHandler addTaskHandler2 = new BlockingAddTaskResponseHandler();
    client.addTask(task2, data2, addTaskHandler2);
   
    long taskId2 = addTaskHandler2.getTaskId();
   
View Full Code Here

    connect();
    BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();
    client.start(taskId, userId, responseHandler);
    responseHandler.waitTillDone(5000);
    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);
View Full Code Here

        String procedureId = (String) value.get("procedureId");

        Map<String, Object> info = new HashMap<String, Object>();
        info.put("emergency.vehicles", selectedVehicles);
        ContentData result = new ContentData();
        result.setAccessType(AccessType.Inline);
        result.setType("java.util.Map");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(bos);
        out.writeObject(info);
        out.close();
        result.setContent(bos.toByteArray());

        BlockingTaskOperationResponseHandler completeTaskOperationHandler = new BlockingTaskOperationResponseHandler();
        client.complete(garageTask.getId(), "garage_emergency_service", result, completeTaskOperationHandler);

    }
View Full Code Here

        assertNotNull(value);

        Map<String, Object> info = new HashMap<String, Object>();
        info.put("emergency.priority", 1);
        ContentData result = new ContentData();
        result.setAccessType(AccessType.Inline);
        result.setType("java.util.Map");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(bos);
        out.writeObject(info);
        out.close();
        result.setContent(bos.toByteArray());

        BlockingTaskOperationResponseHandler completeTaskOperationHandler = new BlockingTaskOperationResponseHandler();
        client.complete(doctorTask.getId(), "doctor", result, completeTaskOperationHandler);

    }
View Full Code Here

        Map<String, Object> info = new HashMap<String, Object>();
        info.put("emergency", emergency);


        ContentData result = new ContentData();
        result.setAccessType(AccessType.Inline);
        result.setType("java.util.Map");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(bos);
        out.writeObject(info);
        out.close();
        result.setContent(bos.toByteArray());

        BlockingTaskOperationResponseHandler completeTaskOperationHandler = new BlockingTaskOperationResponseHandler();
        client.complete(sums.get(0).getId(), "operator", result, completeTaskOperationHandler);

View Full Code Here

        selectedProcedures.addSelectedProcedureName("DefaultHeartAttackProcedure");
        info.put("selectedProcedures", selectedProcedures);


        ContentData result = new ContentData();
        result.setAccessType(AccessType.Inline);
        result.setType("java.util.Map");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(bos);
        out.writeObject(info);
        out.close();
        result.setContent(bos.toByteArray());

        BlockingTaskOperationResponseHandler completeTaskOperationHandler = new BlockingTaskOperationResponseHandler();
        client.complete(sums.get(0).getId(), "control", result, completeTaskOperationHandler);

View Full Code Here

TOP

Related Classes of org.jbpm.task.service.ContentData

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.