Java Code Examples for org.activiti.engine.impl.persistence.entity.ExecutionEntity#setVariable()
The following examples show how to use
org.activiti.engine.impl.persistence.entity.ExecutionEntity#setVariable() .
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: ProcessStartExecutionListener.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
public void notify(DelegateExecution execution) throws Exception { // Add the workflow ID String instanceId = BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, execution.getId()); execution.setVariable(WorkflowConstants.PROP_WORKFLOW_INSTANCE_ID, instanceId); if(tenantService.isEnabled() || !deployWorkflowsInTenant) { // Add tenant as variable to the process. This will allow task-queries to filter out tasks that // are not part of the calling user's domain execution.setVariable(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain()); } // MNT-9713 if (execution instanceof ExecutionEntity) { ExecutionEntity exc = (ExecutionEntity) execution; if (exc.getSuperExecutionId() != null && exc.getVariable(ActivitiConstants.PROP_START_TASK_END_DATE) == null) { exc.setVariable(ActivitiConstants.PROP_START_TASK_END_DATE, new Date()); } } }
Example 2
Source File: CounterSignCmd.java From lemon with Apache License 2.0 | 6 votes |
/** * <li>给串行实例集合中添加一个审批人 */ private void addSequentialInstance() { ExecutionEntity execution = getActivieExecutions().get(0); if (getActivity().getProperty("type").equals("subProcess")) { if (!execution.isActive() && execution.isEnded() && ((execution.getExecutions() == null) || (execution .getExecutions().size() == 0))) { execution.setActive(true); } } Collection<String> col = (Collection<String>) execution .getVariable(collectionVariableName); col.add(assignee); execution.setVariable(collectionVariableName, col); setLoopVariable(execution, "nrOfInstances", (Integer) execution.getVariableLocal("nrOfInstances") + 1); }
Example 3
Source File: CounterSignCmd.java From lemon with Apache License 2.0 | 6 votes |
/** * 删除串行列表中移除未完成的用户(当前执行的用户无法移除) */ private void removeSequentialInstance() { ExecutionEntity executionEntity = getActivieExecutions().get(0); Collection<String> col = (Collection<String>) executionEntity .getVariable(collectionVariableName); log.info("移除前审批列表 : {}", col.toString()); col.remove(assignee); executionEntity.setVariable(collectionVariableName, col); setLoopVariable(executionEntity, "nrOfInstances", (Integer) executionEntity.getVariableLocal("nrOfInstances") - 1); // 如果串行要删除的人是当前active执行, if (executionEntity.getVariableLocal(collectionElementVariableName) .equals(assignee)) { throw new ActivitiException("当前正在执行的实例,无法移除!"); } log.info("移除后审批列表 : {}", col.toString()); }
Example 4
Source File: DefaultFormHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void submitFormProperties(Map<String, String> properties, ExecutionEntity execution) { Map<String, String> propertiesCopy = new HashMap<String, String>(properties); for (FormPropertyHandler formPropertyHandler : formPropertyHandlers) { // submitFormProperty will remove all the keys which it takes care // of formPropertyHandler.submitFormProperty(execution, propertiesCopy); } for (String propertyId : propertiesCopy.keySet()) { execution.setVariable(propertyId, propertiesCopy.get(propertyId)); } }
Example 5
Source File: FormPropertyHandler.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void submitFormProperty(ExecutionEntity execution, Map<String, String> properties) { if (!isWritable && properties.containsKey(id)) { throw new ActivitiException("form property '" + id + "' is not writable"); } if (isRequired && !properties.containsKey(id) && defaultExpression == null) { throw new ActivitiException("form property '" + id + "' is required"); } boolean propertyExits = false; Object modelValue = null; if (properties.containsKey(id)) { propertyExits = true; final String propertyValue = properties.remove(id); if (type != null) { modelValue = type.convertFormValueToModelValue(propertyValue); } else { modelValue = propertyValue; } } else if (defaultExpression != null) { final Object expressionValue = defaultExpression.getValue(execution); if (type != null && expressionValue != null) { modelValue = type.convertFormValueToModelValue(expressionValue.toString()); } else if (expressionValue != null) { modelValue = expressionValue.toString(); } else if (isRequired) { throw new ActivitiException("form property '" + id + "' is required"); } } if (propertyExits || (modelValue != null)) { if (variableName != null) { execution.setVariable(variableName, modelValue); } else if (variableExpression != null) { variableExpression.setValue(modelValue, execution); } else { execution.setVariable(id, modelValue); } } }
Example 6
Source File: DefaultContextAssociationManager.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override public void setVariable(String variableName, Object value) { ExecutionEntity execution = getExecutionFromContext(); if (execution != null) { execution.setVariable(variableName, value); execution.getVariable(variableName); } else { getScopedAssociation().setVariable(variableName, value); } }
Example 7
Source File: DefaultFormHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void submitFormProperties(Map<String, String> properties, ExecutionEntity execution) { Map<String, String> propertiesCopy = new HashMap<>(properties); for (FormPropertyHandler formPropertyHandler : formPropertyHandlers) { // submitFormProperty will remove all the keys which it takes care of formPropertyHandler.submitFormProperty(execution, propertiesCopy); } for (String propertyId : propertiesCopy.keySet()) { execution.setVariable(propertyId, propertiesCopy.get(propertyId)); } }
Example 8
Source File: FormPropertyHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
public void submitFormProperty(ExecutionEntity execution, Map<String, String> properties) { if (!isWritable && properties.containsKey(id)) { throw new ActivitiException("form property '" + id + "' is not writable"); } if (isRequired && !properties.containsKey(id) && defaultExpression == null) { throw new ActivitiException("form property '" + id + "' is required"); } boolean propertyExists = false; Object modelValue = null; if (properties.containsKey(id)) { propertyExists = true; final String propertyValue = properties.remove(id); if (type != null) { modelValue = type.convertFormValueToModelValue(propertyValue); } else { modelValue = propertyValue; } } else if (defaultExpression != null) { final Object expressionValue = defaultExpression.getValue(execution); if (type != null && expressionValue != null) { modelValue = type.convertFormValueToModelValue(expressionValue.toString()); } else if (expressionValue != null) { modelValue = expressionValue.toString(); } else if (isRequired) { throw new ActivitiException("form property '" + id + "' is required"); } } if (propertyExists || (modelValue != null)) { if (variableName != null) { execution.setVariable(variableName, modelValue); } else if (variableExpression != null) { variableExpression.setValue(modelValue, execution); } else { execution.setVariable(id, modelValue); } } }
Example 9
Source File: ReOpenProcessCmd.java From lemon with Apache License 2.0 | 5 votes |
public ExecutionEntity createProcessInstance(String processInstanceId, String businessKey, String authenticatedUserId, ProcessDefinitionEntity processDefinition) { // ExecutionEntity processInstance = (ExecutionEntity) this // .createProcessInstance(processDefinition); // ExecutionEntity processInstance = (ExecutionEntity) processDefinition // .createProcessInstanceForInitial(processDefinition.getInitial()); // processInstance.setId(processInstanceId); ExecutionEntity processInstance = (ExecutionEntity) this .createProcessInstance(processDefinition, processInstanceId); processInstance.setExecutions(new ArrayList<ExecutionEntity>()); processInstance.setProcessDefinition(processDefinition); // Do not initialize variable map (let it happen lazily) if (businessKey != null) { processInstance.setBusinessKey(businessKey); } // Reset the process instance in order to have the db-generated process instance id available processInstance.setProcessInstance(processInstance); String initiatorVariableName = (String) processDefinition .getProperty(BpmnParse.PROPERTYNAME_INITIATOR_VARIABLE_NAME); if (initiatorVariableName != null) { processInstance.setVariable(initiatorVariableName, authenticatedUserId); } // if (authenticatedUserId != null) { // processInstance.addIdentityLink(authenticatedUserId, // IdentityLinkType.STARTER); // } // Context.getCommandContext().getHistoryManager() // .recordProcessInstanceStart(processInstance); return processInstance; }