Search in sources :

Example 1 with SalesforceDeleteMeta

use of org.pentaho.di.trans.steps.salesforcedelete.SalesforceDeleteMeta in project pentaho-kettle by pentaho.

the class SalesforceDeleteDialog method getInfo.

@Override
protected void getInfo(SalesforceStepMeta in) throws KettleException {
    SalesforceDeleteMeta meta = (SalesforceDeleteMeta) in;
    // return value
    stepname = wStepname.getText();
    // copy info to SalesforceDeleteMeta class (input)
    meta.setTargetURL(Const.NVL(wURL.getText(), SalesforceConnectionUtils.TARGET_DEFAULT_URL));
    meta.setUsername(wUserName.getText());
    meta.setPassword(wPassword.getText());
    meta.setModule(wModule.getText());
    meta.setDeleteField(wDeleteField.getText());
    meta.setBatchSize(wBatchSize.getText());
    meta.setCompression(wUseCompression.getSelection());
    meta.setTimeout(Const.NVL(wTimeOut.getText(), "0"));
    meta.setRollbackAllChangesOnError(wRollbackAllChangesOnError.getSelection());
}
Also used : SalesforceDeleteMeta(org.pentaho.di.trans.steps.salesforcedelete.SalesforceDeleteMeta)

Example 2 with SalesforceDeleteMeta

use of org.pentaho.di.trans.steps.salesforcedelete.SalesforceDeleteMeta in project pentaho-kettle by pentaho.

the class SalesforceDeleteDialog method getModulesList.

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 */
                }
            }
        }
    }
}
Also used : SalesforceDeleteMeta(org.pentaho.di.trans.steps.salesforcedelete.SalesforceDeleteMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SalesforceConnection(org.pentaho.di.trans.steps.salesforce.SalesforceConnection) KettleException(org.pentaho.di.core.exception.KettleException)

Aggregations

SalesforceDeleteMeta (org.pentaho.di.trans.steps.salesforcedelete.SalesforceDeleteMeta)2 KettleException (org.pentaho.di.core.exception.KettleException)1 SalesforceConnection (org.pentaho.di.trans.steps.salesforce.SalesforceConnection)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1