use of org.pentaho.di.trans.steps.salesforceinput.SalesforceInputField in project pentaho-kettle by pentaho.
the class SalesforceInputDialog method getInfo.
@Override
protected void getInfo(SalesforceStepMeta in) throws KettleException {
SalesforceInputMeta meta = (SalesforceInputMeta) in;
// return value
stepname = wStepname.getText();
// copy info to SalesforceInputMeta class (input)
meta.setTargetURL(Const.NVL(wURL.getText(), SalesforceConnectionUtils.TARGET_DEFAULT_URL));
meta.setUsername(Const.NVL(wUserName.getText(), ""));
meta.setPassword(Const.NVL(wPassword.getText(), ""));
meta.setModule(Const.NVL(wModule.getText(), "Account"));
meta.setCondition(Const.NVL(wCondition.getText(), ""));
meta.setSpecifyQuery(wspecifyQuery.getSelection());
meta.setQuery(Const.NVL(wQuery.getText(), ""));
meta.setCompression(wUseCompression.getSelection());
meta.setQueryAll(wQueryAll.getSelection());
meta.setTimeout(Const.NVL(wTimeOut.getText(), "0"));
meta.setRowLimit(Const.NVL(wLimit.getText(), "0"));
meta.setTargetURLField(Const.NVL(wInclURLField.getText(), ""));
meta.setSQLField(Const.NVL(wInclSQLField.getText(), ""));
meta.setTimestampField(Const.NVL(wInclTimestampField.getText(), ""));
meta.setModuleField(Const.NVL(wInclModuleField.getText(), ""));
meta.setRowNumberField(Const.NVL(wInclRownumField.getText(), ""));
meta.setRecordsFilter(SalesforceConnectionUtils.getRecordsFilterByDesc(wRecordsFilter.getText()));
meta.setIncludeTargetURL(wInclURL.getSelection());
meta.setIncludeSQL(wInclSQL.getSelection());
meta.setIncludeTimestamp(wInclTimestamp.getSelection());
meta.setIncludeModule(wInclModule.getSelection());
meta.setIncludeRowNumber(wInclRownum.getSelection());
meta.setReadFrom(wReadFrom.getText());
meta.setReadTo(wReadTo.getText());
meta.setDeletionDateField(Const.NVL(wInclDeletionDateField.getText(), ""));
meta.setIncludeDeletionDate(wInclDeletionDate.getSelection());
int nrFields = wFields.nrNonEmpty();
meta.allocate(nrFields);
for (int i = 0; i < nrFields; i++) {
SalesforceInputField field = new SalesforceInputField();
TableItem item = wFields.getNonEmpty(i);
field.setName(item.getText(1));
field.setField(item.getText(2));
field.setIdLookup(BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(3)));
field.setType(ValueMetaFactory.getIdForValueMeta(item.getText(4)));
field.setFormat(item.getText(5));
field.setLength(Const.toInt(item.getText(6), -1));
field.setPrecision(Const.toInt(item.getText(7), -1));
field.setCurrencySymbol(item.getText(8));
field.setDecimalSymbol(item.getText(9));
field.setGroupSymbol(item.getText(10));
field.setTrimType(SalesforceInputField.getTrimTypeByDesc(item.getText(11)));
field.setRepeated(BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(item.getText(12)));
// CHECKSTYLE:Indentation:OFF
meta.getInputFields()[i] = field;
}
}
use of org.pentaho.di.trans.steps.salesforceinput.SalesforceInputField in project pentaho-kettle by pentaho.
the class SalesforceInputDialog method getData.
/**
* Read the data from the TextFileInputMeta object and show it in this dialog.
*
* @param in
* The SalesforceInputMeta object to obtain the data from.
*/
public void getData(SalesforceInputMeta in) {
wURL.setText(Const.NVL(in.getTargetURL(), ""));
wUserName.setText(Const.NVL(in.getUsername(), ""));
wPassword.setText(Const.NVL(in.getPassword(), ""));
wModule.setText(Const.NVL(in.getModule(), "Account"));
wCondition.setText(Const.NVL(in.getCondition(), ""));
wspecifyQuery.setSelection(in.isSpecifyQuery());
wQuery.setText(Const.NVL(in.getQuery(), ""));
wRecordsFilter.setText(SalesforceConnectionUtils.getRecordsFilterDesc(input.getRecordsFilter()));
wInclURLField.setText(Const.NVL(in.getTargetURLField(), ""));
wInclURL.setSelection(in.includeTargetURL());
wInclSQLField.setText(Const.NVL(in.getSQLField(), ""));
wInclSQL.setSelection(in.includeSQL());
wInclTimestampField.setText(Const.NVL(in.getTimestampField(), ""));
wInclTimestamp.setSelection(in.includeTimestamp());
wInclDeletionDateField.setText(Const.NVL(in.getDeletionDateField(), ""));
wInclDeletionDate.setSelection(in.includeDeletionDate());
wInclModuleField.setText(Const.NVL(in.getModuleField(), ""));
wInclModule.setSelection(in.includeModule());
wInclRownumField.setText(Const.NVL(in.getRowNumberField(), ""));
wInclRownum.setSelection(in.includeRowNumber());
wTimeOut.setText(Const.NVL(in.getTimeout(), SalesforceConnectionUtils.DEFAULT_TIMEOUT));
wUseCompression.setSelection(in.isCompression());
wQueryAll.setSelection(in.isQueryAll());
wLimit.setText("" + in.getRowLimit());
wReadFrom.setText(Const.NVL(in.getReadFrom(), ""));
wReadTo.setText(Const.NVL(in.getReadTo(), ""));
if (log.isDebug()) {
logDebug(BaseMessages.getString(PKG, "SalesforceInputDialog.Log.GettingFieldsInfo"));
}
for (int i = 0; i < in.getInputFields().length; i++) {
SalesforceInputField field = in.getInputFields()[i];
if (field != null) {
TableItem item = wFields.table.getItem(i);
String name = field.getName();
String path = field.getField();
String isidlookup = field.isIdLookup() ? BaseMessages.getString(PKG, "System.Combo.Yes") : BaseMessages.getString(PKG, "System.Combo.No");
String type = field.getTypeDesc();
String format = field.getFormat();
String length = "" + field.getLength();
String prec = "" + field.getPrecision();
String curr = field.getCurrencySymbol();
String group = field.getGroupSymbol();
String decim = field.getDecimalSymbol();
String trim = field.getTrimTypeDesc();
String rep = field.isRepeated() ? BaseMessages.getString(PKG, "System.Combo.Yes") : BaseMessages.getString(PKG, "System.Combo.No");
if (name != null) {
item.setText(1, name);
}
if (path != null) {
item.setText(2, path);
}
if (isidlookup != null) {
item.setText(3, isidlookup);
}
if (type != null) {
item.setText(4, type);
}
if (format != null) {
item.setText(5, format);
}
if (length != null && !"-1".equals(length)) {
item.setText(6, length);
}
if (prec != null && !"-1".equals(prec)) {
item.setText(7, prec);
}
if (curr != null) {
item.setText(8, curr);
}
if (decim != null) {
item.setText(9, decim);
}
if (group != null) {
item.setText(10, group);
}
if (trim != null) {
item.setText(11, trim);
}
if (rep != null) {
item.setText(12, rep);
}
}
}
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth(true);
wStepname.selectAll();
wStepname.setFocus();
}
Aggregations