Java Code Examples for org.flowable.engine.impl.persistence.entity.ExecutionEntity#getVariable()
The following examples show how to use
org.flowable.engine.impl.persistence.entity.ExecutionEntity#getVariable() .
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: AssigneeOverwriteFromVariable.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public void notify(DelegateTask delegateTask) { // get mapping table from variable ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager().findById(delegateTask.getExecutionId()); Map<String, String> assigneeMappingTable = (Map<String, String>) execution.getVariable("assigneeMappingTable"); // get assignee from process String assigneeFromProcessDefinition = delegateTask.getAssignee(); // overwrite assignee if there is an entry in the mapping table if (assigneeMappingTable.containsKey(assigneeFromProcessDefinition)) { String assigneeFromMappingTable = assigneeMappingTable.get(assigneeFromProcessDefinition); delegateTask.setAssignee(assigneeFromMappingTable); } }
Example 2
Source File: FormPropertyHandler.java From flowable-engine with Apache License 2.0 | 5 votes |
public FormProperty createFormProperty(ExecutionEntity execution) { FormPropertyImpl formProperty = new FormPropertyImpl(this); Object modelValue = null; if (execution != null) { if (variableName != null || variableExpression == null) { final String varName = variableName != null ? variableName : id; if (execution.hasVariable(varName)) { modelValue = execution.getVariable(varName); } else if (defaultExpression != null) { modelValue = defaultExpression.getValue(execution); } } else { modelValue = variableExpression.getValue(execution); } } else { // Execution is null, the form-property is used in a start-form. // Default value should be available (ACT-1028) even though no execution is available. if (defaultExpression != null) { modelValue = defaultExpression.getValue(NoExecutionVariableScope.getSharedInstance()); } } if (modelValue instanceof String) { formProperty.setValue((String) modelValue); } else if (type != null) { String formValue = type.convertModelValueToFormValue(modelValue); formProperty.setValue(formValue); } else if (modelValue != null) { formProperty.setValue(modelValue.toString()); } return formProperty; }
Example 3
Source File: AddMultiInstanceExecutionCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Execution execute(CommandContext commandContext) { ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(); ExecutionEntity miExecution = searchForMultiInstanceActivity(activityId, parentExecutionId, executionEntityManager); if (miExecution == null) { throw new FlowableException("No multi instance execution found for activity id " + activityId); } if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, miExecution.getProcessDefinitionId())) { throw new FlowableException("Flowable 5 process definitions are not supported"); } ExecutionEntity childExecution = executionEntityManager.createChildExecution(miExecution); childExecution.setCurrentFlowElement(miExecution.getCurrentFlowElement()); BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(miExecution.getProcessDefinitionId()); Activity miActivityElement = (Activity) bpmnModel.getFlowElement(miExecution.getActivityId()); MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = miActivityElement.getLoopCharacteristics(); Integer currentNumberOfInstances = (Integer) miExecution.getVariable(NUMBER_OF_INSTANCES); miExecution.setVariableLocal(NUMBER_OF_INSTANCES, currentNumberOfInstances + 1); if (executionVariables != null) { childExecution.setVariablesLocal(executionVariables); } if (!multiInstanceLoopCharacteristics.isSequential()) { miExecution.setActive(true); miExecution.setScope(false); childExecution.setCurrentFlowElement(miActivityElement); CommandContextUtil.getAgenda().planContinueMultiInstanceOperation(childExecution, miExecution, currentNumberOfInstances); } return childExecution; }
Example 4
Source File: GetExecutionVariableCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Object execute(CommandContext commandContext) { if (executionId == null) { throw new FlowableIllegalArgumentException("executionId is null"); } if (variableName == null) { throw new FlowableIllegalArgumentException("variableName is null"); } ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId); if (execution == null) { throw new FlowableObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class); } if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) { Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler(); return compatibilityHandler.getExecutionVariable(executionId, variableName, isLocal); } Object value; if (isLocal) { value = execution.getVariableLocal(variableName, false); } else { value = execution.getVariable(variableName, false); } return value; }
Example 5
Source File: DefaultContextAssociationManager.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public Object getVariable(String variableName) { ExecutionEntity execution = getExecutionFromContext(); if (execution != null) { return execution.getVariable(variableName); } else { return getScopedAssociation().getVariable(variableName); } }
Example 6
Source File: DefaultContextAssociationManager.java From flowable-engine 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); } }