use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.
the class ProcessProxy method generateSource.
private IFile generateSource(IFolder sourceFolder) {
StringBuffer source = new StringBuffer();
if (packageVO != null && !packageVO.getPackageName().equals(PackageVO.DEFAULT_PACKAGE_NAME))
source.append("package " + getPackageName() + ";\n\n");
source.append("public class " + getClassName() + " {\n\n");
for (VariableVO variableVO : processVO.getVariables()) {
String varType = variableVO.getVariableType();
String varName = variableVO.getVariableName();
String accessorPart = varName.substring(0, 1).toUpperCase() + varName.substring(1);
source.append(" private " + varType + " " + varName + ";\n");
source.append(" public " + varType + " get" + accessorPart + "() { return " + varName + "; }\n");
source.append(" public void set" + accessorPart + "(" + varType + " " + varName + ") { this." + varName + " = " + varName + "; }\n");
}
source.append("\n}");
IFile sourceFile = sourceFolder.getFile(getClassName() + "." + "java");
PluginUtil.writeFile(sourceFile, source.toString(), new NullProgressMonitor());
return sourceFile;
}
use of com.centurylink.mdw.model.value.variable.VariableVO 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.model.value.variable.VariableVO 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.VariableVO 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.VariableVO in project mdw-designer by CenturyLinkCloud.
the class WorkflowProcess method getDocRefVariableNames.
public List<String> getDocRefVariableNames() {
List<String> docRefVariableNames = new ArrayList<>();
List<VariableVO> variableVOs = getVariables();
for (VariableVO variableVO : variableVOs) {
String varType = variableVO.getVariableType();
if (// TODO
"com.qwest.mdw.model.FormDataDocument".equals(varType) || // MDW 4
VariableTranslator.isDocumentReferenceVariable(null, varType))
docRefVariableNames.add(variableVO.getVariableName());
}
Collections.sort(docRefVariableNames);
return docRefVariableNames;
}
Aggregations