Package org.activiti.engine.impl.el

Examples of org.activiti.engine.impl.el.ExpressionManager


    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


  protected List<FormPropertyHandler> formPropertyHandlers = new ArrayList<FormPropertyHandler>();
 
  public void parseConfiguration(List<org.activiti.bpmn.model.FormProperty> formProperties, String formKey, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition) {
    this.deploymentId = deployment.getId();
   
    ExpressionManager expressionManager = Context
        .getProcessEngineConfiguration()
        .getExpressionManager();
   
    if (StringUtils.isNotEmpty(formKey)) {
      this.formKey = expressionManager.createExpression(formKey);
    }
   
    FormTypes formTypes = Context
      .getProcessEngineConfiguration()
      .getFormTypes();
   
    for (org.activiti.bpmn.model.FormProperty formProperty : formProperties) {
      FormPropertyHandler formPropertyHandler = new FormPropertyHandler();
      formPropertyHandler.setId(formProperty.getId());
      formPropertyHandler.setName(formProperty.getName());
     
      AbstractFormType type = formTypes.parseFormPropertyType(formProperty);
      formPropertyHandler.setType(type);
      formPropertyHandler.setRequired(formProperty.isRequired());
      formPropertyHandler.setReadable(formProperty.isReadable());
      formPropertyHandler.setWritable(formProperty.isWriteable());
      formPropertyHandler.setVariableName(formProperty.getVariable());

      if (StringUtils.isNotEmpty(formProperty.getExpression())) {
        Expression expression = expressionManager.createExpression(formProperty.getExpression());
        formPropertyHandler.setVariableExpression(expression);
      }

      if (StringUtils.isNotEmpty(formProperty.getDefaultExpression())) {
        Expression defaultExpression = expressionManager.createExpression(formProperty.getDefaultExpression());
        formPropertyHandler.setDefaultExpression(defaultExpression);
      }

      formPropertyHandlers.add(formPropertyHandler);
    }
View Full Code Here

    }
  }

  protected void initExpressionManager() {
    if (expressionManager==null) {
      expressionManager = new ExpressionManager(beans);
    }
  }
View Full Code Here

  protected List<FormPropertyHandler> formPropertyHandlers = new ArrayList<FormPropertyHandler>();
 
  public void parseConfiguration(Element activityElement, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition, BpmnParse bpmnParse) {
    this.deploymentId = deployment.getId();
   
    ExpressionManager expressionManager = Context
        .getProcessEngineConfiguration()
        .getExpressionManager();
   
    String formKeyAttribute = activityElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "formKey");
   
    if (formKeyAttribute != null) {
      this.formKey = expressionManager.createExpression(formKeyAttribute);
    }
   
    Element extensionElement = activityElement.element("extensionElements");
    if (extensionElement != null) {
     
      FormTypes formTypes = Context
        .getProcessEngineConfiguration()
        .getFormTypes();
   
      List<Element> formPropertyElements = extensionElement.elementsNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "formProperty");
      for (Element formPropertyElement : formPropertyElements) {
        FormPropertyHandler formPropertyHandler = new FormPropertyHandler();
       
        String id = formPropertyElement.attribute("id");
        if (id==null) {
          bpmnParse.addError("attribute 'id' is required", formPropertyElement);
        }
        formPropertyHandler.setId(id);
       
        String name = formPropertyElement.attribute("name");
        formPropertyHandler.setName(name);
       
        AbstractFormType type = formTypes.parseFormPropertyType(formPropertyElement, bpmnParse);
        formPropertyHandler.setType(type);

        String requiredText = formPropertyElement.attribute("required", "false");
        Boolean required = bpmnParse.parseBooleanAttribute(requiredText);
        if (required!=null) {
          formPropertyHandler.setRequired(required);
        } else {
          bpmnParse.addError("attribute 'required' must be one of {on|yes|true|enabled|active|off|no|false|disabled|inactive}", formPropertyElement);
        }

        String readableText = formPropertyElement.attribute("readable", "true");
        Boolean readable = bpmnParse.parseBooleanAttribute(readableText);
        if (readable!=null) {
          formPropertyHandler.setReadable(readable);
        } else {
          bpmnParse.addError("attribute 'readable' must be one of {on|yes|true|enabled|active|off|no|false|disabled|inactive}", formPropertyElement);
        }
       
        String writableText = formPropertyElement.attribute("writable", "true");
        Boolean writable = bpmnParse.parseBooleanAttribute(writableText);
        if (writable!=null) {
          formPropertyHandler.setWritable(writable);
        } else {
          bpmnParse.addError("attribute 'writable' must be one of {on|yes|true|enabled|active|off|no|false|disabled|inactive}", formPropertyElement);
        }

        String variableName = formPropertyElement.attribute("variable");
        formPropertyHandler.setVariableName(variableName);

        String expressionText = formPropertyElement.attribute("expression");
        if (expressionText!=null) {
          Expression expression = expressionManager.createExpression(expressionText);
          formPropertyHandler.setVariableExpression(expression);
        }

        String defaultExpressionText = formPropertyElement.attribute("default");
        if (defaultExpressionText!=null) {
          Expression defaultExpression = expressionManager.createExpression(defaultExpressionText);
          formPropertyHandler.setDefaultExpression(defaultExpression);
        }

        formPropertyHandlers.add(formPropertyHandler);
      }
View Full Code Here

    }
  }

  protected void initExpressionManager() {
    if (expressionManager==null) {
      expressionManager = new ExpressionManager(beans);
    }
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.el.ExpressionManager

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.