Java Code Examples for org.activiti.engine.impl.persistence.entity.ExecutionEntity#setTransientVariables()
The following examples show how to use
org.activiti.engine.impl.persistence.entity.ExecutionEntity#setTransientVariables() .
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: TriggerCmd.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected Object execute(CommandContext commandContext, ExecutionEntity execution) { if (Activiti5Util.isActiviti5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = Activiti5Util.getActiviti5CompatibilityHandler(); activiti5CompatibilityHandler.trigger(executionId, processVariables); return null; } if (processVariables != null) { execution.setVariables(processVariables); } if (transientVariables != null) { execution.setTransientVariables(transientVariables); } Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createSignalEvent(ActivitiEventType.ACTIVITY_SIGNALED, execution.getCurrentActivityId(), null, null, execution.getId(), execution.getProcessInstanceId(), execution.getProcessDefinitionId())); Context.getAgenda().planTriggerExecutionOperation(execution); return null; }
Example 2
Source File: FlowableProcessController.java From hsweb-framework with Apache License 2.0 | 5 votes |
@PostMapping("/next-task-candidate/{taskId}") @Authorize(merge = false) public ResponseMessage<List<CandidateDetail>> candidateList(@PathVariable String taskId, @RequestBody Map<String, Object> data, Authentication authentication) { Task task = taskService.createTaskQuery() .taskId(taskId) .singleResult(); ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery() .processInstanceId(task.getProcessInstanceId()) .activityId(task.getTaskDefinitionKey()) .singleResult(); execution.setTransientVariables(data); List<TaskDefinition> taskDefinitions = bpmActivityService .getNextActivities(task.getProcessDefinitionId(), task.getTaskDefinitionKey(), (execution)); List<CandidateDetail> candidates = taskDefinitions.stream().map(TaskDefinition::getKey) .flatMap(key -> processConfigurationService .getActivityConfiguration(authentication.getUser().getId(), task.getProcessDefinitionId(), key) .getCandidateInfo(task) .stream()) .distinct() .map(CandidateDetail::of) .collect(Collectors.toList()); return ResponseMessage.ok(candidates); }
Example 3
Source File: StartProcessInstanceCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
protected void initializeVariables(ExecutionEntity processInstance) { if (variables != null) { processInstance.setVariables(variables); } if (transientVariables != null) { processInstance.setTransientVariables(transientVariables); } }
Example 4
Source File: SignalCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override protected Object execute(CommandContext commandContext, ExecutionEntity execution) { if (processVariables != null) { execution.setVariables(processVariables); } if (transientVariables != null) { execution.setTransientVariables(transientVariables); } execution.signal(signalName, signalData); return null; }
Example 5
Source File: StartProcessInstanceByMessageCmd.java From flowable-engine with Apache License 2.0 | 4 votes |
@Override public ProcessInstance execute(CommandContext commandContext) { if (messageName == null) { throw new ActivitiIllegalArgumentException("Cannot start process instance by message: message name is null"); } MessageEventSubscriptionEntity messageEventSubscription = commandContext.getEventSubscriptionEntityManager() .findMessageStartEventSubscriptionByName(messageName, tenantId); if (messageEventSubscription == null) { throw new ActivitiObjectNotFoundException("Cannot start process instance by message: no subscription to message with name '" + messageName + "' found.", MessageEventSubscriptionEntity.class); } String processDefinitionId = messageEventSubscription.getConfiguration(); if (processDefinitionId == null) { throw new ActivitiException("Cannot start process instance by message: subscription to message with name '" + messageName + "' is not a message start event."); } DeploymentManager deploymentManager = commandContext .getProcessEngineConfiguration() .getDeploymentManager(); ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) deploymentManager.findDeployedProcessDefinitionById(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class); } // Do not start process a process instance if the process definition is suspended if (deploymentManager.isProcessDefinitionSuspended(processDefinition.getId())) { throw new ActivitiException("Cannot start process instance. Process definition " + processDefinition.getName() + " (id = " + processDefinition.getId() + ") is suspended"); } ActivityImpl startActivity = processDefinition.findActivity(messageEventSubscription.getActivityId()); ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey, startActivity); if (processVariables != null) { processInstance.setVariables(processVariables); } if (transientVariables != null) { processInstance.setTransientVariables(transientVariables); } processInstance.start(); return processInstance; }