Java Code Examples for org.activiti.engine.impl.persistence.entity.TaskEntity#setVariableLocal()
The following examples show how to use
org.activiti.engine.impl.persistence.entity.TaskEntity#setVariableLocal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JumpToActivityCmd.java From lemon with Apache License 2.0 | 6 votes |
public Object execute(CommandContext commandContext) { for (TaskEntity taskEntity : commandContext.getTaskEntityManager() .findTasksByExecutionId(executionId)) { taskEntity.setVariableLocal("跳转原因", jumpOrigin); commandContext.getTaskEntityManager().deleteTask(taskEntity, jumpOrigin, false); } ExecutionEntity executionEntity = commandContext .getExecutionEntityManager().findExecutionById(executionId); ProcessDefinitionImpl processDefinition = executionEntity .getProcessDefinition(); ActivityImpl activity = processDefinition.findActivity(activityId); executionEntity.executeActivity(activity); return null; }
Example 2
Source File: CompleteNotice.java From lemon with Apache License 2.0 | 4 votes |
public void processComplete(DelegateTask delegateTask, BpmConfNotice bpmConfNotice) { UserConnector userConnector = ApplicationContextHelper .getBean(UserConnector.class); NotificationConnector notificationConnector = ApplicationContextHelper .getBean(NotificationConnector.class); // Map<String, Object> data = new HashMap<String, Object>(); TaskEntity taskEntity = new TaskEntity(); taskEntity.setId(delegateTask.getId()); taskEntity.setName(delegateTask.getName()); taskEntity.setAssigneeWithoutCascade(userConnector.findById( delegateTask.getAssignee()).getDisplayName()); taskEntity.setVariableLocal("initiator", getInitiator(userConnector, delegateTask)); // data.put("task", taskEntity); data.put("initiator", this.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); */ NotificationDTO notificationDto = new NotificationDTO(); notificationDto.setReceiver(userDto.getId()); notificationDto.setReceiverType("userid"); notificationDto.setTypes(Arrays.asList(bpmConfNotice .getNotificationType().split(","))); notificationDto.setData(data); notificationDto.setTemplate(bpmConfNotice.getTemplateCode()); notificationConnector.send(notificationDto, delegateTask.getTenantId()); }
Example 3
Source File: ArrivalNotice.java From lemon with Apache License 2.0 | 4 votes |
public void processArrival(DelegateTask delegateTask, BpmConfNotice bpmConfNotice) { UserConnector userConnector = ApplicationContextHelper .getBean(UserConnector.class); NotificationConnector notificationConnector = ApplicationContextHelper .getBean(NotificationConnector.class); // Map<String, Object> data = new HashMap<String, Object>(); TaskEntity taskEntity = new TaskEntity(); taskEntity.setId(delegateTask.getId()); taskEntity.setName(delegateTask.getName()); taskEntity.setAssigneeWithoutCascade(userConnector.findById( delegateTask.getAssignee()).getDisplayName()); taskEntity.setVariableLocal("initiator", getInitiator(userConnector, delegateTask)); logger.debug("initiator : {}", delegateTask.getVariable("initator")); logger.debug("variables : {}", delegateTask.getVariables()); // data.put("task", taskEntity); data.put("initiator", this.getInitiator(userConnector, delegateTask)); 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()); } 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()); } // this.sendMail(userDto, subject, content); // this.sendSiteMessage(userDto, subject, content); NotificationDTO notificationDto = new NotificationDTO(); notificationDto.setReceiver(userDto.getId()); notificationDto.setReceiverType("userid"); notificationDto.setTypes(Arrays.asList(bpmConfNotice .getNotificationType().split(","))); notificationDto.setData(data); notificationDto.setTemplate(bpmConfNotice.getTemplateCode()); notificationConnector.send(notificationDto, delegateTask.getTenantId()); }
Example 4
Source File: TimeoutNotice.java From lemon with Apache License 2.0 | 4 votes |
public void processTimeout(DelegateTask delegateTask, BpmConfNotice bpmConfNotice) { try { Date dueDate = delegateTask.getDueDate(); Calendar calendar = Calendar.getInstance(); calendar.setTime(dueDate); DatatypeFactory datatypeFactory = DatatypeFactory.newInstance(); Duration duration = datatypeFactory.newDuration("-" + bpmConfNotice.getDueDate()); duration.addTo(calendar); Date noticeDate = calendar.getTime(); Date now = new Date(); if ((now.getTime() < noticeDate.getTime()) && ((noticeDate.getTime() - now.getTime()) < (60 * 1000))) { UserConnector userConnector = ApplicationContextHelper .getBean(UserConnector.class); NotificationConnector notificationConnector = ApplicationContextHelper .getBean(NotificationConnector.class); // Map<String, Object> data = new HashMap<String, Object>(); TaskEntity taskEntity = new TaskEntity(); taskEntity.setId(delegateTask.getId()); taskEntity.setName(delegateTask.getName()); taskEntity.setAssigneeWithoutCascade(userConnector.findById( delegateTask.getAssignee()).getDisplayName()); taskEntity.setVariableLocal("initiator", getInitiator(userConnector, delegateTask)); // data.put("task", taskEntity); data.put("initiator", this.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); */ NotificationDTO notificationDto = new NotificationDTO(); notificationDto.setReceiver(userDto.getId()); notificationDto.setReceiverType("userid"); notificationDto.setTypes(Arrays.asList(bpmConfNotice .getNotificationType().split(","))); notificationDto.setData(data); notificationDto.setTemplate(bpmConfNotice.getTemplateCode()); notificationConnector.send(notificationDto, delegateTask.getTenantId()); } } catch (Exception ex) { logger.error(ex.getMessage(), ex); } }