use of com.centurylink.mdw.plugin.designer.model.WorkflowElement 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.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class ImportPackageSelectPage method initialize.
/**
* Populate the tree.
*/
public void initialize(WorkflowElement preselected) {
if (preselected instanceof File)
selectedPackages.add((File) preselected);
else if (preselected instanceof Folder) {
for (WorkflowElement element : ((Folder) preselected).getChildren()) selectedPackages.add((File) element);
}
Folder topFolder = ((ImportPackageWizard) getWizard()).getTopFolder();
treeViewer.setInput(topFolder.getChildren());
treeViewer.expandToLevel(2);
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method getAllWorkflowAssets.
/**
* Returns all assets regardless of user access, packaging and archive
* status.
*/
public List<WorkflowAsset> getAllWorkflowAssets() {
List<WorkflowAsset> allAssets = new ArrayList<>();
allAssets.addAll(getTopLevelWorkflowAssets());
if (isShowDefaultPackage())
allAssets.addAll(getUnpackagedWorkflowAssets());
Map<String, WorkflowAsset> latestPackaged = new HashMap<>();
for (WorkflowAsset asset : allAssets) {
String key = (asset.isInDefaultPackage() ? "" : asset.getPackage().getName() + "/") + asset.getName() + asset.getVersionLabel();
latestPackaged.put(key, asset);
}
// get archived def docs if they don't match any non-archived version
for (WorkflowElement child : getArchivedPackageFolder().getChildren()) {
WorkflowPackage topLevelArchivedPackage = (WorkflowPackage) child;
if (topLevelArchivedPackage.getDescendantPackageVersions() != null) {
for (WorkflowPackage archivedPackage : topLevelArchivedPackage.getDescendantPackageVersions()) {
for (WorkflowAsset archivedAsset : archivedPackage.getAssets()) {
String key = (archivedAsset.isInDefaultPackage() ? "" : archivedAsset.getPackage().getName() + "/") + archivedAsset.getName() + archivedAsset.getVersionLabel();
WorkflowAsset curPkgMax = latestPackaged.get(key);
if (curPkgMax == null || archivedAsset.getPackage().getVersion() > curPkgMax.getPackage().getVersion())
latestPackaged.put(key, archivedAsset);
}
}
}
}
// reset list to include those added above
allAssets = new ArrayList<>(latestPackaged.values());
// account for assets not visible to user (cached separately)
if (assetsNotForCurrentUser == null) {
assetsNotForCurrentUser = new ArrayList<>();
for (RuleSetVO rs : getDataAccess().getAllRuleSets(false)) {
WorkflowAsset asset = WorkflowAssetFactory.createAsset(rs, findPackage(rs));
if (asset != null && !allAssets.contains(asset))
assetsNotForCurrentUser.add(asset);
}
}
allAssets.addAll(assetsNotForCurrentUser);
return allAssets;
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class SearchResultsPage method addValueChangeListener.
/**
* Really double-click handler
*/
private void addValueChangeListener() {
valueChangeListener = new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
searchQuery.handleOpen((WorkflowElement) newValue);
}
};
tableEditor.addValueChangeListener(valueChangeListener);
}
use of com.centurylink.mdw.plugin.designer.model.WorkflowElement in project mdw-designer by CenturyLinkCloud.
the class WorkflowElementDeleteDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
composite.getShell().setText("Delete Workflow Elements");
boolean showIncludeInstances = false;
for (WorkflowElement workflowElement : elements) {
if (workflowElement instanceof WorkflowProcess) {
showIncludeInstances = true;
break;
}
}
if (showIncludeInstances) {
includeInstancesCheckbox = new Button(composite, SWT.CHECK | SWT.LEFT);
includeInstancesCheckbox.setText("Include instances if they exist");
}
return composite;
}
Aggregations