Search in sources :

Example 6 with WorkflowPackage

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

the class WorkflowElementActionHandler method tagVersion.

public void tagVersion(WorkflowElement[] elements) {
    final List<WorkflowPackage> packages = new ArrayList<WorkflowPackage>();
    for (WorkflowElement element : elements) {
        if (element instanceof WorkflowPackage)
            packages.add((WorkflowPackage) element);
        else
            throw new UnsupportedOperationException("Invalid type for tagVersion: " + element.getClass().getName());
    }
    MdwListInputDialog dlg = new MdwListInputDialog(getShell(), "Tag Workflow Package(s)", "Enter tag to apply to package versions", packages);
    if (dlg.open() == Dialog.CANCEL)
        return;
    final String tag = dlg.getInput();
    if (tag == null)
        return;
    BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {

        public void run() {
            for (final WorkflowPackage pkg : packages) {
                try {
                    DesignerProxy dp = pkg.getProject().getDesignerProxy();
                    dp.tagPackage(pkg, tag);
                } catch (Exception ex) {
                    PluginMessages.uiError(ex, "Tag Package", pkg.getProject());
                    break;
                }
            }
        }
    });
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) MdwListInputDialog(com.centurylink.mdw.plugin.designer.dialogs.MdwListInputDialog) DesignerProxy(com.centurylink.mdw.plugin.designer.DesignerProxy) ArrayList(java.util.ArrayList) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) CoreException(org.eclipse.core.runtime.CoreException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ConnectException(java.net.ConnectException) IOException(java.io.IOException)

Example 7 with WorkflowPackage

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

the class WorkflowElementActionHandler method exportAttributes.

public void exportAttributes(String attributePrefix, WorkflowElement element) {
    if (element instanceof WorkflowPackage || element instanceof WorkflowProcess) {
        ExportAttributesWizard exportAttributesWizard = new ExportAttributesWizard();
        exportAttributesWizard.init(getWorkbench(), element);
        exportAttributesWizard.setPrefix(attributePrefix);
        new WizardDialog(getShell(), exportAttributesWizard).open();
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ExportAttributesWizard(com.centurylink.mdw.plugin.designer.wizards.ExportAttributesWizard) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 8 with WorkflowPackage

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

the class WizardPage method createWorkflowProjectControls.

protected void createWorkflowProjectControls(Composite parent, int ncol, final boolean handleFieldChanged) {
    workflowProjects = WorkflowProjectManager.getInstance().getWorkflowProjects();
    if (workflowProjects == null || workflowProjects.isEmpty())
        MessageDialog.openError(parent.getShell(), "Error", "No MDW projects found");
    if (getElement() != null && getElement().getProject() != null) {
        workflowProject = getElement().getProject();
    } else if (!workflowProjects.isEmpty()) {
        for (WorkflowProject project : workflowProjects) {
            if (project.isLoaded()) {
                workflowProject = project;
                break;
            }
        }
        if (workflowProject == null)
            // last resort
            workflowProject = workflowProjects.get(0);
        getElement().setProject(workflowProject);
    }
    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 = 200;
    workflowProjectCombo.setLayoutData(gd);
    workflowProjectCombo.removeAll();
    for (WorkflowProject project : workflowProjects) {
        workflowProjectCombo.add(project.getSourceProjectName());
    }
    workflowProjectCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(workflowProjectCombo.getText());
            getElement().setProject(workflowProject);
            if (workflowPackageCombo != null) {
                workflowPackageCombo.removeAll();
                for (WorkflowPackage packageVersion : workflowProject.getProject().getTopLevelUserVisiblePackages()) workflowPackageCombo.add(packageVersion.getName());
                workflowPackageCombo.select(0);
            }
            if (handleFieldChanged)
                handleFieldChanged();
        }
    });
    if (getElement().getProject() != null)
        workflowProjectCombo.setText(getElement().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) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) Combo(org.eclipse.swt.widgets.Combo)

Example 9 with WorkflowPackage

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

the class TaskInstancesSection method openTaskInstance.

private void openTaskInstance(TaskInstanceVO taskInstanceVO) {
    String path;
    if (activity.getProject().checkRequiredVersion(6, 0)) {
        path = "#/tasks/" + taskInstanceVO.getTaskInstanceId();
    } else {
        boolean assigned = activity.getProject().getUser().getUsername().equals(taskInstanceVO.getTaskClaimUserCuid());
        String taskInstParams = activity.getProject().getTaskInstancePath(taskInstanceVO.getTaskInstanceId(), assigned);
        WorkflowPackage packageVersion = activity.getPackage();
        String packageParam = packageVersion.isDefaultPackage() ? "" : "&packageName=" + packageVersion.getName();
        path = taskInstParams + packageParam;
    }
    WebApp webapp = activity.getProject().checkRequiredVersion(5, 5) ? WebApp.MdwHub : WebApp.TaskManager;
    WebLaunchActions.getLaunchAction(activity.getProject(), webapp).launch(activity.getProject(), path);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) WebApp(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebApp)

Example 10 with WorkflowPackage

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

the class ProcessSaveAsDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.getShell().setText("Save Process As�");
    // package selection
    new Label(composite, SWT.NONE).setText("Workflow Package");
    workflowPackageCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    GridData grid = new GridData(SWT.BEGINNING);
    grid.horizontalSpan = 2;
    grid.widthHint = 150;
    workflowPackageCombo.setLayoutData(grid);
    workflowPackageCombo.removeAll();
    for (WorkflowPackage packageVersion : this.process.getProject().getTopLevelUserVisiblePackages()) workflowPackageCombo.add(packageVersion.getName());
    workflowPackageCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            packageName = workflowPackageCombo.getText().trim();
            if (!StringHelper.isEmpty(packageName))
                newPackage = getProject().getPackage(packageName);
        }
    });
    if (getProcess().getPackage() != null) {
        packageName = getProcess().getPackage().getName();
        workflowPackageCombo.setText(packageName);
    }
    // process name
    new Label(composite, SWT.NONE).setText("Process Name");
    newNameTextField = new Text(composite, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(SWT.LEFT);
    gd.widthHint = 200;
    newNameTextField.setLayoutData(gd);
    newName = newNameTextField.getText().trim();
    newNameTextField.setText(newName);
    newNameTextField.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String name = newNameTextField.getText().trim();
            String warning = null;
            WorkflowPackage processPkg = newPackage == null ? process.getPackage() : newPackage;
            if (!processPkg.isUserAuthorized(UserRoleVO.ASSET_DESIGN)) {
                warning = "you are not authorized to create a process in selected workflow Package:\n'" + packageName + "'";
            } else if (nameAlreadyExists(name)) {
                warning = process.getTitle() + " name already exists:\n'" + name + "'";
            }
            if (warning != null) {
                getButton(IDialogConstants.OK_ID).setEnabled(false);
                WarningTray tray = getWarningTray();
                tray.setMessage(warning);
                tray.open();
                getButton(Dialog.OK).setEnabled(false);
            } else {
                newName = name;
                getWarningTray().close();
                getButton(IDialogConstants.OK_ID).setEnabled(true);
                getButton(Dialog.OK).setEnabled(name.length() > 0);
            }
        }
    });
    newNameTextField.forceFocus();
    return composite;
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

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