private void getModulesList() { if (!gotModule) { SalesforceConnection connection = null; try { SalesforceDeleteMeta meta = new SalesforceDeleteMeta(); getInfo(meta); String url = transMeta.environmentSubstitute(meta.getTargetURL()); String selectedField = wModule.getText(); wModule.removeAll(); // 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 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, "SalesforceDeleteDialog.ErrorRetrieveModules.DialogTitle"), BaseMessages.getString( PKG, "SalesforceDeleteDialog.ErrorRetrieveData.ErrorRetrieveModules"), e); getModulesListError = true; } finally { if (connection != null) { try { connection.close(); } catch (Exception e) { /* Ignore */ } } } } }
/** * Read the data from the TextFileInputMeta object and show it in this dialog. * * @param in The SalesforceDeleteMeta object to obtain the data from. */ public void getData(SalesforceDeleteMeta in) { wURL.setText(Const.NVL(in.getTargetURL(), "")); wUserName.setText(Const.NVL(in.getUsername(), "")); wPassword.setText(Const.NVL(in.getPassword(), "")); wBatchSize.setText(in.getBatchSize()); wModule.setText(Const.NVL(in.getModule(), "Account")); if (in.getDeleteField() != null) { wDeleteField.setText(in.getDeleteField()); } wBatchSize.setText("" + in.getBatchSize()); wTimeOut.setText(Const.NVL(in.getTimeout(), SalesforceConnectionUtils.DEFAULT_TIMEOUT)); wUseCompression.setSelection(in.isCompression()); wRollbackAllChangesOnError.setSelection(in.isRollbackAllChangesOnError()); wStepname.selectAll(); wStepname.setFocus(); }