Search in sources :

Example 1 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class BaseStreamingDialog method loadFileTrans.

private void loadFileTrans(String fname) throws KettleException {
    executorTransMeta = new TransMeta(transMeta.environmentSubstitute(fname), repository);
    executorTransMeta.clearChanged();
    specificationMethod = ObjectLocationSpecificationMethod.FILENAME;
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta)

Example 2 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class BaseStreamingDialog method createSubTransMeta.

protected TransMeta createSubTransMeta() {
    RecordsFromStreamMeta rm = new RecordsFromStreamMeta();
    String[] fieldNames = getFieldNames();
    int[] empty = new int[fieldNames.length];
    Arrays.fill(empty, -1);
    rm.setFieldname(fieldNames);
    rm.setType(getFieldTypes());
    rm.setLength(empty);
    rm.setPrecision(empty);
    StepMeta recsFromStream = new StepMeta("RecordsFromStream", "Get records from stream", rm);
    recsFromStream.setLocation(new Point(100, 100));
    recsFromStream.setDraw(true);
    TransMeta transMeta = new TransMeta();
    transMeta.addStep(recsFromStream);
    transMeta.setFilename("");
    return transMeta;
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) RecordsFromStreamMeta(org.pentaho.di.trans.steps.recordsfromstream.RecordsFromStreamMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) BaseStreamStepMeta(org.pentaho.di.trans.streaming.common.BaseStreamStepMeta)

Example 3 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class BaseStreamingDialog method createNewSubtrans.

protected void createNewSubtrans() {
    TransMeta newSubTransMeta = createSubTransMeta();
    boolean saved = false;
    String path = null;
    if (spoonInstance.getRepository() != null) {
        try {
            saved = spoonInstance.saveToRepository(newSubTransMeta);
            path = getRepositoryRelativePath(newSubTransMeta.getPathAndName());
        } catch (KettleException e) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Title"), BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Message"), e);
        }
    } else {
        saved = spoonInstance.saveXMLFile(newSubTransMeta, false);
        if (saved) {
            try {
                path = getRelativePath(KettleVFS.getFileObject(newSubTransMeta.getFilename()).toString());
            } catch (KettleFileException e) {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Title"), BaseMessages.getString(PKG, "BaseStreamingDialog.File.Save.Fail.Message"), e);
            }
        }
    }
    if (saved && null != path) {
        wTransPath.setText(path);
        createSubtrans(newSubTransMeta);
        if (props.showNewSubtransPopup()) {
            NewSubtransDialog newSubtransDialog = new NewSubtransDialog(shell, SWT.NONE);
            props.setShowNewSubtransPopup(!newSubtransDialog.open());
        }
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) TransMeta(org.pentaho.di.trans.TransMeta) NewSubtransDialog(org.pentaho.di.ui.spoon.dialog.NewSubtransDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog)

Example 4 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class SimpleMappingDialog method loadFileTrans.

private void loadFileTrans(String fname) throws KettleException {
    mappingTransMeta = new TransMeta(transMeta.environmentSubstitute(fname));
    mappingTransMeta.clearChanged();
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta)

Example 5 with TransMeta

use of org.pentaho.di.trans.TransMeta in project pentaho-kettle by pentaho.

the class XBaseInputDialog method preview.

// Preview the data
private void preview() {
    // Create the XML input step
    try {
        XBaseInputMeta oneMeta = new XBaseInputMeta();
        getInfo(oneMeta);
        if (oneMeta.isAcceptingFilenames()) {
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
            mb.setMessage(BaseMessages.getString(PKG, "XBaseInputDialog.Dialog.SpecifyASampleFile.Message"));
            mb.setText(BaseMessages.getString(PKG, "XBaseInputDialog.Dialog.SpecifyASampleFile.Title"));
            mb.open();
            return;
        }
        TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
        EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "XBaseInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "XBaseInputDialog.PreviewSize.DialogMessage"));
        int previewSize = numberDialog.open();
        if (previewSize > 0) {
            TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
            progressDialog.open();
            Trans trans = progressDialog.getTrans();
            String loggingText = progressDialog.getLoggingText();
            if (!progressDialog.isCancelled()) {
                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 (Exception e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), e);
    }
}
Also used : XBaseInputMeta(org.pentaho.di.trans.steps.xbaseinput.XBaseInputMeta) 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) KettleStepException(org.pentaho.di.core.exception.KettleStepException) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

TransMeta (org.pentaho.di.trans.TransMeta)710 Test (org.junit.Test)289 StepMeta (org.pentaho.di.trans.step.StepMeta)234 Trans (org.pentaho.di.trans.Trans)214 KettleException (org.pentaho.di.core.exception.KettleException)150 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)136 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)117 TransHopMeta (org.pentaho.di.trans.TransHopMeta)115 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)109 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)106 StepInterface (org.pentaho.di.trans.step.StepInterface)76 RowStepCollector (org.pentaho.di.trans.RowStepCollector)73 JobMeta (org.pentaho.di.job.JobMeta)69 ArrayList (java.util.ArrayList)57 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)54 PreviewRowsDialog (org.pentaho.di.ui.core.dialog.PreviewRowsDialog)51 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)50 InjectorMeta (org.pentaho.di.trans.steps.injector.InjectorMeta)49 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)49 TransPreviewProgressDialog (org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog)49