Search in sources :

Example 6 with VariableTypeVO

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

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

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

the class VariableInstancesSection method getType.

private VariableTypeVO getType(VariableInstanceInfo variableInstanceInfo) {
    VariableTypeVO varType = null;
    if (variableInstanceInfo.getType() == null)
        varType = new VariableTypeVO(new Long(-1), String.class.getName(), StringTranslator.class.getName());
    else if (variableInstanceInfo.getType().equals(StringDocument.class.getName()))
        varType = new VariableTypeVO(new Long(-1), StringDocument.class.getName(), StringDocTranslator.class.getName());
    else
        varType = process.getProject().getDataAccess().getVariableType(variableInstanceInfo.getType());
    return varType;
}
Also used : VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) StringTranslator(com.centurylink.mdw.common.translator.impl.StringTranslator)

Example 9 with VariableTypeVO

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

the class VariableInstancesSection method openDialog.

private void openDialog(VariableInstanceInfo variableInstanceInfo) {
    Integer processStatus = process.getProcessInstance().getStatusCode();
    VariableTypeVO varType = getType(variableInstanceInfo);
    boolean readOnly = WorkStatus.STATUS_COMPLETED.equals(processStatus) || WorkStatus.STATUS_CANCELLED.equals(processStatus);
    if (varType.isJavaObjectType()) {
        try {
            // update based on object instance or from server
            varType = getDesignerProxy().getVariableInfo(variableInstanceInfo);
            if (!varType.isUpdateable())
                readOnly = true;
        } catch (Exception ex) {
            PluginMessages.log(ex);
        }
    }
    try {
        String varValue = getDesignerProxy().getVariableValue(getShell(), variableInstanceInfo, true);
        VariableValueDialog variableValueDialog = new VariableValueDialog(getShell(), variableInstanceInfo, varType, varValue, readOnly);
        if (variableValueDialog.open() == Dialog.OK) {
            DesignerProxy designerProxy = process.getProject().getDesignerProxy();
            designerProxy.updateVariableValue(process, variableInstanceInfo, variableValueDialog.getVariableValue().getValue());
            List<VariableInstanceInfo> variables = process.getProcessInstance().getVariables();
            List<VariableInstanceInfo> uninitializedVariables = getTheUninitializedVariables();
            variables.addAll(uninitializedVariables);
            tableEditor.setValue(variables);
        }
    } catch (Exception ex) {
        PluginMessages.uiMessage(ex, "Retrieve Variable", process.getProject(), PluginMessages.VALIDATION_MESSAGE);
        return;
    }
}
Also used : VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) VariableValueDialog(com.centurylink.mdw.plugin.designer.dialogs.VariableValueDialog) DesignerProxy(com.centurylink.mdw.plugin.designer.DesignerProxy) VariableInstanceInfo(com.centurylink.mdw.model.value.variable.VariableInstanceInfo)

Example 10 with VariableTypeVO

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

the class DesignerProxy method isDocumentVariable.

private boolean isDocumentVariable(String type, String value) {
    VariableTranslator translator;
    VariableTypeVO vo = dataAccess.getVariableType(type);
    if (vo == null)
        return false;
    try {
        Class<?> cl = Class.forName(vo.getTranslatorClass());
        translator = (VariableTranslator) cl.newInstance();
        return (translator instanceof DocumentReferenceTranslator);
    } catch (Exception e) {
        if (value == null)
            return false;
        return value.startsWith("DOCUMENT:");
    }
}
Also used : VariableTypeVO(com.centurylink.mdw.model.value.variable.VariableTypeVO) DocumentReferenceTranslator(com.centurylink.mdw.common.translator.DocumentReferenceTranslator) VariableTranslator(com.centurylink.mdw.common.translator.VariableTranslator) JSONException(org.json.JSONException) TranslationException(com.centurylink.mdw.common.exception.TranslationException) AuthenticationException(com.centurylink.mdw.auth.AuthenticationException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) ZipException(java.util.zip.ZipException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) FileNotFoundException(java.io.FileNotFoundException) RemoteException(java.rmi.RemoteException)

Aggregations

VariableTypeVO (com.centurylink.mdw.model.value.variable.VariableTypeVO)13 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)5 VariableTranslator (com.centurylink.mdw.common.translator.VariableTranslator)5 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)5 IOException (java.io.IOException)4 RemoteException (java.rmi.RemoteException)4 JSONException (org.json.JSONException)4 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)3 TranslationException (com.centurylink.mdw.common.exception.TranslationException)3 DocumentReferenceTranslator (com.centurylink.mdw.common.translator.DocumentReferenceTranslator)3 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)3 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)3 VariableValue (com.centurylink.mdw.plugin.designer.model.VariableValue)3 FileNotFoundException (java.io.FileNotFoundException)3 ArrayList (java.util.ArrayList)3 ZipException (java.util.zip.ZipException)3 XmlException (org.apache.xmlbeans.XmlException)3 DesignerProxy (com.centurylink.mdw.plugin.designer.DesignerProxy)2 CoreException (org.eclipse.core.runtime.CoreException)2 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)1