Search in sources :

Example 1 with PipelineLoggingMeta

use of org.apache.hop.reflection.pipeline.transform.PipelineLoggingMeta in project hop by apache.

the class PipelineLogEditor method createPipelineFile.

/**
 * Create a new pipeline file: ask the user for a name. Add a standard transform and a dummy to
 * show how it works.
 *
 * @param parent
 */
private void createPipelineFile(Composite parent) {
    try {
        PipelineMeta pipelineMeta = new PipelineMeta();
        // Add a Pipeline Logging transform...
        // 
        PipelineLoggingMeta pipelineLoggingMeta = new PipelineLoggingMeta();
        pipelineLoggingMeta.setLoggingTransforms(true);
        TransformMeta pipelineLogging = new TransformMeta("Pipeline Logging", pipelineLoggingMeta);
        pipelineLogging.setLocation(200, 150);
        pipelineMeta.addTransform(pipelineLogging);
        // Add a dummy
        // 
        DummyMeta dummyMeta = new DummyMeta();
        TransformMeta dummy = new TransformMeta("Save logging here", dummyMeta);
        dummy.setLocation(500, 150);
        pipelineMeta.addTransform(dummy);
        // Add a hop between both transforms...
        // 
        pipelineMeta.addPipelineHop(new PipelineHopMeta(pipelineLogging, dummy));
        // Save it...
        // 
        HopPipelineFileType<PipelineMeta> type = new HopPipelineFileType<>();
        String filename = BaseDialog.presentFileDialog(// save
        true, parent.getShell(), wFilename, manager.getVariables(), type.getFilterExtensions(), type.getFilterNames(), true);
        if (filename != null) {
            // User specified a pipeline filename
            // 
            String realFilename = manager.getVariables().resolve(filename);
            pipelineMeta.setFilename(realFilename);
            pipelineMeta.clearChanged();
            HopDataOrchestrationPerspective perspective = HopGui.getDataOrchestrationPerspective();
            // Switch to the perspective
            // 
            perspective.activate();
            // Open it in the Hop GUI
            // 
            HopGui.getDataOrchestrationPerspective().addPipeline(hopGui, pipelineMeta, type);
            // Save the file
            hopGui.fileDelegate.fileSave();
        }
    } catch (Exception e) {
        new ErrorDialog(parent.getShell(), "Error", "Error creating pipeline", e);
    }
}
Also used : DummyMeta(org.apache.hop.pipeline.transforms.dummy.DummyMeta) HopDataOrchestrationPerspective(org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective) TransformMeta(org.apache.hop.pipeline.transform.TransformMeta) PipelineHopMeta(org.apache.hop.pipeline.PipelineHopMeta) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) PipelineLoggingMeta(org.apache.hop.reflection.pipeline.transform.PipelineLoggingMeta) HopPipelineFileType(org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType) PipelineMeta(org.apache.hop.pipeline.PipelineMeta)

Aggregations

PipelineHopMeta (org.apache.hop.pipeline.PipelineHopMeta)1 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)1 TransformMeta (org.apache.hop.pipeline.transform.TransformMeta)1 DummyMeta (org.apache.hop.pipeline.transforms.dummy.DummyMeta)1 PipelineLoggingMeta (org.apache.hop.reflection.pipeline.transform.PipelineLoggingMeta)1 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)1 HopPipelineFileType (org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType)1 HopDataOrchestrationPerspective (org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective)1