use of org.activiti.engine.impl.persistence.entity.VariableInstance in project Activiti by Activiti.
the class GetExecutionVariableInstanceCmd method execute.
public VariableInstance execute(CommandContext commandContext) {
if (executionId == null) {
throw new ActivitiIllegalArgumentException("executionId is null");
}
if (variableName == null) {
throw new ActivitiIllegalArgumentException("variableName is null");
}
ExecutionEntity execution = commandContext.getExecutionEntityManager().findExecutionById(executionId);
if (execution == null) {
throw new ActivitiObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class);
}
VariableInstance variableEntity = null;
if (isLocal) {
variableEntity = execution.getVariableInstanceLocal(variableName, false);
} else {
variableEntity = execution.getVariableInstance(variableName, false);
}
if (locale != null) {
String localizedName = null;
String localizedDescription = null;
ObjectNode languageNode = Context.getLocalizationElementProperties(locale, variableName, execution.getProcessDefinitionId(), withLocalizationFallback);
if (languageNode != null) {
JsonNode nameNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_NAME);
if (nameNode != null) {
localizedName = nameNode.asText();
}
JsonNode descriptionNode = languageNode.get(DynamicBpmnConstants.LOCALIZATION_DESCRIPTION);
if (descriptionNode != null) {
localizedDescription = descriptionNode.asText();
}
}
if (variableEntity != null) {
variableEntity.setLocalizedName(localizedName);
variableEntity.setLocalizedDescription(localizedDescription);
}
}
return variableEntity;
}
use of org.activiti.engine.impl.persistence.entity.VariableInstance in project Activiti by Activiti.
the class GetExecutionsVariablesCmd method execute.
@Override
public List<VariableInstance> execute(CommandContext commandContext) {
// Verify existance of executions
if (executionIds == null) {
throw new ActivitiIllegalArgumentException("executionIds is null");
}
if (executionIds.isEmpty()) {
throw new ActivitiIllegalArgumentException("Set of executionIds is empty");
}
List<VariableInstance> instances = new ArrayList<VariableInstance>();
List<VariableInstanceEntity> entities = commandContext.getVariableInstanceEntityManager().findVariableInstancesByExecutionIds(executionIds);
for (VariableInstanceEntity entity : entities) {
entity.getValue();
instances.add(entity);
}
return instances;
}
Aggregations