Search in sources :

Example 1 with HopWorkflowFileType

use of org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType in project hop by apache.

the class AsyncWebServiceEditor method createWorkflowFile.

/**
 * Create a new workflow file with a note to explain what's going on
 *
 * @param parent
 */
private void createWorkflowFile(Composite parent) {
    try {
        // Create an empty workflow...
        // 
        WorkflowMeta workflowMeta = new WorkflowMeta();
        // Add a note explaining what's going on.
        // 
        NotePadMeta note = new NotePadMeta("This workflow can set status variables which are picked up when you request the status of this workflow." + Const.CR + "You can use service asyncStatus to query the status.", 150, 350, -1, -1);
        workflowMeta.addNote(note);
        // Save it...
        // 
        HopWorkflowFileType<WorkflowMeta> type = new HopWorkflowFileType<>();
        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);
            workflowMeta.setFilename(realFilename);
            workflowMeta.clearChanged();
            HopDataOrchestrationPerspective perspective = HopGui.getDataOrchestrationPerspective();
            // Switch to the perspective
            // 
            perspective.activate();
            // Open it in the Hop GUI
            // 
            HopGui.getDataOrchestrationPerspective().addWorkflow(hopGui, workflowMeta, type);
            // Save the file
            hopGui.fileDelegate.fileSave();
        }
    } catch (Exception e) {
        new ErrorDialog(parent.getShell(), "Error", "Error creating workflow", e);
    }
}
Also used : HopDataOrchestrationPerspective(org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective) HopWorkflowFileType(org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) NotePadMeta(org.apache.hop.core.NotePadMeta) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta)

Example 2 with HopWorkflowFileType

use of org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType in project hop by apache.

the class HopGuiWorkflowHwfFilenamePastedExtensionPoint 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();
    // Workflow?
    // 
    HopWorkflowFileType workflowFileType = new HopWorkflowFileType<>();
    if (wce.filename.endsWith(workflowFileType.getDefaultFileExtension())) {
        // Add a new Workflow action...
        // 
        String name = clipboardDelegate.getUniqueName(workflowMeta, wce.file.getName());
        ActionWorkflow actionWorkflow = new ActionWorkflow(name);
        actionWorkflow.setFileName(wce.filename);
        // Pick the first run configuration available...
        // 
        List<String> names = hopGui.getMetadataProvider().getSerializer(WorkflowRunConfiguration.class).listObjectNames();
        if (!names.isEmpty()) {
            actionWorkflow.setRunConfiguration(names.get(0));
        }
        ActionMeta actionMeta = new ActionMeta(actionWorkflow);
        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) WorkflowRunConfiguration(org.apache.hop.workflow.config.WorkflowRunConfiguration) ActionMeta(org.apache.hop.workflow.action.ActionMeta) HopWorkflowFileType(org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType) ExtensionPoint(org.apache.hop.core.extension.ExtensionPoint) IExtensionPoint(org.apache.hop.core.extension.IExtensionPoint) Point(org.apache.hop.core.gui.Point) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta) HopGui(org.apache.hop.ui.hopgui.HopGui)

Example 3 with HopWorkflowFileType

use of org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType 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

HopWorkflowFileType (org.apache.hop.ui.hopgui.file.workflow.HopWorkflowFileType)3 WorkflowMeta (org.apache.hop.workflow.WorkflowMeta)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 Point (org.apache.hop.core.gui.Point)1 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)1 HopGui (org.apache.hop.ui.hopgui.HopGui)1 HopPipelineFileType (org.apache.hop.ui.hopgui.file.pipeline.HopPipelineFileType)1 HopGuiWorkflowClipboardDelegate (org.apache.hop.ui.hopgui.file.workflow.delegates.HopGuiWorkflowClipboardDelegate)1 HopDataOrchestrationPerspective (org.apache.hop.ui.hopgui.perspective.dataorch.HopDataOrchestrationPerspective)1 ActionMeta (org.apache.hop.workflow.action.ActionMeta)1 WorkflowRunConfiguration (org.apache.hop.workflow.config.WorkflowRunConfiguration)1