use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method createOpenInstanceAction.
private IAction createOpenInstanceAction() {
IAction action = new Action() {
@Override
public void run() {
if (openInstanceApplies(getSelection())) {
WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject();
try {
Long procInstId = null;
if (getSelection().getFirstElement() instanceof AutomatedTestResults) {
AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection().getFirstElement();
procInstId = expectedResults.getActualProcessInstanceId();
} else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection().getFirstElement();
java.io.File resultsFile = expectedResult.getActualResultFile();
TestFile testFile = new TestFile(null, resultsFile.getPath());
testFile.load();
TestFileLine line1 = testFile.getLines().get(0);
procInstId = new Long(line1.getWord(3));
}
if (procInstId == null) {
MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file.");
return;
}
ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId);
Long processId = procInst.getProcessId();
ProcessVO procVO = project.getProcess(processId).getProcessVO();
if (procVO == null)
PluginMessages.uiError("Unable to locate process: " + processId, OPEN_PROCESS_INSTANCE, project);
WorkflowProcess instance = new WorkflowProcess(project, procVO);
instance.setProcessInstance(procInst);
actionHandler.open(instance);
} catch (Exception ex) {
PluginMessages.uiError(ex, OPEN_PROCESS_INSTANCE, project);
}
}
}
};
action.setText(OPEN_PROCESS_INSTANCE);
action.setId(MdwMenuManager.MDW_MENU_PREFIX + OPEN_PROCESS_INSTANCE);
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_PROCESS_GIF);
action.setImageDescriptor(imageDesc);
return action;
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestActionGroup method createOpenProcessInstanceAction.
private IAction createOpenProcessInstanceAction() {
IAction action = new Action() {
public void run() {
if (openProcessInstanceApplies(view.getSelectedItem())) {
WorkflowProject project = ((WorkflowElement) view.getSelectedItem()).getProject();
try {
Long procInstId = null;
if (view.getSelectedItem() instanceof AutomatedTestResults) {
AutomatedTestResults expectedResults = (AutomatedTestResults) view.getSelectedItem();
procInstId = expectedResults.getActualProcessInstanceId();
} else if (view.getSelectedItem() instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) view.getSelectedItem();
File resultsFile = expectedResult.getActualResultFile();
TestFile testFile = new TestFile(null, resultsFile.getPath());
testFile.load();
TestFileLine line1 = testFile.getLines().get(0);
procInstId = new Long(line1.getWord(3));
}
if (procInstId == null) {
MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file.");
return;
}
ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId);
Long processId = procInst.getProcessId();
ProcessVO procVO = project.getProcess(processId).getProcessVO();
if (procVO == null)
PluginMessages.uiError("Unable to locate process: " + processId, "Open Process Instance", project);
WorkflowProcess instance = new WorkflowProcess(project, procVO);
instance.setProcessInstance(procInst);
actionHandler.open(instance);
} catch (Exception ex) {
PluginMessages.uiError(ex, "Open Process Instance", project);
}
}
}
};
action.setId(MdwMenuManager.MDW_MENU_PREFIX + "open.process.instance");
action.setText("Open Process Instance");
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/process.gif");
action.setImageDescriptor(imageDesc);
return action;
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class ProcessInstanceListView method createSelectionControls.
private void createSelectionControls(Composite parent) {
new Label(parent, SWT.NONE).setText("Workflow Project:");
projectCombo = new Combo(parent, SWT.DROP_DOWN);
GridData gd = new GridData(GridData.BEGINNING);
gd.widthHint = 160;
projectCombo.setLayoutData(gd);
refreshProjects();
projectCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String projectName = projectCombo.getText().trim();
workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(projectName);
processVersion = null;
refreshProcesses();
processCombo.select(0);
refreshVersions();
versionCombo.select(0);
resetPageIndex();
clearVariables();
refreshTable();
}
});
projectCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String project = projectCombo.getText().trim();
if (project.length() > 0 && projectCombo.indexOf(project) == -1) {
processVersion = null;
refreshProcesses();
processCombo.select(0);
refreshVersions();
versionCombo.select(0);
resetPageIndex();
clearVariables();
refreshTable();
}
}
});
// spacer
new Label(parent, SWT.NONE).setText(" ");
new Label(parent, SWT.NONE).setText("Process:");
processCombo = new Combo(parent, SWT.DROP_DOWN);
gd = new GridData(GridData.BEGINNING);
gd.widthHint = 160;
processCombo.setLayoutData(gd);
processCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String selected = processCombo.getText().trim();
if (selected.length() == 0) {
processVersion = null;
refreshVersions();
versionCombo.select(0);
} else {
ProcessVO processVO = workflowProject.getDesignerProxy().getLatestProcessVO(selected);
processVersion = new WorkflowProcess(workflowProject, processVO);
refreshVersions();
versionCombo.select(1);
}
resetPageIndex();
clearVariables();
refreshTable();
}
});
processCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String process = processCombo.getText().trim();
if (process.length() > 0 && processCombo.indexOf(process) == -1) {
processVersion = null;
refreshVersions();
versionCombo.select(0);
resetPageIndex();
clearVariables();
refreshTable();
}
}
});
// spacer
new Label(parent, SWT.NONE).setText(" ");
new Label(parent, SWT.NONE).setText("Version:");
versionCombo = new Combo(parent, SWT.DROP_DOWN);
gd = new GridData(GridData.BEGINNING);
gd.widthHint = 50;
versionCombo.setLayoutData(gd);
versionCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// clear out filter version
if (contentProvider.getFilter() != null)
contentProvider.getFilter().setProcess(null);
String version = versionCombo.getText().trim();
if (version.isEmpty() && processVersion.getId() == 0)
// avoid re-retrieve
return;
processVersion = getProcessVersion(processVersion, version);
resetPageIndex();
refreshTable();
}
});
versionCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String version = versionCombo.getText().trim();
if (version.length() > 0 && versionCombo.indexOf(version) == -1) {
processVersion = null;
resetPageIndex();
refreshTable();
}
}
});
// spacer
new Label(parent, SWT.NONE).setText(" ");
instanceCountLabel = new Label(parent, SWT.NONE);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
instanceCountLabel.setLayoutData(gd);
instanceCountLabel.setText("Showing: ");
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method findUnpackagedProcesses.
/**
* Gets the top-level unpackaged version for all processes. Side effect: if
* a version is later than than in any package, it's added to the default
* package. The results are populated with their unpackaged descendant
* process versions.
*/
private List<WorkflowProcess> findUnpackagedProcesses() {
List<WorkflowProcess> unpackagedProcesses = new ArrayList<>();
for (ProcessVO processVO : getDataAccess().getProcesses(false)) {
ProcessVO topUnpackaged = null;
ProcessVO toCheck = processVO;
// if process version is later than that in any package,
// it belongs in the top-level default package
boolean toCheckIsLatest = true;
for (WorkflowPackage pkg : getTopLevelPackages()) {
if (pkg.isDefaultPackage())
continue;
WorkflowProcess packaged = pkg.getProcess(processVO.getProcessName());
if (packaged != null && packaged.getVersion() >= toCheck.getVersion()) {
toCheckIsLatest = false;
break;
}
}
if (toCheckIsLatest) {
WorkflowProcess pv = new WorkflowProcess(this, toCheck);
getDefaultPackage().addProcess(pv);
pv.addElementChangeListener(this);
toCheck = toCheck.getPrevVersion();
}
// add the hierarchy of old unpackaged processes
while (toCheck != null) {
if (!isPackaged(toCheck)) {
topUnpackaged = toCheck;
break;
}
toCheck = toCheck.getPrevVersion();
}
if (topUnpackaged != null) {
WorkflowProcess processVersion = new WorkflowProcess(this, topUnpackaged);
processVersion.setDescendantProcessVersions(getUnpackagedDescendantProcesses(processVersion));
unpackagedProcesses.add(processVersion);
}
}
Collections.sort(unpackagedProcesses);
return unpackagedProcesses;
}
use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method findProcesses.
/**
* Returns the process versions belonging to a package version.
*/
private List<WorkflowProcess> findProcesses(WorkflowPackage aPackage) {
List<WorkflowProcess> processVersions = new ArrayList<>();
for (ProcessVO processVO : getDataAccess().getAllProcesses(false)) {
if (aPackage.getPackageVO().containsProcess(processVO.getProcessId())) {
WorkflowProcess processVersion = new WorkflowProcess(this, processVO);
if (// vcs assets
!processVersions.contains(processVersion)) // would add
// same-versioned
// archived
// processes
{
processVersion.setPackage(aPackage);
processVersions.add(processVersion);
}
}
}
Collections.sort(processVersions);
return processVersions;
}
Aggregations