Search in sources :

Example 56 with WorkflowElement

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;
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) TestFileLine(com.centurylink.mdw.designer.testing.TestFileLine) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestResults(com.centurylink.mdw.plugin.designer.model.AutomatedTestResults) IOException(java.io.IOException) TestFile(com.centurylink.mdw.designer.testing.TestFile) LegacyExpectedResults(com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFile(org.eclipse.core.resources.IFile) TestFile(com.centurylink.mdw.designer.testing.TestFile) File(java.io.File) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 57 with WorkflowElement

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);
}
Also used : Folder(com.centurylink.mdw.plugin.designer.model.Folder) File(com.centurylink.mdw.plugin.designer.model.File) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 58 with WorkflowElement

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;
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) HashMap(java.util.HashMap) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ArrayList(java.util.ArrayList) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) RuleSetVO(com.centurylink.mdw.model.value.attribute.RuleSetVO)

Example 59 with WorkflowElement

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);
}
Also used : ValueChangeListener(com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 60 with WorkflowElement

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;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Aggregations

WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)65 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)25 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)25 IAction (org.eclipse.jface.action.IAction)22 Action (org.eclipse.jface.action.Action)21 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)21 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)19 ArrayList (java.util.ArrayList)17 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)14 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)11 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 IFile (org.eclipse.core.resources.IFile)8 AutomatedTestSuite (com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)7 Folder (com.centurylink.mdw.plugin.designer.model.Folder)7 LegacyExpectedResults (com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults)7 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)7 PartInitException (org.eclipse.ui.PartInitException)7 AutomatedTestResults (com.centurylink.mdw.plugin.designer.model.AutomatedTestResults)5 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)5