Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.UserTask


    serviceTask.setId(conversion.getUniqueNumberedId(ConversionConstants.SERVICE_TASK_ID_PREFIX));
   
    addFlowElement(conversion, serviceTask, true);

    // Create the actual element
    UserTask userTask = (UserTask) conversion.getConversionFactory().getStepConverterFor(reviewTask)
        .convertStepDefinition(reviewTask, conversion);
    lastElement = userTask;
   

    M2Type userTaskType = model.getType(userTask.getFormKey());
   
    // Update parent, since we use an "outcome" for this task
    userTaskType.setParentName(AlfrescoConversionConstants.OUTCOME_BASE_FORM_TYPE);
   
    // Add script to the complete-task listener to update approval count (if needed)
    ScriptTaskListenerBuilder listenerBuilder = AlfrescoConversionUtil.getScriptTaskListenerBuilder(conversion, userTask.getId(), AlfrescoConversionConstants.TASK_LISTENER_EVENT_COMPLETE);
    String approverCount = getCountVariableName(id, namespacePrefix);
    listenerBuilder.addLine("if(task.getVariableLocal('" + getTransitionProperty(userTaskType, namespacePrefix) + "') == '" + AlfrescoConversionConstants.TRANSITION_APPROVE +"') {");
    listenerBuilder.addLine("execution.setVariable('" +approverCount + "', " + approverCount + " + 1);");
    listenerBuilder.addLine("}");
   
    if(stepDefinition.getAssignmentType() == HumanStepAssignmentType.USERS) {
      String assignmentVariableName = id + "Assignee";
     
      // Add the assignee-property to the content-model
      M2ClassAssociation reviewAssignee = new M2ClassAssociation();
      M2AssociationTarget target = new M2AssociationTarget();
      target.setClassName(AlfrescoConversionConstants.CONTENT_TYPE_PEOPLE);
      target.setMandatory(true);
      target.setMany(false);
     
      M2AssociationSource source = new M2AssociationSource();
      source.setMany(false);
      source.setMandatory(true);
     
      reviewAssignee.setName(AlfrescoConversionUtil.getQualifiedName(namespacePrefix, assignmentVariableName));
      reviewAssignee.setTarget(target);
      reviewAssignee.setSource(source);
     
      userTaskType.getAssociations().add(reviewAssignee);
      userTask.setAssignee(new PropertyReference(assignmentVariableName).getUsernameReferenceExpression(namespacePrefix));
     
      // Finally, add the multi-instance characteristics to the userTask
      MultiInstanceLoopCharacteristics mi = new MultiInstanceLoopCharacteristics();
      mi.setCompletionCondition(getCompletionCondition(id, namespacePrefix));
      mi.setElementVariable(new PropertyReference(assignmentVariableName).getVariableReference(namespacePrefix));
     
      PropertyReference reference = null;
      if(PropertyReference.isPropertyReference(stepDefinition.getAssignmentPropertyName())) {
        reference = PropertyReference.createReference(stepDefinition.getAssignmentPropertyName());
      } else {
        reference = new PropertyReference(stepDefinition.getAssignmentPropertyName());
      }
      mi.setInputDataItem(reference.getVariableReference(namespacePrefix));
      AlfrescoConversionUtil.getPropertyReferences(conversion).add(reference);
      mi.setSequential(false);
      userTask.setLoopCharacteristics(mi);
    }

    if (stepDefinition.getRejectionSteps() != null) {
      // Create choice-step
      ChoiceStepsDefinition choice = new ChoiceStepsDefinition();
View Full Code Here


  
    StartEvent startEvent = new StartEvent();
    startEvent.setId("start");
    process.addFlowElement(startEvent);
   
    UserTask userTask = new UserTask();
    userTask.setName("The Task");
    userTask.setId("theTask");
    userTask.setAssignee("kermit");
    process.addFlowElement(userTask);
   
    EndEvent endEvent = new EndEvent();
    endEvent.setId("theEnd");
    process.addFlowElement(endEvent);
View Full Code Here

  
    StartEvent startEvent = new StartEvent();
    startEvent.setId("start");
    process.addFlowElement(startEvent);
   
    UserTask userTask = new UserTask();
    userTask.setName("The First Task");
    userTask.setId("task1");
    userTask.setAssignee("kermit");
    process.addFlowElement(userTask);
   
    UserTask userTask2 = new UserTask();
    userTask2.setName("The Second Task");
    userTask2.setId("task2");
    userTask2.setAssignee("kermit");
    process.addFlowElement(userTask2);
   
    EndEvent endEvent = new EndEvent();
    endEvent.setId("theEnd");
    process.addFlowElement(endEvent);
View Full Code Here

   
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Namespace modelNamespace = model.getNamespaces().get(0);
   
    // Let superclass handle BPMN-specific conversion
    UserTask userTask = super.convertStepDefinition(stepDefinition, conversion);
   
    // Clear form-properties in the BPMN file, as we use custom form-mapping in Alfresco
    userTask.getFormProperties().clear();
   
    userTask.setName(humanStep.getName() != null ? humanStep.getName() : humanStep.getId());
   
    // Create the content model for the task
    M2Type type = new M2Type();
    model.getTypes().add(type);
    type.setName(AlfrescoConversionUtil.getQualifiedName(modelNamespace.getPrefix(),
        humanStep.getId()));
    type.setParentName(AlfrescoConversionConstants.DEFAULT_BASE_FORM_TYPE);
   
    // Update task-key on the task itself
    userTask.setFormKey(type.getName());
   
    // Create a form-config for the task
    Module shareModule = AlfrescoConversionUtil.getExtension(conversion).getModules().get(0);
    Configuration configuration = shareModule.addConfiguration(AlfrescoConversionConstants.EVALUATOR_TASK_TYPE
        , type.getName());
    Form formConfig = configuration.createForm();
   
    // Populate model and form based on FormDefinition
    formCreator.createForm(type, formConfig, humanStep.getForm(), conversion);
   
    // Set up property sharing using task-listeners
    addPropertySharing(humanStep, conversion, userTask);
   
    // Special handling for assignee that reference form-properties, before BPMN
    // is created
    if (humanStep.getAssignmentType() == HumanStepAssignmentType.USER) {
      String assignee = humanStep.getAssignment().getAssignee();

      if (assignee != null && PropertyReference.isPropertyReference(assignee)) {
        PropertyReference reference = PropertyReference.createReference(assignee);
        AlfrescoConversionUtil.getPropertyReferences(conversion).add(reference);
        userTask.setAssignee(reference.getUsernameReferenceExpression(modelNamespace.getPrefix()));
      }
    } else if (humanStep.getAssignmentType() == HumanStepAssignmentType.USERS) {
      if(humanStep.getAssignment().getCandidateUsers() != null) {
        userTask.setCandidateUsers(resolveUserPropertyReferences(humanStep.getAssignment().getCandidateUsers(), modelNamespace.getPrefix(), conversion));
      }
    } else if (humanStep.getAssignmentType() == HumanStepAssignmentType.GROUPS) {
      if(humanStep.getAssignment().getCandidateGroups() != null) {
        userTask.setCandidateGroups(resolveGroupPropertyReferences(humanStep.getAssignment().getCandidateGroups(), modelNamespace.getPrefix(), conversion));
      }
    }
   
    return userTask;
  }
View Full Code Here

    assertEquals("PT5M", timerDefinition.getTimeDuration());
   
    flowElement = model.getMainProcess().getFlowElement("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    UserTask task = (UserTask) flowElement;
    assertEquals("task doc", task.getDocumentation());
   
    flowElement = model.getMainProcess().getFlowElement("flow1Condition");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SequenceFlow);
    assertEquals("flow1Condition", flowElement.getId());
View Full Code Here

   
    flowElement = model.getMainProcess().getFlowElement("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);
   
    flowElement = model.getMainProcess().getFlowElement("subprocess1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess1", flowElement.getId());
View Full Code Here

    listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
    listener.setImplementation("${test}");
    listener.setEvent("end");
    startEvent.getExecutionListeners().add(listener);
    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

    assertNotNull(process);
   
    boolean listenerFound = false;
    for(FlowElement flowElement : process.getFlowElements()) {
      if(flowElement instanceof UserTask) {
          UserTask task = (UserTask) flowElement;
          assertNotNull(task.getTaskListeners());
          assertEquals(1L, task.getTaskListeners().size());
          assertEquals("create", task.getTaskListeners().get(0).getEvent());
          listenerFound = true;
      }
    }
    assertTrue(listenerFound);
  }
View Full Code Here

    assertNotNull(process);
   
    boolean listenerFound = false;
    for(FlowElement flowElement : process.getFlowElements()) {
      if(flowElement instanceof UserTask) {
          UserTask task = (UserTask) flowElement;
          assertNotNull(task.getTaskListeners());
          assertEquals(2L, task.getTaskListeners().size());
          assertEquals("create", task.getTaskListeners().get(0).getEvent());
          assertEquals("complete", task.getTaskListeners().get(1).getEvent());
          listenerFound = true;
      }
    }
    assertTrue(listenerFound);
  }
View Full Code Here

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

      UserTask userTask = (UserTask) bo;

      assigneeText.setText("");
      if (StringUtils.isNotEmpty(userTask.getAssignee())) {
        assigneeText.setText(userTask.getAssignee());
      }

      candidateUsersText.setText(getCandidatesString(userTask.getCandidateUsers()));
      candidateGroupsText.setText(getCandidatesString(userTask.getCandidateGroups()));

      formKeyText.setText("");
      if (formKeyText != null) {
        if (StringUtils.isNotEmpty(userTask.getFormKey())) {
          formKeyText.setText(userTask.getFormKey());
        }
      }

      dueDateText.setText("");
      if (StringUtils.isNotEmpty(userTask.getDueDate())) {
        dueDateText.setText(userTask.getDueDate().toString());
      }

      priorityText.setText("");
      if (userTask.getPriority() != null) {
        priorityText.setText(userTask.getPriority().toString());
      }

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

      assigneeText.addFocusListener(listener);
      candidateUsersText.addFocusListener(listener);
      candidateGroupsText.addFocusListener(listener);
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.