Search in sources :

Example 6 with VariableValue

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

the class VariableValuesTableContainer method createTable.

private void createTable(Composite parent) {
    int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION;
    table = new Table(parent, style);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 2;
    gridData.verticalIndent = 3;
    gridData.verticalAlignment = SWT.FILL;
    gridData.heightHint = 150;
    table.setLayoutData(gridData);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    for (int i = 0; i < columnSpecs.size(); i++) {
        ColumnSpec colSpec = columnSpecs.get(i);
        int styles = SWT.LEFT;
        if (colSpec.readOnly)
            style = style | SWT.READ_ONLY;
        TableColumn column = new TableColumn(table, styles, i);
        column.setText(colSpec.label);
        column.setWidth(colSpec.width);
        column.setResizable(colSpec.resizable);
    }
    table.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            int tableWidth = table.getBounds().width;
            int cumulative = 0;
            TableColumn[] tableColumns = table.getColumns();
            for (int i = 0; i < tableColumns.length; i++) {
                if (i == tableColumns.length - 1)
                    tableColumns[i].setWidth(tableWidth - cumulative - 5);
                cumulative += tableColumns[i].getWidth();
            }
        }
    });
    table.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            VariableValue varVal = (VariableValue) e.item.getData();
            String originalValue = varVal.getValue();
            VariableValueDialog varValDlg = new VariableValueDialog(getShell(), varVal);
            varValDlg.setHelpAvailable(false);
            if (varValDlg.open() == Dialog.OK && !originalValue.equals(varVal.getValue())) {
                varVal.setValue(varValDlg.getVariableValue().getValue());
                tableViewer.update(varVal, null);
                fireDirtyStateChange(true);
            } else {
                varVal.setValue(originalValue);
            }
        }
    });
}
Also used : Table(org.eclipse.swt.widgets.Table) ColumnSpec(com.centurylink.mdw.plugin.designer.properties.editor.ColumnSpec) ControlAdapter(org.eclipse.swt.events.ControlAdapter) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableColumn(org.eclipse.swt.widgets.TableColumn) VariableValueDialog(com.centurylink.mdw.plugin.designer.dialogs.VariableValueDialog) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 7 with VariableValue

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

the class DesignerProxy method launchProcess.

public MDWStatusMessage launchProcess(WorkflowProcess processVersion, String masterRequestId, String owner, Long ownerId, List<VariableValue> variableValues, Long activityId) throws DataAccessException, XmlException, JSONException, IOException {
    Map<VariableVO, String> variables = new HashMap<>();
    for (VariableValue variableValue : variableValues) {
        variables.put(variableValue.getVariableVO(), variableValue.getValue());
    }
    MDWStatusMessageDocument statusMessageDoc = restfulServer.launchProcess(processVersion.getId(), masterRequestId, owner, ownerId, variables, activityId, project.isOldNamespaces());
    if (statusMessageDoc.getMDWStatusMessage().getStatusCode() != 0)
        throw new RemoteException("Error launching process: " + statusMessageDoc.getMDWStatusMessage().getStatusMessage());
    // audit log in separate dao since launch is multi-threaded
    UserActionVO userAction = new UserActionVO(project.getUser().getUsername(), Action.Run, processVersion.getActionEntity(), processVersion.getId(), processVersion.getLabel());
    userAction.setSource("Eclipse/RCP Designer");
    try {
        new DesignerDataAccess(dataAccess.getDesignerDataAccess()).auditLog(userAction);
    } catch (Exception ex) {
        throw new DataAccessException(-1, ex.getMessage(), ex);
    }
    return statusMessageDoc.getMDWStatusMessage();
}
Also used : UserActionVO(com.centurylink.mdw.model.value.user.UserActionVO) HashMap(java.util.HashMap) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO) MDWStatusMessageDocument(com.centurylink.mdw.bpm.MDWStatusMessageDocument) DesignerDataAccess(com.centurylink.mdw.designer.DesignerDataAccess) RemoteException(java.rmi.RemoteException) 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) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 8 with VariableValue

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

the class DesignerProxy method launchSynchronousProcess.

public String launchSynchronousProcess(WorkflowProcess processVersion, String masterRequestId, String owner, Long ownerId, List<VariableValue> variableValues, String responseVarName) throws DataAccessException, XmlException, JSONException, IOException {
    Map<VariableVO, String> variables = new HashMap<>();
    for (VariableValue variableValue : variableValues) {
        variables.put(variableValue.getVariableVO(), variableValue.getValue());
    }
    boolean oldFormat = !processVersion.getProject().checkRequiredVersion(5, 5);
    String ret = restfulServer.launchSynchronousProcess(processVersion.getId(), masterRequestId, owner, ownerId, variables, responseVarName, oldFormat);
    dataAccess.auditLog(Action.Run, processVersion);
    return ret;
}
Also used : HashMap(java.util.HashMap) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue) VariableVO(com.centurylink.mdw.model.value.variable.VariableVO)

Example 9 with VariableValue

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

the class ProcessVariablesTab method validatePage.

private void validatePage() {
    setErrorMessage(null);
    setMessage(null);
    if (variableValues != null) {
        StringBuilder missingVars = new StringBuilder("");
        for (VariableValue variableValue : variableValues) {
            if (variableValue.getValue() == null || variableValue.getValue().length() == 0) {
                if (missingVars.length() > 0)
                    missingVars.append(", ");
                missingVars.append(variableValue.getName());
            }
        }
        if (missingVars.length() > 0) {
            setMessage("Input variables missing values:\n" + missingVars);
            updateLaunchConfigurationDialog();
            return;
        }
    }
    updateLaunchConfigurationDialog();
}
Also used : VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue)

Example 10 with VariableValue

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

the class ProcessVariablesTab method performApply.

public void performApply(ILaunchConfigurationWorkingCopy launchConfig) {
    Map<String, String> varVals = new HashMap<>();
    if (variableValues != null) {
        for (VariableValue variableValue : variableValues) {
            varVals.put(variableValue.getName(), variableValue.getValue());
        }
    }
    launchConfig.setAttribute(ProcessLaunchConfiguration.VARIABLE_VALUES, varVals);
}
Also used : HashMap(java.util.HashMap) VariableValue(com.centurylink.mdw.plugin.designer.model.VariableValue)

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