use of org.pentaho.di.trans.steps.salesforceupdate.SalesforceUpdateMeta in project pentaho-kettle by pentaho.
the class SalesforceUpdateDialog method getModulesList.
private void getModulesList() {
if (!gotModule) {
SalesforceConnection connection = null;
try {
SalesforceUpdateMeta meta = new SalesforceUpdateMeta();
getInfo(meta);
String url = transMeta.environmentSubstitute(meta.getTargetURL());
String selectedField = meta.getModule();
wModule.removeAll();
// Define a new Salesforce connection
connection = new SalesforceConnection(log, url, transMeta.environmentSubstitute(meta.getUsername()), Utils.resolvePassword(transMeta, meta.getPassword()));
// connect to Salesforce
connection.connect();
// return
wModule.setItems(connection.getAllAvailableObjects(false));
if (!Utils.isEmpty(selectedField)) {
wModule.setText(selectedField);
}
gotModule = true;
getModulesListError = false;
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SalesforceUpdateDialog.ErrorRetrieveModules.DialogTitle"), BaseMessages.getString(PKG, "SalesforceUpdateDialog.ErrorRetrieveData.ErrorRetrieveModules"), e);
getModulesListError = true;
} finally {
if (connection != null) {
try {
connection.close();
} catch (Exception e) {
/* Ignore */
}
}
}
}
}
use of org.pentaho.di.trans.steps.salesforceupdate.SalesforceUpdateMeta in project pentaho-kettle by pentaho.
the class SalesforceUpdateDialog method getInfo.
@Override
protected void getInfo(SalesforceStepMeta in) throws KettleException {
SalesforceUpdateMeta meta = (SalesforceUpdateMeta) in;
// return value
stepname = wStepname.getText();
// copy info to SalesforceUpdateMeta class (input)
meta.setTargetURL(Const.NVL(wURL.getText(), SalesforceConnectionUtils.TARGET_DEFAULT_URL));
meta.setUsername(wUserName.getText());
meta.setPassword(wPassword.getText());
meta.setModule(Const.NVL(wModule.getText(), "Account"));
meta.setBatchSize(wBatchSize.getText());
int nrfields = wReturn.nrNonEmpty();
meta.allocate(nrfields);
// CHECKSTYLE:Indentation:OFF
for (int i = 0; i < nrfields; i++) {
TableItem item = wReturn.getNonEmpty(i);
meta.getUpdateLookup()[i] = item.getText(1);
meta.getUpdateStream()[i] = item.getText(2);
meta.getUseExternalId()[i] = Boolean.valueOf("Y".equals(item.getText(3)));
}
meta.setCompression(wUseCompression.getSelection());
meta.setTimeout(Const.NVL(wTimeOut.getText(), "0"));
meta.setRollbackAllChangesOnError(wRollbackAllChangesOnError.getSelection());
}
use of org.pentaho.di.trans.steps.salesforceupdate.SalesforceUpdateMeta in project pentaho-kettle by pentaho.
the class SalesforceUpdateDialog method getModuleFields.
private String[] getModuleFields() throws KettleException {
SalesforceUpdateMeta meta = new SalesforceUpdateMeta();
getInfo(meta);
SalesforceConnection connection = null;
String url = transMeta.environmentSubstitute(meta.getTargetURL());
try {
String selectedModule = transMeta.environmentSubstitute(meta.getModule());
// Define a new Salesforce connection
connection = new SalesforceConnection(log, url, transMeta.environmentSubstitute(meta.getUsername()), Utils.resolvePassword(transMeta, meta.getPassword()));
int realTimeOut = Const.toInt(transMeta.environmentSubstitute(meta.getTimeout()), 0);
connection.setTimeOut(realTimeOut);
// connect to Salesforce
connection.connect();
// return fieldsname for the module
return connection.getFields(selectedModule);
} catch (Exception e) {
throw new KettleException("Erreur getting fields from module [" + url + "]!", e);
} finally {
if (connection != null) {
try {
connection.close();
} catch (Exception e) {
/* Ignore */
}
}
}
}
Aggregations