use of org.pentaho.di.trans.steps.salesforce.SalesforceConnection in project pentaho-kettle by pentaho.
the class SalesforceInsertDialog method getModulesList.
private void getModulesList() {
if (!gotModule) {
SalesforceConnection connection = null;
try {
String selectedField = wModule.getText();
wModule.removeAll();
connection = getConnection();
// 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, "SalesforceInsertDialog.ErrorRetrieveModules.DialogTitle"), BaseMessages.getString(PKG, "SalesforceInsertDialog.ErrorRetrieveData.ErrorRetrieveModules"), e);
getModulesListError = true;
} finally {
if (connection != null) {
try {
connection.close();
} catch (Exception e) {
/* Ignore */
}
}
}
}
}
use of org.pentaho.di.trans.steps.salesforce.SalesforceConnection 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