use of com.centurylink.mdw.plugin.designer.model.VariableValue in project mdw-designer by CenturyLinkCloud.
the class ProcessLaunchConfiguration method launchProcess.
protected void launchProcess(WorkflowProcess process, String masterRequestId, String owner, Long ownerId, boolean synchronous, String responseVarName, Map<String, String> parameters, Long activityId, boolean showLogs, boolean liveView) {
List<VariableValue> variableValues = new ArrayList<>();
for (Map.Entry<String, String> var : parameters.entrySet()) {
VariableVO variableVO = process.getVariable(var.getKey());
if (var.getValue().length() > 0) {
VariableTypeVO varType = process.getProject().getDataAccess().getVariableType(variableVO.getVariableType());
variableValues.add(new VariableValue(variableVO, varType, var.getValue()));
}
}
DesignerProxy designerProxy = process.getProject().getDesignerProxy();
try {
if (showLogs || liveView) {
watch = true;
LogWatcher logWatcher = designerProxy.getLogWatcher(MdwPlugin.getDisplay());
if (logWatcher.isRunning()) {
MdwPlugin.getDisplay().syncExec(new Runnable() {
public void run() {
String message = "Live View is already monitoring an existing instance. Disconnect to monitor new instance?";
watch = MessageDialog.openConfirm(MdwPlugin.getDisplay().getActiveShell(), "Live View", message);
}
});
}
if (watch) {
logWatcher.shutdown();
logWatcher.setMasterRequestId(masterRequestId);
logWatcher.setProcess(process);
logWatcher.startup(liveView);
}
}
if (synchronous) {
String response = designerProxy.launchSynchronousProcess(process, masterRequestId, owner, ownerId, variableValues, responseVarName);
if (isWriteToConsole())
writeToConsole("Process Launch Response", response + "\n");
} else {
MDWStatusMessage statusMsg = designerProxy.launchProcess(process, masterRequestId, owner, ownerId, variableValues, activityId);
if (isWriteToConsole())
writeToConsole("Process Launch Response", statusMsg.getStatusMessage() + "\n");
}
} catch (Exception ex) {
showError(ex, "Launch Process", process.getProject());
}
}
use of com.centurylink.mdw.plugin.designer.model.VariableValue 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.plugin.designer.model.VariableValue in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceFilterDialog method createVariablesTabItem.
private TabItem createVariablesTabItem(TabFolder tabFolder) {
TabItem variablesTabItem = new TabItem(tabFolder, SWT.NULL);
variablesTabItem.setText("Variables");
Composite composite = new Composite(tabFolder, SWT.NONE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
// variables table
tableContainer = new VariableValuesTableContainer();
tableContainer.create(composite);
tableContainer.addDirtyStateListener(new DirtyStateListener() {
public void dirtyStateChanged(boolean dirty) {
filter.getVariableValues().clear();
if (variableValues != null) {
for (VariableValue variableValue : variableValues) filter.getVariableValues().put(variableValue.getName(), variableValue.getValue());
}
}
});
variablesTabItem.setControl(composite);
variableValues = new ArrayList<>();
tableContainer.setInput(variableValues);
return variablesTabItem;
}
use of com.centurylink.mdw.plugin.designer.model.VariableValue in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceFilterDialog method resetFields.
private void resetFields() {
instanceIdText.setText("");
masterRequestIdText.setText("");
ownerCombo.setText("");
ownerIdText.setText("");
statusCombo.setText("");
startToDatePicker.setSelection(null);
startFromDatePicker.setSelection(null);
endToDatePicker.setSelection(null);
endFromDatePicker.setSelection(null);
pageSizeSpinner.setSelection(20);
filter.setPageSize(20);
filter.getVariableValues().clear();
for (VariableValue varVal : variableValues) varVal.setValue("");
tableContainer.setInput(variableValues);
}
use of com.centurylink.mdw.plugin.designer.model.VariableValue 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;
}
Aggregations