Search in sources :

Example 6 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.

the class ProcessProxy method generateSource.

private IFile generateSource(IFolder sourceFolder) {
    StringBuffer source = new StringBuffer();
    if (packageVO != null && !packageVO.getPackageName().equals(PackageVO.DEFAULT_PACKAGE_NAME))
        source.append("package " + getPackageName() + ";\n\n");
    source.append("public class " + getClassName() + " {\n\n");
    for (VariableVO variableVO : processVO.getVariables()) {
        String varType = variableVO.getVariableType();
        String varName = variableVO.getVariableName();
        String accessorPart = varName.substring(0, 1).toUpperCase() + varName.substring(1);
        source.append("  private " + varType + " " + varName + ";\n");
        source.append("  public " + varType + " get" + accessorPart + "() { return " + varName + "; }\n");
        source.append("  public void set" + accessorPart + "(" + varType + " " + varName + ") { this." + varName + " = " + varName + "; }\n");
    }
    source.append("\n}");
    IFile sourceFile = sourceFolder.getFile(getClassName() + "." + "java");
    PluginUtil.writeFile(sourceFile, source.toString(), new NullProgressMonitor());
    return sourceFile;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFile(org.eclipse.core.resources.IFile) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 7 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO 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 8 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO 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 9 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO 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)

Example 10 with VariableVO

use of com.centurylink.mdw.model.value.variable.VariableVO in project mdw-designer by CenturyLinkCloud.

the class WorkflowProcess method getDocRefVariableNames.

public List<String> getDocRefVariableNames() {
    List<String> docRefVariableNames = new ArrayList<>();
    List<VariableVO> variableVOs = getVariables();
    for (VariableVO variableVO : variableVOs) {
        String varType = variableVO.getVariableType();
        if (// TODO
        "com.qwest.mdw.model.FormDataDocument".equals(varType) || // MDW 4
        VariableTranslator.isDocumentReferenceVariable(null, varType))
            docRefVariableNames.add(variableVO.getVariableName());
    }
    Collections.sort(docRefVariableNames);
    return docRefVariableNames;
}
Also used : ArrayList(java.util.ArrayList) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Aggregations

VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)34 ArrayList (java.util.ArrayList)12 HashMap (java.util.HashMap)9 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)7 VariableValue (com.centurylink.mdw.plugin.designer.model.VariableValue)5 IOException (java.io.IOException)4 Map (java.util.Map)4 TreeMap (java.util.TreeMap)4 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)3 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)3 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)3 VariableTypeVO (com.centurylink.mdw.model.value.variable.VariableTypeVO)3 VariableBinding (com.centurylink.mdw.plugin.designer.model.VariableBinding)3 ActionRequestDocument (com.centurylink.mdw.service.ActionRequestDocument)3 Parameter (com.centurylink.mdw.service.Parameter)3 XmlException (org.apache.xmlbeans.XmlException)3 JSONException (org.json.JSONException)3 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)2 SubGraph (com.centurylink.mdw.designer.display.SubGraph)2 RestfulServer (com.centurylink.mdw.designer.utils.RestfulServer)2