Search in sources :

Example 1 with VariableValue

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

the class ProcessLaunchConfiguration method launchProcess.

protected void launchProcess(WorkflowProcess process, String masterRequestId, String owner, Long ownerId, boolean synchronous, String responseVarName, Map<String, String> parameters, Long activityId, boolean showLogs, boolean liveView) {
    List<VariableValue> variableValues = new ArrayList<>();
    for (Map.Entry<String, String> var : parameters.entrySet()) {
        VariableVO variableVO = process.getVariable(var.getKey());
        if (var.getValue().length() > 0) {
            VariableTypeVO varType = process.getProject().getDataAccess().getVariableType(variableVO.getVariableType());
            variableValues.add(new VariableValue(variableVO, varType, var.getValue()));
        }
    }
    DesignerProxy designerProxy = process.getProject().getDesignerProxy();
    try {
        if (showLogs || liveView) {
            watch = true;
            LogWatcher logWatcher = designerProxy.getLogWatcher(MdwPlugin.getDisplay());
            if (logWatcher.isRunning()) {
                MdwPlugin.getDisplay().syncExec(new Runnable() {

                    public void run() {
                        String message = "Live View is already monitoring an existing instance.  Disconnect to monitor new instance?";
                        watch = MessageDialog.openConfirm(MdwPlugin.getDisplay().getActiveShell(), "Live View", message);
                    }
                });
            }
            if (watch) {
                logWatcher.shutdown();
                logWatcher.setMasterRequestId(masterRequestId);
                logWatcher.setProcess(process);
                logWatcher.startup(liveView);
            }
        }
        if (synchronous) {
            String response = designerProxy.launchSynchronousProcess(process, masterRequestId, owner, ownerId, variableValues, responseVarName);
            if (isWriteToConsole())
                writeToConsole("Process Launch Response", response + "\n");
        } else {
            MDWStatusMessage statusMsg = designerProxy.launchProcess(process, masterRequestId, owner, ownerId, variableValues, activityId);
            if (isWriteToConsole())
                writeToConsole("Process Launch Response", statusMsg.getStatusMessage() + "\n");
        }
    } catch (Exception ex) {
        showError(ex, "Launch Process", process.getProject());
    }
}
Also used : VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) DesignerProxy(com.centurylink.mdw.plugin.designer.DesignerProxy) ArrayList(java.util.ArrayList) CoreException(org.eclipse.core.runtime.CoreException) VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) MDWStatusMessage(com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with VariableValue

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

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

the class ProcessInstanceFilterDialog method createVariablesTabItem.

private TabItem createVariablesTabItem(TabFolder tabFolder) {
    TabItem variablesTabItem = new TabItem(tabFolder, SWT.NULL);
    variablesTabItem.setText("Variables");
    Composite composite = new Composite(tabFolder, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    // variables table
    tableContainer = new VariableValuesTableContainer();
    tableContainer.create(composite);
    tableContainer.addDirtyStateListener(new DirtyStateListener() {

        public void dirtyStateChanged(boolean dirty) {
            filter.getVariableValues().clear();
            if (variableValues != null) {
                for (VariableValue variableValue : variableValues) filter.getVariableValues().put(variableValue.getName(), variableValue.getValue());
            }
        }
    });
    variablesTabItem.setControl(composite);
    variableValues = new ArrayList<>();
    tableContainer.setInput(variableValues);
    return variablesTabItem;
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) DirtyStateListener(com.centurylink.mdw.plugin.designer.DirtyStateListener) Composite(org.eclipse.swt.widgets.Composite) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) GridData(org.eclipse.swt.layout.GridData) VariableValuesTableContainer(com.centurylink.mdw.plugin.variables.VariableValuesTableContainer)

Example 4 with VariableValue

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

the class ProcessInstanceFilterDialog method resetFields.

private void resetFields() {
    instanceIdText.setText("");
    masterRequestIdText.setText("");
    ownerCombo.setText("");
    ownerIdText.setText("");
    statusCombo.setText("");
    startToDatePicker.setSelection(null);
    startFromDatePicker.setSelection(null);
    endToDatePicker.setSelection(null);
    endFromDatePicker.setSelection(null);
    pageSizeSpinner.setSelection(20);
    filter.setPageSize(20);
    filter.getVariableValues().clear();
    for (VariableValue varVal : variableValues) varVal.setValue("");
    tableContainer.setInput(variableValues);
}
Also used : VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue)

Example 5 with VariableValue

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

the class ProcessInstanceFilterDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 6;
    composite.setLayout(layout);
    composite.getShell().setText("Process Instance Filters");
    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    createProcessTabItem(tabFolder);
    if (process != null && process.getVariables() != null)
        createVariablesTabItem(tabFolder);
    tabFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if ("Variables".equals(((TabItem) e.item).getText())) {
                BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {

                    public void run() {
                        // populate process variables
                        variableValues = new ArrayList<>();
                        String verString = versionCombo.getText().trim();
                        int version = 0;
                        if (verString.length() > 0)
                            version = RuleSetVO.parseVersion(verString);
                        try {
                            ProcessVO proc = process.getProject().getDesignerProxy().loadProcess(process.getName(), version);
                            for (VariableVO variableVO : proc.getVariables()) {
                                String varName = variableVO.getVariableName();
                                VariableTypeVO varType = process.getProject().getDataAccess().getVariableType(variableVO.getVariableType());
                                variableValues.add(new VariableValue(variableVO, varType, filter.getVariableValues().get(varName)));
                            }
                        } catch (Exception ex) {
                            PluginMessages.uiError(ex, "Get Process Variables", process.getProject());
                        }
                    }
                });
                tableContainer.setInput(variableValues);
            }
        }
    });
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TabFolder(org.eclipse.swt.widgets.TabFolder) VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Aggregations

VariableValue (com.centurylink.mdw.plugin.designer.model.VariableValue)10 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)5 HashMap (java.util.HashMap)4 VariableTypeVO (com.centurylink.mdw.model.value.variable.VariableTypeVO)3 CoreException (org.eclipse.core.runtime.CoreException)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 TabItem (org.eclipse.swt.widgets.TabItem)2 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)1 MDWStatusMessageDocument (com.centurylink.mdw.bpm.MDWStatusMessageDocument)1 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)1 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 TranslationException (com.centurylink.mdw.common.exception.TranslationException)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 DesignerDataAccess (com.centurylink.mdw.designer.DesignerDataAccess)1 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)1 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)1