Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.UserTask


  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElement("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("userTask1", flowElement.getId());
    UserTask userTask = (UserTask) flowElement;
   
    flowElement = model.getMainProcess().getFlowElement("catchsignal");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof IntermediateCatchEvent);
    assertEquals("catchsignal", flowElement.getId());
View Full Code Here


    if (pe != null) {
      Object bo = getBusinessObject(pe);
      if (bo == null || (bo instanceof UserTask == false))
        return;
     
      UserTask userTask = (UserTask) bo;
      List<ActivitiListener> taskListenerList = userTask.getTaskListeners();
     
      listenerEditor.pictogramElement = pe;
      listenerEditor.diagramEditor = getDiagramEditor();
      listenerEditor.diagram = getDiagram();
      listenerEditor.initialize(taskListenerList);
View Full Code Here

   
    flowElement = model.getMainProcess().getFlowElementMap().get("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("userTask1", flowElement.getId());
    UserTask userTask = (UserTask) flowElement;
    assertTrue(userTask.getCandidateUsers().size() == 1);
    assertTrue(userTask.getCandidateGroups().size() == 1);
    assertTrue(userTask.getFormProperties().size() == 2);
   
    flowElement = model.getMainProcess().getFlowElementMap().get("subprocess1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess1", flowElement.getId());
View Full Code Here

    assertEquals("innerBoundaryEvent", boundaryEvent.getId());
   
    FlowElement taskElement = innerSubProcess.getFlowElement("usertask");
    assertNotNull(taskElement);
    assertTrue(taskElement instanceof UserTask);
    UserTask userTask = (UserTask) taskElement;
    assertEquals("usertask", userTask.getId());
    eventList = userTask.getBoundaryEvents();
    assertEquals(1, eventList.size());
    boundaryEvent = eventList.get(0);
    assertEquals("taskBoundaryEvent", boundaryEvent.getId());
  }
View Full Code Here

  private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElementMap().get("usertask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("usertask", flowElement.getId());
    UserTask userTask = (UserTask) flowElement;
    assertEquals("usertask", userTask.getId());
    assertEquals("User task", userTask.getName());
    assertEquals("testKey", userTask.getFormKey());
    assertEquals(40l, userTask.getPriority().longValue());
    assertEquals("2012-11-01", userTask.getDueDate());
   
    assertEquals("kermit", userTask.getAssignee());
    assertEquals(2, userTask.getCandidateUsers().size());
    assertTrue(userTask.getCandidateUsers().contains("kermit"));
    assertTrue(userTask.getCandidateUsers().contains("fozzie"));
    assertEquals(2, userTask.getCandidateGroups().size());
    assertTrue(userTask.getCandidateGroups().contains("management"));
    assertTrue(userTask.getCandidateGroups().contains("sales"));
   
    List<FormProperty> formProperties = userTask.getFormProperties();
    assertEquals(2, formProperties.size());
    FormProperty formProperty = formProperties.get(0);
    assertEquals("formId", formProperty.getId());
    assertEquals("formName", formProperty.getName());
    assertEquals("string", formProperty.getType());
    assertEquals("variable", formProperty.getVariable());
    assertEquals("${expression}", formProperty.getExpression());
    formProperty = formProperties.get(1);
    assertEquals("formId2", formProperty.getId());
    assertEquals("anotherName", formProperty.getName());
    assertEquals("long", formProperty.getType());
    assertTrue(StringUtils.isEmpty(formProperty.getVariable()));
    assertTrue(StringUtils.isEmpty(formProperty.getExpression()));
   
    List<ActivitiListener> listeners = userTask.getTaskListeners();
    assertEquals(3, listeners.size());
    ActivitiListener listener = (ActivitiListener) listeners.get(0);
    assertTrue(ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType()));
    assertEquals("org.test.TestClass", listener.getImplementation());
    assertEquals("create", listener.getEvent());
View Full Code Here

    BpmnModel bpmnModel = new BpmnModel();
    Process process = bpmnModel.getMainProcess();
    StartEvent startEvent = new StartEvent();
    startEvent.setId("startEvent1");
    process.addFlowElement(startEvent);
    UserTask task = new UserTask();
    task.setId("reviewTask");
    task.setAssignee("kermit");
    process.addFlowElement(task);
    SequenceFlow flow1 = new SequenceFlow();
    flow1.setId("flow1");
    flow1.setSourceRef("startEvent1");
    flow1.setTargetRef("reviewTask");
View Full Code Here

      Object bo = getBusinessObject(pe);
      if (bo == null)
        return;

      expressionText.setText("");
      UserTask userTask = (UserTask) bo;
      int performerIndex = 0;
      if (userTask.getCandidateUsers() != null && userTask.getCandidateUsers().size() > 0) {
        performerIndex = performerTypes.indexOf("Candidate users");
        StringBuffer expressionBuffer = new StringBuffer();
        for (String user : userTask.getCandidateUsers()) {
          if (expressionBuffer.length() > 0) {
            expressionBuffer.append(";");
          }
          expressionBuffer.append(user);
        }
        currentType = "Candidate users";
        expressionText.setText(expressionBuffer.toString());
      } else if (userTask.getCandidateGroups() != null && userTask.getCandidateGroups().size() > 0) {
        performerIndex = performerTypes.indexOf("Candidate groups");
        StringBuffer expressionBuffer = new StringBuffer();
        for (String group : userTask.getCandidateGroups()) {
          if (expressionBuffer.length() > 0) {
            expressionBuffer.append(";");
          }
          expressionBuffer.append(group);
        }
        currentType = "Candidate groups";
        expressionText.setText(expressionBuffer.toString());
      } else {
        performerIndex = performerTypes.indexOf("Assignee");
        if (userTask.getAssignee() != null && userTask.getAssignee().length() > 0) {
          currentType = "Assignee";
          expressionText.setText(userTask.getAssignee());
        }
      }
      if(userTask.getFormKey() != null && userTask.getFormKey().length() > 0) {
        int formIndex = formTypeCombo.indexOf(userTask.getFormKey());
        if(formIndex >= 0) {
          formTypeCombo.select(formIndex);
        }
      }
     
      priorityText.setText("");
      if(userTask.getPriority() != null) {
        priorityText.setText(userTask.getPriority().toString());
      }

      documentationText.setText("");
      if (StringUtils.isNotEmpty(userTask.getDocumentation())) {
        documentationText.setText(userTask.getDocumentation());
      }

      performerTypeCombo.select(performerIndex == -1 ? 0 : performerIndex);
      performerTypeCombo.addFocusListener(listener);
      expressionText.addFocusListener(listener);
View Full Code Here

    return ELEMENT_TASK_USER;
  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr) throws Exception {
    UserTask userTask = new UserTask();
    userTask.setDueDate(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_DUEDATE));
    userTask.setFormKey(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_FORM_FORMKEY));
    userTask.setAssignee(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_ASSIGNEE));
   
    if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CANDIDATEUSERS))) {
      String expression = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CANDIDATEUSERS);
      userTask.getCandidateUsers().addAll(parseDelimitedList(expression));
    }
   
    if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CANDIDATEGROUPS))) {
      String expression = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CANDIDATEGROUPS);
      userTask.getCandidateGroups().addAll(parseDelimitedList(expression));
    }

    if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_PRIORITY))) {
      Integer priorityValue = null;
      try {
        priorityValue = Integer.valueOf(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_PRIORITY));
      } catch (Exception e) {
      }
      userTask.setPriority(priorityValue);
    }
   
    parseChildElements(getXMLElementName(), userTask, xtr);
   
    return userTask;
View Full Code Here

    return userTask;
  }

  @Override
  protected void writeAdditionalAttributes(BaseElement element, XMLStreamWriter xtw) throws Exception {
    UserTask userTask = (UserTask) element;
    writeQualifiedAttribute(ATTRIBUTE_TASK_USER_ASSIGNEE, userTask.getAssignee(), xtw);
    writeQualifiedAttribute(ATTRIBUTE_TASK_USER_CANDIDATEUSERS, convertToDelimitedString(userTask.getCandidateUsers()), xtw);
    writeQualifiedAttribute(ATTRIBUTE_TASK_USER_CANDIDATEGROUPS, convertToDelimitedString(userTask.getCandidateGroups()), xtw);
    writeQualifiedAttribute(ATTRIBUTE_TASK_USER_DUEDATE, userTask.getDueDate(), xtw);
    writeQualifiedAttribute(ATTRIBUTE_FORM_FORMKEY, userTask.getFormKey(), xtw);
    if (userTask.getPriority() != null) {
      writeQualifiedAttribute(ATTRIBUTE_TASK_USER_PRIORITY, userTask.getPriority().toString(), xtw);
    }
  }
View Full Code Here

   * @param original
   *          the object to clone
   * @return a clone of the original object
   */
  private static final UserTask clone(final UserTask original, final Diagram diagram) {
    UserTask result = new UserTask();

    result.setId(ActivitiUiUtil.getNextId(result.getClass(), CreateUserTaskFeature.FEATURE_ID_KEY, diagram));
    result.setAssignee(original.getAssignee());
    result.setFormKey(original.getFormKey());
    result.setDueDate(original.getDueDate());
    result.setPriority(original.getPriority());

    return result;
  }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.UserTask

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.