use of com.centurylink.mdw.model.value.variable.VariableTypeVO in project mdw-designer by CenturyLinkCloud.
the class ProcessVariablesTab method initializeFrom.
public void initializeFrom(ILaunchConfiguration launchConfig) {
try {
String wfProject = launchConfig.getAttribute(ProcessLaunchConfiguration.WORKFLOW_PROJECT, "");
workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(wfProject);
if (workflowProject != null) {
String procName = launchConfig.getAttribute(ProcessLaunchConfiguration.PROCESS_NAME, "");
String procVer = launchConfig.getAttribute(ProcessLaunchConfiguration.PROCESS_VERSION, "");
WorkflowProcess processVersion = workflowProject.getProcess(procName, procVer);
if (processVersion == null) {
// handle condition: obsolete version no longer in project
// list, but not yet in archive
processVersion = new WorkflowProcess(workflowProject, workflowProject.getDesignerProxy().getProcessVO(procName, procVer));
}
Map<String, String> variables = launchConfig.getAttribute(ProcessLaunchConfiguration.VARIABLE_VALUES, new HashMap<String, String>());
variableValues = new ArrayList<>();
List<VariableVO> variableVOs;
String activityId = launchConfig.getAttribute(ActivityLaunchConfiguration.ACTIVITY_ID, "");
if (activityId == null || activityId.isEmpty())
variableVOs = processVersion.getInputVariables();
else
variableVOs = processVersion.getVariables();
for (VariableVO variableVO : variableVOs) {
String varName = variableVO.getVariableName();
VariableTypeVO varType = workflowProject.getDataAccess().getVariableType(variableVO.getVariableType());
variableValues.add(new VariableValue(variableVO, varType, variables.get(varName)));
}
tableContainer.setInput(variableValues);
}
validatePage();
} catch (CoreException ex) {
PluginMessages.uiError(ex, "Launch Init", workflowProject);
}
}
use of com.centurylink.mdw.model.value.variable.VariableTypeVO in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceFilterDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginHeight = 6;
composite.setLayout(layout);
composite.getShell().setText("Process Instance Filters");
TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
createProcessTabItem(tabFolder);
if (process != null && process.getVariables() != null)
createVariablesTabItem(tabFolder);
tabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if ("Variables".equals(((TabItem) e.item).getText())) {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
// populate process variables
variableValues = new ArrayList<>();
String verString = versionCombo.getText().trim();
int version = 0;
if (verString.length() > 0)
version = RuleSetVO.parseVersion(verString);
try {
ProcessVO proc = process.getProject().getDesignerProxy().loadProcess(process.getName(), version);
for (VariableVO variableVO : proc.getVariables()) {
String varName = variableVO.getVariableName();
VariableTypeVO varType = process.getProject().getDataAccess().getVariableType(variableVO.getVariableType());
variableValues.add(new VariableValue(variableVO, varType, filter.getVariableValues().get(varName)));
}
} catch (Exception ex) {
PluginMessages.uiError(ex, "Get Process Variables", process.getProject());
}
}
});
tableContainer.setInput(variableValues);
}
}
});
return composite;
}
use of com.centurylink.mdw.model.value.variable.VariableTypeVO in project mdw-designer by CenturyLinkCloud.
the class VariableInstancesSection method getType.
private VariableTypeVO getType(VariableInstanceInfo variableInstanceInfo) {
VariableTypeVO varType = null;
if (variableInstanceInfo.getType() == null)
varType = new VariableTypeVO(new Long(-1), String.class.getName(), StringTranslator.class.getName());
else if (variableInstanceInfo.getType().equals(StringDocument.class.getName()))
varType = new VariableTypeVO(new Long(-1), StringDocument.class.getName(), StringDocTranslator.class.getName());
else
varType = process.getProject().getDataAccess().getVariableType(variableInstanceInfo.getType());
return varType;
}
use of com.centurylink.mdw.model.value.variable.VariableTypeVO in project mdw-designer by CenturyLinkCloud.
the class VariableInstancesSection method openDialog.
private void openDialog(VariableInstanceInfo variableInstanceInfo) {
Integer processStatus = process.getProcessInstance().getStatusCode();
VariableTypeVO varType = getType(variableInstanceInfo);
boolean readOnly = WorkStatus.STATUS_COMPLETED.equals(processStatus) || WorkStatus.STATUS_CANCELLED.equals(processStatus);
if (varType.isJavaObjectType()) {
try {
// update based on object instance or from server
varType = getDesignerProxy().getVariableInfo(variableInstanceInfo);
if (!varType.isUpdateable())
readOnly = true;
} catch (Exception ex) {
PluginMessages.log(ex);
}
}
try {
String varValue = getDesignerProxy().getVariableValue(getShell(), variableInstanceInfo, true);
VariableValueDialog variableValueDialog = new VariableValueDialog(getShell(), variableInstanceInfo, varType, varValue, readOnly);
if (variableValueDialog.open() == Dialog.OK) {
DesignerProxy designerProxy = process.getProject().getDesignerProxy();
designerProxy.updateVariableValue(process, variableInstanceInfo, variableValueDialog.getVariableValue().getValue());
List<VariableInstanceInfo> variables = process.getProcessInstance().getVariables();
List<VariableInstanceInfo> uninitializedVariables = getTheUninitializedVariables();
variables.addAll(uninitializedVariables);
tableEditor.setValue(variables);
}
} catch (Exception ex) {
PluginMessages.uiMessage(ex, "Retrieve Variable", process.getProject(), PluginMessages.VALIDATION_MESSAGE);
return;
}
}
use of com.centurylink.mdw.model.value.variable.VariableTypeVO in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method isDocumentVariable.
private boolean isDocumentVariable(String type, String value) {
VariableTranslator translator;
VariableTypeVO vo = dataAccess.getVariableType(type);
if (vo == null)
return false;
try {
Class<?> cl = Class.forName(vo.getTranslatorClass());
translator = (VariableTranslator) cl.newInstance();
return (translator instanceof DocumentReferenceTranslator);
} catch (Exception e) {
if (value == null)
return false;
return value.startsWith("DOCUMENT:");
}
}
Aggregations