09-20-2011 08:24 AM
public abstract class VariableScopeImpl implements Serializable, VariableScope {
…
public Map<String, VariableInstanceEntity> getVariableInstances() {
return variableInstances;
}
}public class IngoStartProcessInstanceCmd<T> extends StartProcessInstanceCmd<T> {
public IngoStartProcessInstanceCmd(String processDefinitionKey,
String processDefinitionId, String businessKey,
Map<String, Object> variables) {
super(processDefinitionKey, processDefinitionId, businessKey, variables);
}
@Override
public ProcessInstance execute(CommandContext commandContext) {
ProcessInstance pi = null;
try {
DeploymentCache deploymentCache = Context
.getProcessEngineConfiguration()
.getDeploymentCache();
ProcessDefinitionEntity processDefinition = null;
if (processDefinitionId != null) {
processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiException("No process definition found for id = '" + processDefinitionId + "'");
}
} else if (processDefinitionKey != null) {
processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKey(processDefinitionKey);
if (processDefinition == null) {
throw new ActivitiException("No process definition found for id = '" + processDefinitionId + "'");
}
}
String tenantNumber = (String) variables.get("mandant");
// Prozessvariablen anlegen
HashMap<String, Prozessvariable> prozessvariablen =
(HashMap<String, Prozessvariable>) processDefinition.getProperty(IngoParseListenerConstants.PROZESSVARIABLENMAPPE);
if (prozessvariablen != null) {
for (Iterator<String> prozessvarKeys = prozessvariablen.keySet().iterator(); prozessvarKeys.hasNext();) {
String prozessvarKey = (String) prozessvarKeys.next();
Prozessvariable prozessvariable = prozessvariablen.get(prozessvarKey);
log.info("Prozessvariable " + prozessvariable.getKey() + " (" + prozessvariable.getDisplay() + ") " + prozessvariable.getValue());
if (!variables.containsKey(prozessvariable.getKey())) {
variables.put(prozessvariable.getKey(), prozessvariable.getValue());
}
}
}
pi = super.execute(commandContext);
ExecutionEntity execution = (ExecutionEntity) pi;
Map<String, VariableInstanceEntity> variableInstances = execution.getVariableInstances();
for (Iterator<String> variableNames = variableInstances.keySet().iterator(); variableNames.hasNext;) {
String variableName = (String) variableNames.next();
Prozessvariable prozessvar = prozessvariablen.get(variableName);
if (prozessvar != null) {
String display = prozessvar.getDisplay();
if (display != null) {
String varId = variableInstances.get(variableName).getId();
VariableDisplayEntity variableDisplay = new VariableDisplayEntity(varId, display, tenantNumber);
commandContext.getDbSqlSession().insert(variableDisplay);
}
}
}
} catch (Exception e) {
throw new ActivitiException("Error setting Execution_Extension:", e);
}
return pi;
}
09-26-2011 07:56 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.