Search in sources :

Example 16 with WorkflowProcess

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

the class ProcessCanvasWrapper method saveProcessAs.

public void saveProcessAs() {
    ProcessSaveAsDialog newProcessDialog = new ProcessSaveAsDialog(getParent().getShell(), getProcess());
    if (newProcessDialog.open() != Dialog.OK)
        // cancelled
        return;
    String newName = newProcessDialog.getNewName();
    WorkflowPackage newPkg = getProject().getDefaultPackage();
    if (!StringHelper.isEmpty(newProcessDialog.getPackageName()))
        newPkg = getProject().getPackage(newProcessDialog.getPackageName());
    flowchartPage.getProcess().blankOutTaskLogicalId();
    flowchartPage.getProcess().save_temp_vars();
    getDesignerProxy().saveProcessAs(getProcess(), newPkg, newName);
    WorkflowProcess newProc = getProject().getProcess(newName);
    if (newProc != null) {
        // update the process explorer tree
        newProc.sync();
        newProc.addElementChangeListener(getProject());
        newProc.fireElementChangeEvent(ChangeType.ELEMENT_CREATE, newProc);
        // update the canvas editor
        openProcessDefinition(newProc);
        IWorkbenchPage page = MdwPlugin.getActivePage();
        if (page != null) {
            ProcessEditor processEditor = (ProcessEditor) page.findEditor(getProcess());
            if (processEditor != null)
                page.closeEditor(processEditor, false);
        }
    }
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ProcessSaveAsDialog(com.centurylink.mdw.plugin.designer.dialogs.ProcessSaveAsDialog) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) ProcessEditor(com.centurylink.mdw.plugin.designer.editors.ProcessEditor)

Example 17 with WorkflowProcess

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

the class CopyDialog method nameAlreadyExists.

private boolean nameAlreadyExists(String name) {
    WorkflowProject workflowProject = workflowElement.getProject();
    PluginDataAccess dataAccess = workflowProject.getDataAccess();
    if (workflowElement instanceof WorkflowProcess)
        return dataAccess.processNameExists(targetPackage.getPackageVO(), name);
    else if (workflowElement instanceof ExternalEvent)
        return workflowProject.externalEventNameExists(name);
    else if (workflowElement instanceof WorkflowAsset)
        return targetPackage == null ? workflowProject.workflowAssetNameExists(name) : targetPackage.workflowAssetNameExists(name);
    else
        return false;
}
Also used : WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) PluginDataAccess(com.centurylink.mdw.plugin.designer.PluginDataAccess)

Example 18 with WorkflowProcess

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

the class ProcessLaunchConfiguration method launch.

public void launch(ILaunchConfiguration launchConfig, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    String wfProjectName = launchConfig.getAttribute(WORKFLOW_PROJECT, "");
    WorkflowProject workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(wfProjectName);
    if (workflowProject == null) {
        showError("Can't locate workflow project: '" + wfProjectName + "'.", PROCESS_LAUNCH, null);
        return;
    }
    if (mode.equals(ILaunchManager.DEBUG_MODE) && !connectForDebug(workflowProject, launchConfig)) {
        return;
    }
    setWriteToConsole(launchConfig.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true));
    boolean viaExternalEvent = launchConfig.getAttribute(LAUNCH_VIA_EXTERNAL_EVENT, false);
    if (viaExternalEvent) {
        String request = launchConfig.getAttribute(EXTERNAL_EVENT_REQUEST, "");
        fireExternalEvent(workflowProject, request, null);
        return;
    }
    boolean notifyProcess = launchConfig.getAttribute(NOTIFY_PROCESS, false);
    if (notifyProcess) {
        String eventName = launchConfig.getAttribute(NOTIFY_PROCESS_EVENT, "");
        String message = launchConfig.getAttribute(NOTIFY_PROCESS_REQUEST, "");
        notifyProcess(workflowProject, eventName, message, null);
        return;
    }
    String processName = launchConfig.getAttribute(PROCESS_NAME, "");
    String processVersion = launchConfig.getAttribute(PROCESS_VERSION, "");
    WorkflowProcess process = workflowProject.getProcess(processName, processVersion);
    if (process == null) {
        // handle condition: obsolete version no longer in project list, but
        // not yet in archive
        ProcessVO procVO = workflowProject.getDesignerProxy().getProcessVO(processName, processVersion);
        if (procVO == null) {
            showError("Can't locate process '" + processName + " v" + processVersion + "' in " + wfProjectName + ".", PROCESS_LAUNCH, workflowProject);
            return;
        } else {
            process = new WorkflowProcess(workflowProject, procVO);
        }
    }
    String masterRequestId = launchConfig.getAttribute(MASTER_REQUEST_ID, "");
    if (masterRequestId.length() == 0) {
        showError("Missing masterRequestId.", PROCESS_LAUNCH, workflowProject);
        return;
    }
    String owner = launchConfig.getAttribute(OWNER, "");
    String ownerId = launchConfig.getAttribute(OWNER_ID, "");
    boolean synchronous = launchConfig.getAttribute(SYNCHRONOUS, false);
    String responseVarName = launchConfig.getAttribute(RESPONSE_VAR_NAME, "");
    Map<String, String> variableValues = launchConfig.getAttribute(VARIABLE_VALUES, new HashMap<String, String>());
    boolean showLogs = launchConfig.getAttribute(SHOW_LOGS, false);
    boolean liveView = launchConfig.getAttribute(LIVE_VIEW, false);
    launchProcess(process, masterRequestId, owner, new Long(ownerId), synchronous, responseVarName, variableValues, null, showLogs, liveView);
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 19 with WorkflowProcess

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

the class ProcessVariablesTab method initializeFrom.

public void initializeFrom(ILaunchConfiguration launchConfig) {
    try {
        String wfProject = launchConfig.getAttribute(ProcessLaunchConfiguration.WORKFLOW_PROJECT, "");
        workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(wfProject);
        if (workflowProject != null) {
            String procName = launchConfig.getAttribute(ProcessLaunchConfiguration.PROCESS_NAME, "");
            String procVer = launchConfig.getAttribute(ProcessLaunchConfiguration.PROCESS_VERSION, "");
            WorkflowProcess processVersion = workflowProject.getProcess(procName, procVer);
            if (processVersion == null) {
                // handle condition: obsolete version no longer in project
                // list, but not yet in archive
                processVersion = new WorkflowProcess(workflowProject, workflowProject.getDesignerProxy().getProcessVO(procName, procVer));
            }
            Map<String, String> variables = launchConfig.getAttribute(ProcessLaunchConfiguration.VARIABLE_VALUES, new HashMap<String, String>());
            variableValues = new ArrayList<>();
            List<VariableVO> variableVOs;
            String activityId = launchConfig.getAttribute(ActivityLaunchConfiguration.ACTIVITY_ID, "");
            if (activityId == null || activityId.isEmpty())
                variableVOs = processVersion.getInputVariables();
            else
                variableVOs = processVersion.getVariables();
            for (VariableVO variableVO : variableVOs) {
                String varName = variableVO.getVariableName();
                VariableTypeVO varType = workflowProject.getDataAccess().getVariableType(variableVO.getVariableType());
                variableValues.add(new VariableValue(variableVO, varType, variables.get(varName)));
            }
            tableContainer.setInput(variableValues);
        }
        validatePage();
    } catch (CoreException ex) {
        PluginMessages.uiError(ex, "Launch Init", workflowProject);
    }
}
Also used : VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) CoreException(org.eclipse.core.runtime.CoreException) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 20 with WorkflowProcess

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

the class WorkflowAssetEditor method fillTreeCombo.

private void fillTreeCombo() {
    treeCombo.removeAll();
    Comparator<WorkflowElement> comparator = new Comparator<WorkflowElement>() {

        public int compare(WorkflowElement we1, WorkflowElement we2) {
            return we1.getLabel().compareTo(we2.getLabel());
        }
    };
    if (isProcess()) {
        List<WorkflowPackage> packages = getProject().getTopLevelUserVisiblePackages();
        for (WorkflowPackage pkg : packages) {
            CTreeComboItem packageItem = new CTreeComboItem(treeCombo, SWT.NONE);
            packageItem.setText(pkg.getName());
            packageItem.setImage(pkg.getIconImage());
            for (WorkflowProcess process : pkg.getProcesses()) {
                CTreeComboItem processItem = new CTreeComboItem(packageItem, SWT.NONE);
                processItem.setText(process.getLabel());
                processItem.setImage(process.getIconImage());
            }
        }
    } else if (isTaskTemplate()) {
        List<WorkflowPackage> packages = getProject().getTopLevelUserVisiblePackages();
        for (WorkflowPackage pkg : packages) {
            List<TaskTemplate> templatesForPkg = pkg.getTaskTemplates();
            if (templatesForPkg != null && !templatesForPkg.isEmpty()) {
                CTreeComboItem packageItem = new CTreeComboItem(treeCombo, SWT.NONE);
                packageItem.setText(pkg.getName());
                packageItem.setImage(pkg.getIconImage());
                for (TaskTemplate template : templatesForPkg) {
                    CTreeComboItem templateItem = new CTreeComboItem(packageItem, SWT.NONE);
                    templateItem.setText(template.getLabel());
                    templateItem.setImage(template.getIconImage());
                }
            }
        }
    } else {
        List<WorkflowAsset> assets = getProject().getAssetList(assetTypes);
        Map<WorkflowPackage, List<WorkflowAsset>> packageAssets = new TreeMap<>();
        for (WorkflowAsset asset : assets) {
            List<WorkflowAsset> assetsForPkg = packageAssets.get(asset.getPackage());
            if (assetsForPkg == null) {
                assetsForPkg = new ArrayList<>();
                packageAssets.put(asset.getPackage(), assetsForPkg);
            }
            assetsForPkg.add(asset);
        }
        for (Map.Entry<WorkflowPackage, List<WorkflowAsset>> pkgAssets : packageAssets.entrySet()) {
            CTreeComboItem packageItem = new CTreeComboItem(treeCombo, SWT.NONE);
            packageItem.setText(pkgAssets.getKey().getName());
            packageItem.setImage(pkgAssets.getKey().getIconImage());
            List<WorkflowAsset> assetsForPkg = pkgAssets.getValue();
            Collections.sort(assetsForPkg, comparator);
            for (WorkflowAsset assetForPkg : assetsForPkg) {
                CTreeComboItem assetItem = new CTreeComboItem(packageItem, SWT.NONE);
                assetItem.setText(assetForPkg.getLabel());
                assetItem.setImage(assetForPkg.getIconImage());
            }
        }
    }
}
Also used : TaskTemplate(com.centurylink.mdw.plugin.designer.model.TaskTemplate) WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) CTreeComboItem(com.centurylink.swt.widgets.CTreeComboItem) ArrayList(java.util.ArrayList) Comparator(java.util.Comparator) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ArrayList(java.util.ArrayList) List(java.util.List) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) Map(java.util.Map) TreeMap(java.util.TreeMap) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

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