Package org.activiti.engine.impl.task

Examples of org.activiti.engine.impl.task.TaskDefinition


        }

        UserTask userTask = (UserTask) baseElement;
        logger.info("bpmnParse : {}, userTask : {}", bpmnParse, userTask);

        TaskDefinition taskDefinition = (TaskDefinition) bpmnParse
                .getCurrentActivity().getProperty(
                        UserTaskParseHandler.PROPERTY_TASK_DEFINITION);

        this.configEvent(taskDefinition, bpmnParse,
                TaskListener.EVENTNAME_CREATE);
View Full Code Here


                logger.info("first activity is not userTask, just skip");
            } else {
                String taskDefinitionKey = targetActivity.getId();
                logger.debug("activityId : {}", targetActivity.getId());

                TaskDefinition taskDefinition = processDefinitionEntity
                        .getTaskDefinitions().get(taskDefinitionKey);

                Expression expression = taskDefinition.getAssigneeExpression();

                if (expression != null) {
                    String expressionText = expression.getExpressionText();
                    logger.debug("{}", expressionText);
                    logger.debug("{}", startActivity.getProperties());
                    logger.debug("{}", processDefinitionEntity.getProperties());

                    String initiatorVariableName = (String) processDefinitionEntity
                            .getProperty(BpmnParse.PROPERTYNAME_INITIATOR_VARIABLE_NAME);

                    if (("${" + initiatorVariableName + "}")
                            .equals(expressionText)) {
                        DefaultFormHandler formHandler = (DefaultFormHandler) taskDefinition
                                .getTaskFormHandler();

                        if (formHandler.getFormKey() != null) {
                            String formKey = formHandler.getFormKey()
                                    .getExpressionText();
View Full Code Here

        }

        UserTask userTask = (UserTask) baseElement;
        logger.info("bpmnParse : {}, userTask : {}", bpmnParse, userTask);

        TaskDefinition taskDefinition = (TaskDefinition) bpmnParse
                .getCurrentActivity().getProperty(
                        UserTaskParseHandler.PROPERTY_TASK_DEFINITION);

        ActivitiListener activitiListener = new ActivitiListener();
        activitiListener.setEvent(TaskListener.EVENTNAME_ASSIGNMENT);
        activitiListener
                .setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
        activitiListener.setImplementation("#{delegateTaskListener}");
        taskDefinition
                .addTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, bpmnParse
                        .getListenerFactory()
                        .createDelegateExpressionTaskListener(activitiListener));

        // candidateuser 或者group 包含被代理人, 则添加代理人为candidateuser
        ActivitiListener delegateActivitiCandidateListener = new ActivitiListener();
        delegateActivitiCandidateListener
                .setEvent(TaskListener.EVENTNAME_CREATE);
        delegateActivitiCandidateListener
                .setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
        delegateActivitiCandidateListener
                .setImplementation("#{delegateTaskCreateListener}");
        taskDefinition.addTaskListener(
                TaskListener.EVENTNAME_CREATE,
                bpmnParse.getListenerFactory()
                        .createDelegateExpressionTaskListener(
                                delegateActivitiCandidateListener));
    }
View Full Code Here

    ActivityImpl activity = createActivityOnScope(userTaskElement, scope);
   
    activity.setAsync(isAsync(userTaskElement));
    activity.setExclusive(isExclusive(userTaskElement));
   
    TaskDefinition taskDefinition = parseTaskDefinition(userTaskElement, activity.getId(), (ProcessDefinitionEntity) scope.getProcessDefinition());

    UserTaskActivityBehavior userTaskActivity = new UserTaskActivityBehavior(expressionManager, taskDefinition);
    activity.setActivityBehavior(userTaskActivity);

    parseProperties(userTaskElement, activity);
View Full Code Here

    } else {
      taskFormHandler = new DefaultTaskFormHandler();
    }
    taskFormHandler.parseConfiguration(taskElement, deployment, processDefinition, this);

    TaskDefinition taskDefinition = new TaskDefinition(taskFormHandler);

    taskDefinition.setKey(taskDefinitionKey);
    processDefinition.getTaskDefinitions().put(taskDefinitionKey, taskDefinition);

    String name = taskElement.attribute("name");
    if (name != null) {
      taskDefinition.setNameExpression(expressionManager.createExpression(name));
    }

    String descriptionStr = parseDocumentation(taskElement);
    if (descriptionStr != null) {
      taskDefinition.setDescriptionExpression(expressionManager.createExpression(descriptionStr));
    }

    parseHumanPerformer(taskElement, taskDefinition);
    parsePotentialOwner(taskElement, taskDefinition);
View Full Code Here

    ActivityImpl activity = createActivityOnCurrentScope(bpmnParse, userTask, BpmnXMLConstants.ELEMENT_TASK_USER);
   
    activity.setAsync(userTask.isAsynchronous());
    activity.setExclusive(!userTask.isNotExclusive());
   
    TaskDefinition taskDefinition = parseTaskDefinition(bpmnParse, userTask, userTask.getId(), (ProcessDefinitionEntity) bpmnParse.getCurrentScope().getProcessDefinition());
    activity.setProperty(PROPERTY_TASK_DEFINITION, taskDefinition);
    activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createUserTaskActivityBehavior(userTask, taskDefinition));
  }
View Full Code Here

 
  public TaskDefinition parseTaskDefinition(BpmnParse bpmnParse, UserTask userTask, String taskDefinitionKey, ProcessDefinitionEntity processDefinition) {
    TaskFormHandler taskFormHandler = new DefaultTaskFormHandler();
    taskFormHandler.parseConfiguration(userTask.getFormProperties(), userTask.getFormKey(), bpmnParse.getDeployment(), processDefinition);

    TaskDefinition taskDefinition = new TaskDefinition(taskFormHandler);

    taskDefinition.setKey(taskDefinitionKey);
    processDefinition.getTaskDefinitions().put(taskDefinitionKey, taskDefinition);
    ExpressionManager expressionManager = bpmnParse.getExpressionManager();

    if (StringUtils.isNotEmpty(userTask.getName())) {
      taskDefinition.setNameExpression(expressionManager.createExpression(userTask.getName()));
    }

    if (StringUtils.isNotEmpty(userTask.getDocumentation())) {
      taskDefinition.setDescriptionExpression(expressionManager.createExpression(userTask.getDocumentation()));
    }

    if (StringUtils.isNotEmpty(userTask.getAssignee())) {
      taskDefinition.setAssigneeExpression(expressionManager.createExpression(userTask.getAssignee()));
    }
    if (StringUtils.isNotEmpty(userTask.getOwner())) {
      taskDefinition.setOwnerExpression(expressionManager.createExpression(userTask.getOwner()));
    }
    for (String candidateUser : userTask.getCandidateUsers()) {
      taskDefinition.addCandidateUserIdExpression(expressionManager.createExpression(candidateUser));
    }
    for (String candidateGroup : userTask.getCandidateGroups()) {
      taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(candidateGroup));
    }
   
    // Activiti custom extension
   
    // Task listeners
    for (ActivitiListener taskListener : userTask.getTaskListeners()) {
      taskDefinition.addTaskListener(taskListener.getEvent(), createTaskListener(bpmnParse, taskListener, userTask.getId()));
    }

    // Due date
    if (StringUtils.isNotEmpty(userTask.getDueDate())) {
      taskDefinition.setDueDateExpression(expressionManager.createExpression(userTask.getDueDate()));
    }
   
    // Category
    if (StringUtils.isNotEmpty(userTask.getCategory())) {
      taskDefinition.setCategoryExpression(expressionManager.createExpression(userTask.getCategory()));
    }
   
    // Priority
    if (StringUtils.isNotEmpty(userTask.getPriority())) {
      taskDefinition.setPriorityExpression(expressionManager.createExpression(userTask.getPriority()));
    }
   
    if (StringUtils.isNotEmpty(userTask.getFormKey())) {
      taskDefinition.setFormKeyExpression(expressionManager.createExpression(userTask.getFormKey()));
    }

    // CustomUserIdentityLinks
    for (String customUserIdentityLinkType : userTask.getCustomUserIdentityLinks().keySet()) {
      Set<Expression> userIdentityLinkExpression = new HashSet<Expression>();
      for (String userIdentityLink : userTask.getCustomUserIdentityLinks().get(customUserIdentityLinkType)) {
        userIdentityLinkExpression.add(expressionManager.createExpression(userIdentityLink));
      }
      taskDefinition.addCustomUserIdentityLinkExpression(customUserIdentityLinkType, userIdentityLinkExpression);
      }
   
    // CustomGroupIdentityLinks
    for (String customGroupIdentityLinkType : userTask.getCustomGroupIdentityLinks().keySet()) {
      Set<Expression> groupIdentityLinkExpression = new HashSet<Expression>();
      for (String groupIdentityLink : userTask.getCustomGroupIdentityLinks().get(customGroupIdentityLinkType)) {
        groupIdentityLinkExpression.add(expressionManager.createExpression(groupIdentityLink));
      }
      taskDefinition.addCustomGroupIdentityLinkExpression(customGroupIdentityLinkType, groupIdentityLinkExpression);
      }

    return taskDefinition;
  }
View Full Code Here

    DefaultFormHandler formHandler;
    if (taskDefinitionKey == null) {
      // TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
      formHandler = (DefaultFormHandler) processDefinition.getStartFormHandler();
    } else {
      TaskDefinition taskDefinition = processDefinition.getTaskDefinitions().get(taskDefinitionKey);
      // TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
      formHandler = (DefaultFormHandler) taskDefinition.getTaskFormHandler();
    }
    String formKey = null;
    if (formHandler.getFormKey() != null) {
      formKey = formHandler.getFormKey().getExpressionText();
    }
View Full Code Here

  protected Class< ? extends BaseElement> getHandledType() {
    return UserTask.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, UserTask element) {
    TaskDefinition taskDefinition = (TaskDefinition) bpmnParse.getCurrentActivity().getProperty(UserTaskParseHandler.PROPERTY_TASK_DEFINITION);
    taskDefinition.addTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, USER_TASK_ASSIGNMENT_HANDLER);
    taskDefinition.addTaskListener(TaskListener.EVENTNAME_CREATE, USER_TASK_ID_HANDLER);
  }
View Full Code Here

  public void setFormKeyWithoutCascade(String formKey) {
    this.formKey = formKey;
  }

  public void fireEvent(String taskEventName) {
    TaskDefinition taskDefinition = getTaskDefinition();
    if (taskDefinition != null) {
      List<TaskListener> taskEventListeners = getTaskDefinition().getTaskListener(taskEventName);
      if (taskEventListeners != null) {
        for (TaskListener taskListener : taskEventListeners) {
          ExecutionEntity execution = getExecution();
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.task.TaskDefinition

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.