Search in sources :

Example 1 with HopPipelineFileType

use of org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType 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)

Example 2 with HopPipelineFileType

use of org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType in project hop by apache.

the class PipelineProbeEditor 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 Data Probe transform...
        // 
        PipelineDataProbeMeta pipelineDataProbeMeta = new PipelineDataProbeMeta();
        pipelineDataProbeMeta.setLoggingTransforms(true);
        TransformMeta pipelineLogging = new TransformMeta("Pipeline Data Probe", pipelineDataProbeMeta);
        pipelineLogging.setLocation(200, 150);
        pipelineMeta.addTransform(pipelineLogging);
        // Add a dummy
        // 
        DummyMeta dummyMeta = new DummyMeta();
        TransformMeta dummy = new TransformMeta("Process values 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 : PipelineDataProbeMeta(org.apache.hop.reflection.probe.transform.PipelineDataProbeMeta) 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) HopPipelineFileType(org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType) PipelineMeta(org.apache.hop.pipeline.PipelineMeta)

Example 3 with HopPipelineFileType

use of org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType in project hop by apache.

the class HopGuiWorkflowHplFilenamePastedExtensionPoint method callExtensionPoint.

@Override
public void callExtensionPoint(ILogChannel log, IVariables variables, HopGuiWorkflowClipboardExtension wce) throws HopException {
    HopGuiWorkflowClipboardDelegate clipboardDelegate = wce.workflowGraph.workflowClipboardDelegate;
    WorkflowMeta workflowMeta = wce.workflowMeta;
    HopGui hopGui = wce.workflowGraph.getHopGui();
    // Pipeline?
    // 
    HopPipelineFileType pipelineFileType = new HopPipelineFileType();
    if (wce.filename.endsWith(pipelineFileType.getDefaultFileExtension())) {
        // Add a new Pipeline action...
        // 
        String name = clipboardDelegate.getUniqueName(workflowMeta, wce.file.getName());
        ActionPipeline actionPipeline = new ActionPipeline(name);
        actionPipeline.setFileName(wce.filename);
        // Pick the first run configuration available...
        // 
        List<String> names = hopGui.getMetadataProvider().getSerializer(PipelineRunConfiguration.class).listObjectNames();
        if (!names.isEmpty()) {
            actionPipeline.setRunConfiguration(names.get(0));
        }
        ActionMeta actionMeta = new ActionMeta(actionPipeline);
        actionMeta.setLocation(new Point(wce.location));
        workflowMeta.addAction(actionMeta);
        hopGui.undoDelegate.addUndoNew(workflowMeta, new ActionMeta[] { actionMeta }, new int[] { workflowMeta.indexOfAction(actionMeta) });
        // Shift the location for the next action
        // 
        clipboardDelegate.shiftLocation(wce.location);
    }
}
Also used : HopGuiWorkflowClipboardDelegate(org.apache.hop.ui.hopgui.file.workflow.delegates.HopGuiWorkflowClipboardDelegate) ActionMeta(org.apache.hop.workflow.action.ActionMeta) PipelineRunConfiguration(org.apache.hop.pipeline.config.PipelineRunConfiguration) ExtensionPoint(org.apache.hop.core.extension.ExtensionPoint) IExtensionPoint(org.apache.hop.core.extension.IExtensionPoint) Point(org.apache.hop.core.gui.Point) HopPipelineFileType(org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta) HopGui(org.apache.hop.ui.hopgui.HopGui)

Example 4 with HopPipelineFileType

use of org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType in project hop by apache.

the class WebServiceEditor method createPipelineFile.

/**
 * Create a new pipeline file with a note to explain what's going on
 *
 * @param parent
 */
private void createPipelineFile(Composite parent) {
    try {
        // Create an empty pipeline...
        // 
        PipelineMeta pipelineMeta = new PipelineMeta();
        // Add a note explaining what's going on.
        // 
        NotePadMeta note = new NotePadMeta("This pipeline can create output for a web service." + Const.CR + "It will pick up the data in a single field in a single transform of this pipeline", 150, 350, -1, -1);
        pipelineMeta.addNote(note);
        // 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 : HopDataOrchestrationPerspective(org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) NotePadMeta(org.apache.hop.core.NotePadMeta) HopPipelineFileType(org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType) PipelineMeta(org.apache.hop.pipeline.PipelineMeta)

Example 5 with HopPipelineFileType

use of org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType in project hop by apache.

the class RepeatDialog method browseForFile.

private void browseForFile() {
    HopPipelineFileType pipelineFileType = new HopPipelineFileType<>();
    HopWorkflowFileType workflowFileType = new HopWorkflowFileType<>();
    List<String> filterExtensions = new ArrayList<>();
    filterExtensions.add(pipelineFileType.getFilterExtensions()[0] + ";" + workflowFileType.getFilterExtensions()[0]);
    filterExtensions.addAll(Arrays.asList(pipelineFileType.getFilterExtensions()));
    filterExtensions.addAll(Arrays.asList(workflowFileType.getFilterExtensions()));
    filterExtensions.add("*.*");
    List<String> filterNames = new ArrayList<>();
    filterNames.add(pipelineFileType.getFilterNames()[0] + " and " + workflowFileType.getFilterNames()[0]);
    filterNames.addAll(Arrays.asList(pipelineFileType.getFilterNames()));
    filterNames.addAll(Arrays.asList(workflowFileType.getFilterNames()));
    filterNames.add(BaseMessages.getString(PKG, "System.FileType.AllFiles"));
    BaseDialog.presentFileDialog(shell, wFilename, variables, filterExtensions.toArray(new String[0]), filterNames.toArray(new String[0]), true);
}
Also used : HopWorkflowFileType(org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType) ArrayList(java.util.ArrayList) HopPipelineFileType(org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType)

Aggregations

HopPipelineFileType (org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType)9 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)6 PipelineMeta (org.apache.hop.pipeline.PipelineMeta)5 HopDataOrchestrationPerspective (org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective)5 PipelineHopMeta (org.apache.hop.pipeline.PipelineHopMeta)3 TransformMeta (org.apache.hop.pipeline.transform.TransformMeta)3 DummyMeta (org.apache.hop.pipeline.transforms.dummy.DummyMeta)3 HopException (org.apache.hop.core.exception.HopException)2 Point (org.apache.hop.core.gui.Point)2 ArrayList (java.util.ArrayList)1 NotePadMeta (org.apache.hop.core.NotePadMeta)1 ExtensionPoint (org.apache.hop.core.extension.ExtensionPoint)1 IExtensionPoint (org.apache.hop.core.extension.IExtensionPoint)1 PipelineRunConfiguration (org.apache.hop.pipeline.config.PipelineRunConfiguration)1 PipelineLoggingMeta (org.apache.hop.reflection.pipeline.transform.PipelineLoggingMeta)1 PipelineDataProbeMeta (org.apache.hop.reflection.probe.transform.PipelineDataProbeMeta)1 WorkflowLoggingMeta (org.apache.hop.reflection.workflow.transform.WorkflowLoggingMeta)1 TextVar (org.apache.hop.ui.core.widget.TextVar)1 HopGui (org.apache.hop.ui.hopgui.HopGui)1 HopWorkflowFileType (org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType)1