Search in sources :

Example 21 with VariableVO

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

the class MappingEditor method getProcessVariables.

public Map<Integer, VariableVO> getProcessVariables() {
    Map<Integer, VariableVO> processVariables = new TreeMap<Integer, VariableVO>();
    List<VariableVO> processVariableVOs = getOwningProcess().getVariables();
    for (int i = 0; i < processVariableVOs.size(); i++) {
        VariableVO processVariableVO = (VariableVO) processVariableVOs.get(i);
        processVariables.put(new Integer(i), processVariableVO);
    }
    return processVariables;
}
Also used : VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) TreeMap(java.util.TreeMap)

Example 22 with VariableVO

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

the class OsgiAdapterDesignSection method getResultVariableOptions.

private List<String> getResultVariableOptions() {
    List<String> options = activity.getProcess().getDocRefVariableNames();
    // add string variables
    for (VariableVO var : activity.getProcess().getVariables()) {
        if (String.class.getName().equals(var.getVariableType()))
            options.add(var.getName());
    }
    Collections.sort(options);
    return options;
}
Also used : VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 23 with VariableVO

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

the class TaskTemplateEditor method addPage.

private void addPage(String section) {
    ScrolledComposite scrolledComposite = new ScrolledComposite(getContainer(), SWT.V_SCROLL);
    scrolledComposite.setLayout(new GridLayout());
    scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scrolledComposite.setAlwaysShowScrollBars(true);
    Composite composite = new Composite(scrolledComposite, SWT.NONE);
    composite.setLayout(new FillLayout());
    // create the grid layout
    GridLayout gl = new GridLayout();
    gl.numColumns = PropertyEditor.COLUMNS;
    gl.marginTop = 6;
    gl.marginLeft = 3;
    composite.setLayout(gl);
    for (PropertyEditor propertyEditor : propertyEditors) {
        boolean belongs;
        if (section == null)
            belongs = propertyEditor.getSection() == null;
        else
            belongs = section.equals(propertyEditor.getSection());
        if (belongs) {
            if ("Notices".equals(propertyEditor.getName())) {
                // special handling for notices
                String attrVal = taskTemplate.getAttribute(TaskAttributeConstant.NOTICES);
                if (StringHelper.isEmpty(attrVal) || attrVal.equals("$DefaultNotices"))
                    taskTemplate.setAttribute(TaskAttributeConstant.NOTICES, TaskVO.getDefaultNotices());
                if (noticesValueChangeListener != null)
                    taskTemplate.removeAttributeValueChangeListener(noticesValueChangeListener);
                noticesValueChangeListener = new NoticesValueChangeListener(propertyEditor);
                taskTemplate.addAttributeValueChangeListener(noticesValueChangeListener);
                propertyEditor.render(composite);
            } else if ("Variables".equals(propertyEditor.getName())) {
                // special handling for variables
                TableEditor tableEditor = (TableEditor) propertyEditor;
                // support for value expressions
                tableEditor.setCellModifier(tableEditor.new DefaultCellModifier() {

                    @Override
                    public boolean canModify(Object element, String property) {
                        boolean editable = super.canModify(element, property);
                        if (editable && getColumnIndex(property) == 1) {
                            for (VariableVO var : getProcessVariables()) {
                                if (var.getName().equals(getValue(element, property)))
                                    // can't edit process var rows
                                    return false;
                            }
                        }
                        return editable;
                    }
                });
                tableEditor.setHorizontalSpan(4);
                propertyEditor.render(composite);
                tableEditor.getAddButton().setText("Expression");
                GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
                gridData.widthHint = 80;
                tableEditor.getAddButton().setLayoutData(gridData);
                final Button deleteBtn = tableEditor.getDeleteButton();
                tableEditor.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {

                    public void selectionChanged(SelectionChangedEvent event) {
                        IStructuredSelection sel = (IStructuredSelection) event.getSelection();
                        if (sel.getFirstElement() instanceof DefaultRowImpl) {
                            DefaultRowImpl row = (DefaultRowImpl) sel.getFirstElement();
                            for (VariableVO var : getProcessVariables()) {
                                if (var.getName().equals(row.getColumnValue(1))) {
                                    deleteBtn.setEnabled(false);
                                    return;
                                }
                            }
                            deleteBtn.setEnabled(true);
                        } else {
                            deleteBtn.setEnabled(false);
                        }
                    }
                });
            } else {
                propertyEditor.render(composite);
            }
            propertyEditor.setValue(taskTemplate);
            if (!propertyEditor.getType().equals(PropertyEditor.TYPE_LINK)) {
                propertyEditor.setEditable(!(propertyEditor.isReadOnly() || taskTemplate.isReadOnly()));
            }
        }
    }
    scrolledComposite.setContent(composite);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    String pageName = section == null ? "General" : section;
    setPageText(addPage(scrolledComposite), pageName);
    pages.put(pageName, scrolledComposite);
}
Also used : DefaultRowImpl(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor.DefaultRowImpl) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) FillLayout(org.eclipse.swt.layout.FillLayout) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TableEditor(com.centurylink.mdw.plugin.designer.properties.editor.TableEditor) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) PropertyEditor(com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) JSONObject(org.json.JSONObject)

Example 24 with VariableVO

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

the class WorkflowProcess method getVariableNames.

public List<String> getVariableNames() {
    List<String> variableNames = new ArrayList<>();
    List<VariableVO> variableVOs = getVariables();
    for (VariableVO variableVO : variableVOs) {
        variableNames.add(variableVO.getVariableName());
    }
    Collections.sort(variableNames, new Comparator<String>() {

        public int compare(String n1, String n2) {
            return n1.compareToIgnoreCase(n2);
        }
    });
    return variableNames;
}
Also used : ArrayList(java.util.ArrayList) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 25 with VariableVO

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

the class WorkflowProcess method getNonDocRefVariableNames.

public List<String> getNonDocRefVariableNames() {
    List<String> nonDocRefVariableNames = new ArrayList<>();
    List<VariableVO> variableVOs = getVariables();
    for (VariableVO variableVO : variableVOs) {
        String varType = variableVO.getVariableType();
        if (!VariableTranslator.isDocumentReferenceVariable(null, varType))
            nonDocRefVariableNames.add(variableVO.getVariableName());
    }
    Collections.sort(nonDocRefVariableNames);
    return nonDocRefVariableNames;
}
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