Search in sources :

Example 76 with WorkflowProcess

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

the class ProcessSaveAsDialog method nameAlreadyExists.

private boolean nameAlreadyExists(String name) {
    WorkflowProject workflowProject = process.getProject();
    PluginDataAccess dataAccess = workflowProject.getDataAccess();
    if (process instanceof WorkflowProcess)
        return dataAccess.processNameExists(newPackage.getPackageVO(), name);
    else
        return false;
}
Also used : WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) PluginDataAccess(com.centurylink.mdw.plugin.designer.PluginDataAccess)

Example 77 with WorkflowProcess

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

the class RenameDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    String message = "";
    final WorkflowProcess processVersion;
    Composite composite = (Composite) super.createDialogArea(parent);
    if (toRename instanceof WorkflowProcess) {
        processVersion = (WorkflowProcess) toRename;
        if (processVersion.hasDescendantProcessVersions())
            message = "Renaming all process versions.";
        else
            message = "Renamed process will be version 1.";
        message += "\nCalling processes must be updated manually.";
    } else {
        processVersion = null;
    }
    composite.getShell().setText(title);
    new Label(composite, SWT.NONE).setText("New Name:");
    newNameTextField = new Text(composite, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(SWT.LEFT);
    gd.widthHint = 200;
    newNameTextField.setLayoutData(gd);
    newNameTextField.setText(toRename.getName());
    newNameTextField.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String name = newNameTextField.getText().trim();
            if (name.length() == 0) {
                getButton(IDialogConstants.OK_ID).setEnabled(false);
                return;
            }
            String error = null;
            if (toRename instanceof WorkflowProcess && workflowProject.getDataAccess().processNameExists(processVersion.getPackage().getPackageVO(), name))
                error = "Process name already exists:\n'" + name + "'";
            else if (toRename instanceof WorkflowPackage) {
                WorkflowPackage packageVersion = (WorkflowPackage) toRename;
                if (workflowProject.packageNameExists(name)) {
                    error = "Package name already exists:\n'" + name + "'";
                } else {
                    boolean containsJavaOrGroovy = false;
                    for (WorkflowAsset asset : packageVersion.getAssets()) {
                        if (RuleSetVO.GROOVY.equals(asset.getLanguage()) || RuleSetVO.JAVA.equals(asset.getLanguage())) {
                            containsJavaOrGroovy = true;
                            break;
                        }
                    }
                    if (containsJavaOrGroovy && !"true".equals(System.getProperty("mdw.allow.nonstandard.naming"))) {
                        String goodPkgName = JavaNaming.getValidPackageName(name);
                        if (!goodPkgName.equals(name))
                            error = "Packages with Java or Groovy assets must comply with Java package naming restrictions.";
                    }
                }
            }
            if (error != null) {
                getButton(IDialogConstants.OK_ID).setEnabled(false);
                WarningTray tray = getWarningTray();
                tray.setMessage(error);
                tray.open();
            } else {
                newName = name;
                getWarningTray().close();
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            }
        }
    });
    new Label(composite, SWT.NONE).setText(message);
    return composite;
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) Text(org.eclipse.swt.widgets.Text) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 78 with WorkflowProcess

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

the class ProcessCanvasWrapper method openProcessInstance.

private void openProcessInstance(ProcessInstanceVO processInstanceInfo) {
    // create a new instance for a new editor
    ProcessVO subprocess = new ProcessVO();
    subprocess.setProcessId(processInstanceInfo.getProcessId());
    try {
        ProcessVO def = getDesignerProxy().getDesignerDataAccess().getProcessDefinition(subprocess.getProcessId());
        subprocess.setProcessName(def.getName());
        subprocess.setVersion(def.getVersion());
        WorkflowProcess toOpen = new WorkflowProcess(getProject(), subprocess);
        toOpen.setPackage(getProject().getProcessPackage(subprocess.getId()));
        toOpen.setProcessInstance(processInstanceInfo);
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        page.openEditor(toOpen, MDW_EDITORS_PROCESS);
    } catch (Exception ex) {
        PluginMessages.uiError(getDisplay().getActiveShell(), ex, "Open SubProcess Instances", getProject());
    }
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) JSONException(org.json.JSONException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 79 with WorkflowProcess

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

the class ProcessInstanceFilterDialog method createProcessTabItem.

private TabItem createProcessTabItem(TabFolder tabFolder) {
    TabItem processTabItem = new TabItem(tabFolder, SWT.NULL);
    processTabItem.setText("Process");
    Composite composite = new Composite(tabFolder, SWT.NONE);
    GridLayout gl = new GridLayout();
    gl.numColumns = 5;
    composite.setLayout(gl);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    // process label
    new Label(composite, SWT.NONE).setText("Process:");
    Label processLabel = new Label(composite, SWT.NONE);
    if (process != null)
        processLabel.setText(process.getName());
    GridData gd = new GridData(SWT.BEGINNING);
    gd.horizontalSpan = 2;
    processLabel.setLayoutData(gd);
    // process version
    new Label(composite, SWT.NONE).setText("Version:");
    versionCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    versionCombo.removeAll();
    versionCombo.add("");
    for (WorkflowProcess pv : process.getAllProcessVersions()) versionCombo.add(pv.getVersionString());
    if (process.getId() == 0)
        versionCombo.setText("");
    else
        versionCombo.setText(process.getVersionString());
    versionCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            filter.setProcess(versionCombo.getText().trim());
        }
    });
    Label vSpacer = new Label(composite, SWT.NONE);
    gd = new GridData(SWT.BEGINNING);
    gd.heightHint = 1;
    gd.horizontalSpan = 5;
    vSpacer.setLayoutData(gd);
    // instance id
    new Label(composite, SWT.NONE).setText("Instance ID:");
    instanceIdText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(SWT.BEGINNING);
    gd.widthHint = 100;
    instanceIdText.setLayoutData(gd);
    if (filter.getProcessInstanceId() != null)
        instanceIdText.setText(filter.getProcessInstanceId().toString());
    instanceIdText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            try {
                if (instanceIdText.getText().trim().length() == 0)
                    filter.setProcessInstanceId(null);
                else
                    filter.setProcessInstanceId(Long.parseLong(instanceIdText.getText().trim()));
            } catch (NumberFormatException ex) {
                if (filter.getProcessInstanceId() == null)
                    instanceIdText.setText("");
                else
                    instanceIdText.setText(filter.getProcessInstanceId().toString());
            }
        }
    });
    new Label(composite, SWT.NONE).setText("");
    // master request id
    new Label(composite, SWT.NONE).setText("Master Request ID:");
    masterRequestIdText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(SWT.BEGINNING);
    gd.widthHint = 100;
    masterRequestIdText.setLayoutData(gd);
    if (filter.getMasterRequestId() != null)
        masterRequestIdText.setText(filter.getMasterRequestId());
    masterRequestIdText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (masterRequestIdText.getText().trim().length() == 0)
                filter.setMasterRequestId(null);
            else
                filter.setMasterRequestId(masterRequestIdText.getText().trim());
        }
    });
    // owner
    new Label(composite, SWT.NONE).setText("Owner Type:");
    ownerCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    ownerCombo.removeAll();
    ownerCombo.add("");
    for (String ownerType : ownerTypes.keySet()) ownerCombo.add(ownerType);
    if (filter.getOwner() != null)
        ownerCombo.setText(getOwnerType(filter.getOwner()));
    ownerCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (ownerCombo.getText().trim().length() == 0)
                filter.setOwner(null);
            else
                filter.setOwner(ownerTypes.get(ownerCombo.getText().trim()));
        }
    });
    Label spacer = new Label(composite, SWT.NONE);
    gd = new GridData(SWT.BEGINNING);
    gd.widthHint = 20;
    spacer.setLayoutData(gd);
    // owner id
    new Label(composite, SWT.NONE).setText("Owner ID:");
    ownerIdText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(SWT.BEGINNING);
    gd.widthHint = 100;
    ownerIdText.setLayoutData(gd);
    if (filter.getOwnerId() != null)
        ownerIdText.setText(filter.getOwnerId().toString());
    ownerIdText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            try {
                if (ownerIdText.getText().trim().length() == 0)
                    filter.setOwnerId(null);
                else
                    filter.setOwnerId(Long.parseLong(ownerIdText.getText().trim()));
            } catch (NumberFormatException ex) {
                if (filter.getOwnerId() == null)
                    ownerIdText.setText("");
                else
                    ownerIdText.setText(filter.getOwnerId().toString());
            }
        }
    });
    // status
    new Label(composite, SWT.NONE).setText("Status:");
    statusCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    statusCombo.removeAll();
    statusCombo.add("");
    for (String status : statuses.keySet()) statusCombo.add(status);
    gd = new GridData(SWT.BEGINNING);
    gd.horizontalSpan = 4;
    statusCombo.setLayoutData(gd);
    if (filter.getStatusCode() != null)
        statusCombo.setText(getStatus(filter.getStatusCode()));
    statusCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (statusCombo.getText().trim().length() == 0)
                filter.setStatusCode(null);
            else
                filter.setStatusCode(statuses.get(statusCombo.getText().trim()));
        }
    });
    // start date range
    new Label(composite, SWT.NONE).setText("Start Date:");
    Group startDateGroup = new Group(composite, SWT.NONE);
    gl = new GridLayout();
    gl.numColumns = 7;
    startDateGroup.setLayout(gl);
    gd = new GridData(SWT.BEGINNING);
    gd.horizontalSpan = 4;
    startDateGroup.setLayoutData(gd);
    // start date from
    new Label(startDateGroup, SWT.NONE).setText("From:");
    startFromDatePicker = new DatePicker(startDateGroup, SWT.BORDER);
    Calendar startFrom = null;
    if (filter.getStartDateFrom() != null) {
        startFrom = Calendar.getInstance();
        startFrom.setTime(filter.getStartDateFrom());
    }
    startFromDatePicker.setSelection(startFrom);
    startFromDatePicker.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (startFromDatePicker.getSelection() == null)
                filter.setStartDateFrom(null);
            else
                filter.setStartDateFrom(startFromDatePicker.getSelection().getTime());
        }
    });
    spacer = new Label(startDateGroup, SWT.NONE);
    gd = new GridData(SWT.BEGINNING);
    gd.widthHint = 10;
    spacer.setLayoutData(gd);
    // start date to
    new Label(startDateGroup, SWT.NONE).setText("To:");
    startToDatePicker = new DatePicker(startDateGroup, SWT.BORDER);
    Calendar startTo = null;
    if (filter.getStartDateTo() != null) {
        startTo = Calendar.getInstance();
        startTo.setTime(filter.getStartDateTo());
    }
    startToDatePicker.setSelection(startTo);
    startToDatePicker.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (startToDatePicker.getSelection() == null)
                filter.setStartDateTo(null);
            else
                filter.setStartDateTo(startToDatePicker.getSelection().getTime());
        }
    });
    spacer = new Label(startDateGroup, SWT.NONE);
    gd = new GridData(SWT.BEGINNING);
    gd.widthHint = 10;
    spacer.setLayoutData(gd);
    // start date clear
    Button startDateClearButton = new Button(startDateGroup, SWT.PUSH);
    startDateClearButton.setImage(MdwPlugin.getImageDescriptor("icons/clear.gif").createImage());
    startDateClearButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            startToDatePicker.setSelection(null);
            startFromDatePicker.setSelection(null);
        }
    });
    // end date range
    new Label(composite, SWT.NONE).setText("End Date:");
    Group endDateGroup = new Group(composite, SWT.NONE);
    gl = new GridLayout();
    gl.numColumns = 7;
    endDateGroup.setLayout(gl);
    gd = new GridData(SWT.BEGINNING);
    gd.horizontalSpan = 4;
    endDateGroup.setLayoutData(gd);
    // end date from
    new Label(endDateGroup, SWT.NONE).setText("From:");
    endFromDatePicker = new DatePicker(endDateGroup, SWT.BORDER);
    Calendar endFrom = null;
    if (filter.getEndDateFrom() != null) {
        endFrom = Calendar.getInstance();
        endFrom.setTime(filter.getEndDateFrom());
    }
    endFromDatePicker.setSelection(endFrom);
    endFromDatePicker.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (endFromDatePicker.getSelection() == null)
                filter.setEndDateFrom(null);
            else
                filter.setEndDateFrom(endFromDatePicker.getSelection().getTime());
            if (filter.getEndDateFrom() != null && endToDatePicker.getSelection() == null) {
                Calendar endTo = endFromDatePicker.getSelection();
                endTo.add(Calendar.DATE, 7);
                endToDatePicker.setSelection(endTo);
            }
        }
    });
    spacer = new Label(endDateGroup, SWT.NONE);
    gd = new GridData(SWT.BEGINNING);
    gd.widthHint = 10;
    spacer.setLayoutData(gd);
    // end date to
    new Label(endDateGroup, SWT.NONE).setText("To:");
    endToDatePicker = new DatePicker(endDateGroup, SWT.BORDER);
    Calendar endTo = null;
    if (filter.getEndDateTo() != null) {
        endTo = Calendar.getInstance();
        endTo.setTime(filter.getEndDateTo());
    }
    endToDatePicker.setSelection(endTo);
    endToDatePicker.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (endToDatePicker.getSelection() == null)
                filter.setEndDateTo(null);
            else
                filter.setEndDateTo(endToDatePicker.getSelection().getTime());
        }
    });
    spacer = new Label(endDateGroup, SWT.NONE);
    gd = new GridData(SWT.BEGINNING);
    gd.widthHint = 10;
    spacer.setLayoutData(gd);
    // end date clear
    Button endDateClearButton = new Button(endDateGroup, SWT.PUSH);
    endDateClearButton.setImage(MdwPlugin.getImageDescriptor("icons/clear.gif").createImage());
    endDateClearButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            endToDatePicker.setSelection(null);
            endFromDatePicker.setSelection(null);
        }
    });
    vSpacer = new Label(composite, SWT.NONE);
    gd = new GridData(SWT.BEGINNING);
    gd.heightHint = 1;
    gd.horizontalSpan = 5;
    vSpacer.setLayoutData(gd);
    // max rows
    new Label(composite, SWT.NONE).setText("Page Size:");
    pageSizeSpinner = new Spinner(composite, SWT.BORDER);
    pageSizeSpinner.setMinimum(10);
    pageSizeSpinner.setMaximum(100);
    pageSizeSpinner.setIncrement(10);
    if (filter.getPageSize() != null)
        pageSizeSpinner.setSelection(filter.getPageSize().intValue());
    pageSizeSpinner.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            filter.setPageSize(pageSizeSpinner.getSelection());
        }
    });
    processTabItem.setControl(composite);
    return processTabItem;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Spinner(org.eclipse.swt.widgets.Spinner) Calendar(java.util.Calendar) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DatePicker(net.sf.ecl.datepicker.DatePicker) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 80 with WorkflowProcess

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

the class ProcessEditor method init.

@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    setSite(site);
    if (input instanceof WorkflowProcess) {
        setInput(input);
        process = (WorkflowProcess) input;
    } else if (input instanceof FileEditorInput) {
        IFile file = ((FileEditorInput) input).getFile();
        String processName = file.getName().substring(0, file.getName().length() - (file.getFileExtension().length() + 1));
        WorkflowProject project = WorkflowProjectManager.getInstance().getWorkflowProject(file.getProject());
        // force initialization
        project.getDesignerProxy();
        process = project.getProcess(processName);
        setInput(process);
    }
    process.addElementChangeListener(this);
    selectionProvider = new WorkflowSelectionProvider(process);
    site.setSelectionProvider(selectionProvider);
    if (process.hasInstanceInfo())
        setPartName(process.getProcessInstance().getId().toString() + " - " + process.getName());
    else
        setPartName(process.getLabel());
}
Also used : IFile(org.eclipse.core.resources.IFile) FileEditorInput(org.eclipse.ui.part.FileEditorInput) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowSelectionProvider(com.centurylink.mdw.plugin.designer.WorkflowSelectionProvider)

Aggregations

WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)85 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)28 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)21 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)21 PartInitException (org.eclipse.ui.PartInitException)20 ArrayList (java.util.ArrayList)17 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)15 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)12 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)11 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)11 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)10 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)9 IEditorPart (org.eclipse.ui.IEditorPart)9 ProcessEditor (com.centurylink.mdw.plugin.designer.editors.ProcessEditor)8 IFile (org.eclipse.core.resources.IFile)8 CoreException (org.eclipse.core.runtime.CoreException)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)8 IOException (java.io.IOException)7 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)6 Activity (com.centurylink.mdw.plugin.designer.model.Activity)6