Search in sources :

Example 51 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class BamEventComposer method setElement.

public void setElement(WorkflowElement element) {
    this.element = element;
    WorkflowAsset bamPageletAsset = getElement().getPackage().getAsset(WorkflowProject.BAM_PAGELET);
    if (bamPageletAsset == null) {
        // try baseline package
        WorkflowPackage baselinePackage = element.getProject().getPackage(PackageVO.BASELINE_PACKAGE_NAME);
        if (baselinePackage != null)
            bamPageletAsset = baselinePackage.getAsset(WorkflowProject.BAM_PAGELET);
    }
    bamPagelet = null;
    try {
        if (bamPageletAsset == null) {
            bamPagelet = PAGELETDocument.Factory.parse(BamEventComposer.DEFAULT_BAM_PAGELET).getPAGELET();
        } else {
            if (!bamPageletAsset.isLoaded())
                bamPageletAsset.load();
            bamPagelet = PAGELETDocument.Factory.parse(bamPageletAsset.getContent()).getPAGELET();
        }
    } catch (XmlException ex) {
        PluginMessages.uiError(ex, "BAM Pagelet", element.getProject());
    }
    createBamDataTable();
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) XmlException(org.apache.xmlbeans.XmlException) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset)

Example 52 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerContentProvider method handleElementChange.

private void handleElementChange(ElementChangeEvent ece) {
    if (ece.getChangeType().equals(ChangeType.ELEMENT_CREATE)) {
        Object parent = getParent(ece.getElement());
        if (parent == null) {
            treeViewer.refresh(true);
            ece.getElement().addElementChangeListener(this);
        } else {
            if (parent instanceof WorkflowPackage) {
                try {
                    ((WorkflowPackage) parent).getFolder().refreshLocal(IResource.DEPTH_ONE, null);
                } catch (Exception ex) {
                    PluginMessages.log(ex);
                }
            }
            treeViewer.refresh(parent, true);
        }
        treeViewer.expandToLevel(ece.getElement(), 0);
        treeViewer.setSelection(ece.getElement());
    } else if (ece.getChangeType().equals(ChangeType.ELEMENT_DELETE)) {
        Object parent = getParent(ece.getElement());
        if (parent != null) {
            if (ece.getElement() instanceof ActivityImpl)
                // impl can be associated with
                treeViewer.refresh();
            else
                // multiple packages
                treeViewer.refresh(parent, true);
        } else {
            // must be a workflowProject
            ece.getElement().removeElementChangeListener(this);
            treeViewer.refresh();
        }
    } else if (ece.getChangeType().equals(ChangeType.RENAME)) {
        treeViewer.refresh(ece.getElement(), true);
        treeViewer.getControl().forceFocus();
    } else if (ece.getChangeType().equals(ChangeType.VERSION_CHANGE)) {
        treeViewer.refresh(ece.getElement(), true);
        if (ece.getElement() instanceof WorkflowPackage)
            treeViewer.refresh(ece.getElement().getProject().getArchivedUserVisiblePackagesFolder(), true);
    } else if (ece.getChangeType().equals(ChangeType.LABEL_CHANGE)) {
        treeViewer.update(ece.getElement(), null);
    } else if (ece.getChangeType().equals(ChangeType.SETTINGS_CHANGE)) {
        // only applies for workflow projects
        if (ece.getElement() instanceof WorkflowProject) {
            WorkflowProject workflowProject = (WorkflowProject) ece.getElement();
            if (ece.getNewValue() instanceof JdbcDataSource) {
                treeViewer.collapseToLevel(workflowProject, TreeViewer.ALL_LEVELS);
                treeViewer.refresh(workflowProject, true);
            } else if (ece.getNewValue() == null) {
                // general refresh
                treeViewer.refresh(workflowProject, true);
            }
        } else {
            treeViewer.refresh(ece.getElement(), true);
        }
    } else if (ece.getChangeType().equals(ChangeType.STATUS_CHANGE)) {
        treeViewer.update(ece.getElement(), null);
        if (ece.getElement() instanceof AutomatedTestCase) {
            AutomatedTestCase testCase = (AutomatedTestCase) ece.getElement();
            Object testResults;
            if (testCase.isLegacy())
                testResults = testCase.getLegacyExpectedResults();
            else
                testResults = testCase.getExpectedResults();
            if (testResults != null)
                treeViewer.refresh(testResults, true);
        }
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ActivityImpl(com.centurylink.mdw.plugin.designer.model.ActivityImpl) JdbcDataSource(com.centurylink.mdw.plugin.project.model.JdbcDataSource) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestCase(com.centurylink.mdw.plugin.designer.model.AutomatedTestCase) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) InvocationTargetException(java.lang.reflect.InvocationTargetException) DataUnavailableException(com.centurylink.mdw.designer.DataUnavailableException)

Example 53 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerDropTarget method drop.

public boolean drop(String data, Object target, int operation) {
    String elementInfo = data;
    String[] elements = elementInfo.split("#");
    if (target instanceof WorkflowElement && ((WorkflowElement) target).getPackage() != null) {
        WorkflowPackage targetPackage = ((WorkflowElement) target).getPackage();
        if (checkForDuplicates(targetPackage, elements))
            return false;
        for (String element : elements) {
            if (element.startsWith("Process~")) {
                if (!handleDropProcess(element.substring(8), targetPackage, operation))
                    return false;
            } else if (element.startsWith("ExternalEvent~")) {
                if (!handleDropExternalEvent(element.substring(14), targetPackage, operation))
                    return false;
            } else if (element.startsWith("ActivityImpl~")) {
                if (!handleDropActivityImpl(element.substring(14), targetPackage, operation))
                    return false;
            } else if (element.startsWith("WorkflowAsset~")) {
                if (!handleDropWorkflowAsset(element.substring(14), targetPackage, operation))
                    return false;
            } else {
                return false;
            }
        }
        return true;
    } else {
        return false;
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 54 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerDropTarget method handleDropActivityImpl.

private boolean handleDropActivityImpl(String activityImplInfo, WorkflowPackage targetPackage, int operation) {
    Long activityImplId = getActivityImplId(activityImplInfo);
    WorkflowProject workflowProject = targetPackage.getProject();
    WorkflowPackage sourcePackage = workflowProject.getPackage(getPackageName(activityImplInfo));
    DesignerProxy designerProxy = workflowProject.getDesignerProxy();
    if (operation == DND.DROP_COPY) {
        if (!targetPackage.isDefaultPackage()) {
            designerProxy.addActivityImplToPackage(activityImplId, targetPackage);
            ((TreeViewer) getViewer()).refresh(targetPackage, true);
            return true;
        }
        return false;
    } else if (operation == DND.DROP_MOVE) {
        if (targetPackage.isDefaultPackage()) {
            designerProxy.removeActivityImplFromPackage(activityImplId, sourcePackage);
        } else {
            designerProxy.addActivityImplToPackage(activityImplId, targetPackage);
            if (RunnerStatus.SUCCESS.equals(designerProxy.getRunnerStatus()))
                designerProxy.removeActivityImplFromPackage(activityImplId, sourcePackage);
        }
        ((TreeViewer) getViewer()).refresh(targetPackage.getProject(), true);
        return true;
    } else {
        return false;
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) TreeViewer(org.eclipse.jface.viewers.TreeViewer) DesignerProxy(com.centurylink.mdw.plugin.designer.DesignerProxy) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Example 55 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage in project mdw-designer by CenturyLinkCloud.

the class SearchPage method determineScope.

protected void determineScope() {
    if (searchPattern == null)
        searchPattern = "";
    if (scopedProjects == null) {
        // determine scoped projects from selection
        scopedProjects = new ArrayList<WorkflowProject>();
        if (searchPageContainer.getSelectedScope() == ISearchPageContainer.SELECTED_PROJECTS_SCOPE) {
            for (String projectName : searchPageContainer.getSelectedProjectNames()) {
                IProject project = MdwPlugin.getWorkspaceRoot().getProject(projectName);
                WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(project);
                if (workflowProject != null && !scopedProjects.contains(workflowProject))
                    scopedProjects.add(workflowProject);
            }
        } else if (searchPageContainer.getSelectedScope() == ISearchPageContainer.SELECTION_SCOPE) {
            if (searchPageContainer.getSelection() instanceof WorkflowProject)
                scopedProjects.add((WorkflowProject) searchPageContainer.getSelection());
            if (searchPageContainer.getSelection() instanceof WorkflowPackage)
                selectedPackage = (WorkflowPackage) searchPageContainer.getSelection();
        } else if (searchPageContainer.getSelectedScope() == ISearchPageContainer.WORKING_SET_SCOPE) {
            for (IWorkingSet workingSet : searchPageContainer.getSelectedWorkingSets()) {
                for (IAdaptable element : workingSet.getElements()) {
                    if (element instanceof IProject || element instanceof IJavaProject) {
                        IProject project = element instanceof IJavaProject ? ((IJavaProject) element).getProject() : (IProject) element;
                        WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(project);
                        if (workflowProject != null && !scopedProjects.contains(workflowProject))
                            scopedProjects.add(workflowProject);
                    }
                }
            }
        } else {
            scopedProjects.addAll(WorkflowProjectManager.getInstance().getWorkflowProjects());
        }
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) IJavaProject(org.eclipse.jdt.core.IJavaProject) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IProject(org.eclipse.core.resources.IProject) IWorkingSet(org.eclipse.ui.IWorkingSet)

Aggregations

WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)85 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)31 ArrayList (java.util.ArrayList)27 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)25 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)21 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)17 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)11 GridData (org.eclipse.swt.layout.GridData)11 CoreException (org.eclipse.core.runtime.CoreException)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 DesignerProxy (com.centurylink.mdw.plugin.designer.DesignerProxy)8 List (java.util.List)8 Label (org.eclipse.swt.widgets.Label)8 JSONException (org.json.JSONException)8 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)7 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)7 Folder (com.centurylink.mdw.plugin.designer.model.Folder)7 IOException (java.io.IOException)7 InvocationTargetException (java.lang.reflect.InvocationTargetException)7