use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class VariableInstancesSection method getTheUninitializedVariables.
private List<VariableInstanceInfo> getTheUninitializedVariables() {
HashMap<String, String> variableNamesMap = new HashMap<String, String>();
List<String> variableInstances = new ArrayList<String>();
for (VariableVO variable : process.getProcessVO().getVariables()) {
variableNamesMap.put(variable.getVariableName(), variable.getVariableType());
}
for (VariableInstanceInfo varInst : process.getProcessInstance().getVariables()) {
variableInstances.add(varInst.getName());
}
Set<String> variableNames = variableNamesMap.keySet();
variableNames.removeAll(variableInstances);
List<VariableInstanceInfo> uninitializedVariableInstances = new ArrayList<VariableInstanceInfo>();
for (String varName : variableNames) {
VariableInstanceInfo newVarInst = new VariableInstanceInfo();
newVarInst.setName(varName);
newVarInst.setType(variableNamesMap.get(varName));
uninitializedVariableInstances.add(newVarInst);
}
return uninitializedVariableInstances;
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class StartProcessMappingSection method getInputVariables.
private Map<Integer, VariableVO> getInputVariables() {
Map<Integer, VariableVO> inputVariables = new TreeMap<Integer, VariableVO>();
List<VariableVO> inputVariableVOs = activity.getProcess().getInputVariables();
for (int i = 0; i < inputVariableVOs.size(); i++) {
VariableVO inputVariableVO = (VariableVO) inputVariableVOs.get(i);
inputVariables.put(new Integer(i), inputVariableVO);
}
return inputVariables;
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class SubProcessMappingSection method populateVariableBindingsTable.
private void populateVariableBindingsTable() {
mappingEditor.disposeWidget();
mappingEditor.setOwningProcess(subProcess);
inputOutputVariables = getInputOutputVariables();
List<ColumnSpec> columnSpecs = createColumnSpecs();
mappingEditor.setColumnSpecs(columnSpecs);
mappingEditor.render(composite, false);
if (subProcess != null) {
Map<String, String> map = StringHelper.parseMap(activity.getAttribute("variables"));
// clear inapplicable bindings
List<String> inapplicableVars = new ArrayList<>();
for (String varName : map.keySet()) {
boolean found = false;
for (VariableVO inputVar : subProcess.getInputOutputVariables()) {
if (inputVar.getName().equals(varName)) {
found = true;
break;
}
}
if (!found)
inapplicableVars.add(varName);
}
for (String inapplicableVar : inapplicableVars) map.remove(inapplicableVar);
if (!inapplicableVars.isEmpty()) {
String newAttrVal = StringHelper.formatMap(map);
activity.setAttribute("variables", newAttrVal);
activity.fireAttributeValueChanged("variables", newAttrVal);
}
List<VariableBinding> variableBindings = getVariableBindings(map);
mappingEditor.setValue(variableBindings);
}
composite.layout(true);
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class SubProcessMappingSection method getVariableBindings.
/**
* Returns a list of variable bindings corresponding to the input, output
* and input/output variables of the subprocess, with expressions populated
* based on the activity attribute map.
*/
private List<VariableBinding> getVariableBindings(Map<String, String> map) {
List<VariableBinding> variableBindings = new ArrayList<>();
for (VariableVO variableVO : inputOutputVariables.values()) {
VariableBinding variableBinding = new VariableBinding(variableVO, null);
if (map.containsKey(variableVO.getVariableName())) {
variableBinding.setExpression(map.get(variableVO.getVariableName()));
}
variableBindings.add(variableBinding);
}
return variableBindings;
}
use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class SubProcessMappingSection method getInputOutputVariables.
/**
* Builds a map of Integer to VariableVO for the combo box cell editor.
*/
private Map<Integer, VariableVO> getInputOutputVariables() {
Map<Integer, VariableVO> inOutVariables = new TreeMap<>();
if (subProcess != null) {
List<VariableVO> inputOutputVariableVOs = subProcess.getInputOutputVariables();
for (int i = 0; i < inputOutputVariableVOs.size(); i++) {
VariableVO inputOutputVariableVO = inputOutputVariableVOs.get(i);
inOutVariables.put(Integer.valueOf(i), inputOutputVariableVO);
}
}
return inOutVariables;
}
Aggregations