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);
}
}
});
}
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();
}
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;
}
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();
}
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);
}
Aggregations