Search in sources :

Example 66 with WorkflowPackage

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

the class CodeGenWizardPage method createWorkflowProjectControls.

protected void createWorkflowProjectControls(Composite parent, int ncol, SelectionListener selectionListener) {
    new Label(parent, SWT.NONE).setText("Workflow Project:");
    workflowProjectCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    GridData gd = new GridData(GridData.BEGINNING);
    gd.horizontalSpan = ncol - 1;
    gd.widthHint = 250;
    workflowProjectCombo.setLayoutData(gd);
    workflowProjectCombo.removeAll();
    for (WorkflowProject project : WorkflowProjectManager.getInstance().getWorkflowProjects()) {
        workflowProjectCombo.add(project.getSourceProjectName());
    }
    if (selectionListener != null)
        workflowProjectCombo.addSelectionListener(selectionListener);
    workflowProjectCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(workflowProjectCombo.getText());
            getCodeElement().setProject(workflowProject);
            enableCodeGenTypes();
            workflowPackageCombo.removeAll();
            if (getCodeElement().getProject() != null) {
                for (WorkflowPackage packageVersion : getCodeElement().getProject().getTopLevelUserVisiblePackages()) workflowPackageCombo.add(packageVersion.getName());
            }
        }
    });
    if (getCodeElement().getProject() != null)
        workflowProjectCombo.setText(getCodeElement().getProject().getName());
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Combo(org.eclipse.swt.widgets.Combo) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Example 67 with WorkflowPackage

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

the class EventHandler method createExternalEvent.

public ExternalEvent createExternalEvent(String handlerString) {
    ExternalEventVO externalEventVO = new ExternalEventVO();
    if (eventName != null && eventName.length() > 0)
        externalEventVO.setEventName(eventName);
    else
        externalEventVO.setEventName(messagePattern);
    externalEventVO.setMessagePattern(messagePattern);
    externalEventVO.setEventHandler(handlerString);
    WorkflowPackage workflowPackage = getPackage() == null ? getProject().getDefaultPackage() : getPackage();
    return new ExternalEvent(externalEventVO, workflowPackage);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ExternalEventVO(com.centurylink.mdw.model.value.event.ExternalEventVO) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent)

Example 68 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage 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 69 with WorkflowPackage

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

the class WorkflowProject method reloadActivityImplementors.

public void reloadActivityImplementors() {
    getDataAccess().getActivityImplementors(true);
    activityImpls.clear();
    for (WorkflowPackage pkg : getTopLevelUserVisiblePackages()) pkg.setActivityImpls(findActivityImplementors(pkg));
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage)

Example 70 with WorkflowPackage

use of com.centurylink.mdw.plugin.designer.model.WorkflowPackage 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;
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

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