Search in sources :

Example 1 with RssInputMeta

use of org.pentaho.di.trans.steps.rssinput.RssInputMeta in project pentaho-kettle by pentaho.

the class RssInputDialog method preview.

// Preview the data
private void preview() {
    try {
        // Create the XML input step
        RssInputMeta oneMeta = new RssInputMeta();
        getInfo(oneMeta);
        // check if the path is given
        // if (!checkLoopXPath(oneMeta)) return;
        TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
        EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "getXMLDataDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "getXMLDataDialog.NumberRows.DialogMessage"));
        int previewSize = numberDialog.open();
        if (previewSize > 0) {
            TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
            progressDialog.open();
            if (!progressDialog.isCancelled()) {
                Trans trans = progressDialog.getTrans();
                String loggingText = progressDialog.getLoggingText();
                if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
                    EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
                    etd.setReadOnly();
                    etd.open();
                }
                PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
                prd.open();
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RssInputDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "RssInputDialog.ErrorPreviewingData.DialogMessage"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RssInputMeta(org.pentaho.di.trans.steps.rssinput.RssInputMeta) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) Trans(org.pentaho.di.trans.Trans)

Example 2 with RssInputMeta

use of org.pentaho.di.trans.steps.rssinput.RssInputMeta in project pentaho-kettle by pentaho.

the class RssInputDialog method get.

private void get() {
    try {
        RssInputMeta meta = new RssInputMeta();
        getInfo(meta);
        // Check for URL
        if (!checkInputURL(meta)) {
            return;
        }
        // Clear Fields Grid
        wFields.removeAll();
        wFields.add(new String[] { RssInputField.getColumnDesc(0), RssInputField.getColumnDesc(0), "String", "", "", "", "", "", "", "N" });
        wFields.add(new String[] { RssInputField.getColumnDesc(1), RssInputField.getColumnDesc(1), "String", "", "", "", "", "", "", "N" });
        wFields.add(new String[] { RssInputField.getColumnDesc(2), RssInputField.getColumnDesc(2), "String", "", "", "", "", "", "", "N" });
        wFields.add(new String[] { RssInputField.getColumnDesc(3), RssInputField.getColumnDesc(3), "String", "", "", "", "", "", "", "N" });
        wFields.add(new String[] { RssInputField.getColumnDesc(4), RssInputField.getColumnDesc(4), "String", "", "", "", "", "", "", "N" });
        wFields.add(new String[] { RssInputField.getColumnDesc(5), RssInputField.getColumnDesc(5), "String", "", "", "", "", "", "", "N" });
        wFields.add(new String[] { RssInputField.getColumnDesc(6), RssInputField.getColumnDesc(6), "String", "", "", "", "", "", "", "N" });
        wFields.removeEmptyRows();
        wFields.setRowNums();
        wFields.optWidth(true);
    } catch (Exception e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RssInputDialog.ErrorGettingFields.DialogTitle"), BaseMessages.getString(PKG, "getXMLDataDialog.ErrorGettingFields.DialogMessage"), e);
    }
}
Also used : RssInputMeta(org.pentaho.di.trans.steps.rssinput.RssInputMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) KettleException(org.pentaho.di.core.exception.KettleException)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)2 RssInputMeta (org.pentaho.di.trans.steps.rssinput.RssInputMeta)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 Trans (org.pentaho.di.trans.Trans)1 TransMeta (org.pentaho.di.trans.TransMeta)1 EnterNumberDialog (org.pentaho.di.ui.core.dialog.EnterNumberDialog)1 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)1 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)1 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)1