Package org.activiti.engine.impl.el

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


        logger.debug("initiator : {}", delegateTask.getVariable("initator"));
        logger.debug("variables : {}", delegateTask.getVariables());

        String receiver = bpmConfNotice.getReceiver();
        BpmMailTemplate bpmMailTemplate = bpmConfNotice.getBpmMailTemplate();
        ExpressionManager expressionManager = Context
                .getProcessEngineConfiguration().getExpressionManager();
        UserDTO userDto = null;
        String subject = expressionManager
                .createExpression(bpmMailTemplate.getSubject())
                .getValue(taskEntity).toString();

        String content = expressionManager
                .createExpression(bpmMailTemplate.getContent())
                .getValue(taskEntity).toString();

        if ("任务接收人".equals(receiver)) {
            userDto = userConnector.findById(delegateTask.getAssignee());
View Full Code Here


    public void onCreate(DelegateTask delegateTask) throws Exception {
        String businessKey = delegateTask.getExecution()
                .getProcessBusinessKey();
        String taskDefinitionKey = delegateTask.getTaskDefinitionKey();

        ExpressionManager expressionManager = Context
                .getProcessEngineConfiguration().getExpressionManager();

        try {
            String sql = "select assignee from bpm_task_conf where business_key=? and task_definition_key=?";
            String assignee = jdbcTemplate.queryForObject(sql, String.class,
                    businessKey, taskDefinitionKey);

            if ((assignee == null) || "".equals(assignee)) {
                return;
            }

            if ((assignee.indexOf("&&") != -1)
                    || (assignee.indexOf("||") != -1)) {
                logger.info("assignee : {}", assignee);

                List<String> candidateUsers = new Expr().evaluate(assignee,
                        this);
                logger.info("candidateUsers : {}", candidateUsers);
                delegateTask.addCandidateUsers(candidateUsers);
            } else {
                String value = expressionManager.createExpression(assignee)
                        .getValue(delegateTask).toString();
                delegateTask.setAssignee(value);
            }
        } catch (Exception ex) {
            logger.debug(ex.getMessage(), ex);
View Full Code Here

                        getInitiator(userConnector, delegateTask));

                String receiver = bpmConfNotice.getReceiver();
                BpmMailTemplate bpmMailTemplate = bpmConfNotice
                        .getBpmMailTemplate();
                ExpressionManager expressionManager = Context
                        .getProcessEngineConfiguration().getExpressionManager();

                UserDTO userDto = null;

                if ("任务接收人".equals(receiver)) {
                    userDto = userConnector
                            .findById(delegateTask.getAssignee());
                } else if ("流程发起人".equals(receiver)) {
                    userDto = userConnector.findById((String) delegateTask
                            .getVariables().get("initiator"));
                } else {
                    HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
                            .getCommandContext()
                            .getHistoricProcessInstanceEntityManager()
                            .findHistoricProcessInstance(
                                    delegateTask.getProcessInstanceId());
                    userDto = userConnector
                            .findById(historicProcessInstanceEntity
                                    .getStartUserId());
                }

                String subject = expressionManager
                        .createExpression(bpmMailTemplate.getSubject())
                        .getValue(taskEntity).toString();

                String content = expressionManager
                        .createExpression(bpmMailTemplate.getContent())
                        .getValue(taskEntity).toString();

                this.sendMail(userDto, subject, content);
                this.sendSiteMessage(userDto, subject, content);
View Full Code Here

        taskEntity.setVariableLocal("initiator",
                getInitiator(userConnector, delegateTask));

        String receiver = bpmConfNotice.getReceiver();
        BpmMailTemplate bpmMailTemplate = bpmConfNotice.getBpmMailTemplate();
        ExpressionManager expressionManager = Context
                .getProcessEngineConfiguration().getExpressionManager();
        UserDTO userDto = null;

        if ("任务接收人".equals(receiver)) {
            userDto = userConnector.findById(delegateTask.getAssignee());
        } else if ("流程发起人".equals(receiver)) {
            userDto = userConnector.findById((String) delegateTask
                    .getVariables().get("initiator"));
        } else {
            HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
                    .getCommandContext()
                    .getHistoricProcessInstanceEntityManager()
                    .findHistoricProcessInstance(
                            delegateTask.getProcessInstanceId());
            userDto = userConnector.findById(historicProcessInstanceEntity
                    .getStartUserId());
        }

        String subject = expressionManager
                .createExpression(bpmMailTemplate.getSubject())
                .getValue(taskEntity).toString();

        String content = expressionManager
                .createExpression(bpmMailTemplate.getContent())
                .getValue(taskEntity).toString();
        this.sendMail(userDto, subject, content);
        this.sendSiteMessage(userDto, subject, content);
    }
View Full Code Here

                .find("from BpmConfUser where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
                        delegateTask.getProcessDefinitionId(), delegateTask
                                .getExecution().getCurrentActivityId());
        logger.debug("{}", bpmConfUsers);

        ExpressionManager expressionManager = Context
                .getProcessEngineConfiguration().getExpressionManager();

        try {
            for (BpmConfUser bpmConfUser : bpmConfUsers) {
                logger.debug("status : {}, type: {}", bpmConfUser.getStatus(),
                        bpmConfUser.getType());
                logger.debug("value : {}", bpmConfUser.getValue());

                String value = expressionManager
                        .createExpression(bpmConfUser.getValue())
                        .getValue(delegateTask).toString();

                if (bpmConfUser.getStatus() == 1) {
                    if (bpmConfUser.getType() == 0) {
View Full Code Here

        UserConnector userConnector = ApplicationContextHelper
                .getBean(UserConnector.class);
        OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
                .getBean(OrgConnector.class);
        ExpressionManager expressionManager = Context
                .getProcessEngineConfiguration().getExpressionManager();
        MapVariableScope mapVariableScope = new MapVariableScope();
        String initiator = historicProcessInstanceEntity.getStartUserId();
        mapVariableScope.setVariable("initiator",
                userConnector.findById(initiator));

        for (BpmConfRule bpmConfRule : bpmConfRules) {
            String value = bpmConfRule.getValue();

            if ("职位".equals(value)) {
                // 获得发起人的职位
                int initiatorLevel = orgConnector
                        .getJobLevelByUserId(initiator);

                // 获得审批人的职位
                int assigneeLevel = orgConnector
                        .getJobLevelByUserId(delegateTask.getAssignee());

                // 比较
                if (initiatorLevel >= assigneeLevel) {
                    logger.info("skip task : {}", delegateTask.getId());
                    logger.info("initiatorLevel : {}, assigneeLevel : {}",
                            initiatorLevel, assigneeLevel);
                    new CompleteTaskWithCommentCmd(delegateTask.getId(),
                            Collections.<String, Object> emptyMap(), "跳过")
                            .execute(Context.getCommandContext());
                }
            } else {
                Boolean result = (Boolean) expressionManager.createExpression(
                        value).getValue(mapVariableScope);

                logger.info("value : {}, result : {}", value, result);

                if (result) {
View Full Code Here

                .find("from BpmConfUser where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
                        delegateTask.getProcessDefinitionId(), delegateTask
                                .getExecution().getCurrentActivityId());
        logger.debug("{}", bpmConfUsers);

        ExpressionManager expressionManager = Context
                .getProcessEngineConfiguration().getExpressionManager();

        try {
            for (BpmConfUser bpmConfUser : bpmConfUsers) {
                logger.debug("status : {}, type: {}", bpmConfUser.getStatus(),
                        bpmConfUser.getType());
                logger.debug("value : {}", bpmConfUser.getValue());

                String value = expressionManager
                        .createExpression(bpmConfUser.getValue())
                        .getValue(delegateTask).toString();

                if (bpmConfUser.getStatus() == 1) {
                    if (bpmConfUser.getType() == TYPE_COPY) {
View Full Code Here

    // ActivityImpl settings
    activity.setScope(true);
    activity.setProperty("multiInstance", loopCharacteristics.isSequential() ? "sequential" : "parallel");
    activity.setActivityBehavior(miActivityBehavior);
   
    ExpressionManager expressionManager = bpmnParse.getExpressionManager();
    BpmnModel bpmnModel = bpmnParse.getBpmnModel();
   
    // loopcardinality
    if (StringUtils.isNotEmpty(loopCharacteristics.getLoopCardinality())) {
      miActivityBehavior.setLoopCardinalityExpression(expressionManager.createExpression(loopCharacteristics.getLoopCardinality()));
    }
   
    // completion condition
    if (StringUtils.isNotEmpty(loopCharacteristics.getCompletionCondition())) {
      miActivityBehavior.setCompletionConditionExpression(expressionManager.createExpression(loopCharacteristics.getCompletionCondition()));
    }
   
    // activiti:collection
    if (StringUtils.isNotEmpty(loopCharacteristics.getInputDataItem())) {
      if (loopCharacteristics.getInputDataItem().contains("{")) {
        miActivityBehavior.setCollectionExpression(expressionManager.createExpression(loopCharacteristics.getInputDataItem()));
      } else {
        miActivityBehavior.setCollectionVariable(loopCharacteristics.getInputDataItem());
      }
    }
View Full Code Here

    currentProcessDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
    currentProcessDefinition.setDeploymentId(bpmnParse.getDeployment().getId());
    createExecutionListenersOnScope(bpmnParse, process.getExecutionListeners(), currentProcessDefinition);
    createEventListeners(bpmnParse, process.getEventListeners(), currentProcessDefinition);
   
    ExpressionManager expressionManager = bpmnParse.getExpressionManager();
   
    for (String candidateUser : process.getCandidateStarterUsers()) {
      currentProcessDefinition.addCandidateStarterUserIdExpression(expressionManager.createExpression(candidateUser));
    }
   
    for (String candidateGroup : process.getCandidateStarterGroups()) {
      currentProcessDefinition.addCandidateStarterGroupIdExpression(expressionManager.createExpression(candidateGroup));
    }

    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Parsing process {}", currentProcessDefinition.getKey());
    }
View Full Code Here

  }
 
  protected TimerDeclarationImpl createTimer(BpmnParse bpmnParse, TimerEventDefinition timerEventDefinition, ScopeImpl timerActivity, String jobHandlerType) {
    TimerDeclarationType type = null;
    Expression expression = null;
    ExpressionManager expressionManager = bpmnParse.getExpressionManager();
    if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDate())) {
      // TimeDate
      type = TimerDeclarationType.DATE;
      expression = expressionManager.createExpression(timerEventDefinition.getTimeDate());
    } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeCycle())) {
      // TimeCycle
      type = TimerDeclarationType.CYCLE;
      expression = expressionManager.createExpression(timerEventDefinition.getTimeCycle());
    } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDuration())) {
      // TimeDuration
      type = TimerDeclarationType.DURATION;
      expression = expressionManager.createExpression(timerEventDefinition.getTimeDuration());
    }   
   
    // neither date, cycle or duration configured!
    if (expression == null) {
      logger.warn("Timer needs configuration (either timeDate, timeCycle or timeDuration is needed) (" + timerActivity.getId() + ")");     
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.