blob: 46c80ecf1e62176acc27d14c8632799700661558 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<pipeline>
<info>
<name>0005-udjc-render-all-actions-in-svg</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<pipeline_version/>
<pipeline_type>Normal</pipeline_type>
<parameters>
</parameters>
<capture_transform_performance>N</capture_transform_performance>
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
<created_user>-</created_user>
<created_date>2020/12/18 21:55:25.542</created_date>
<modified_user>-</modified_user>
<modified_date>2020/12/18 21:55:25.542</modified_date>
<key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA=</key_for_session_key>
<is_key_private>N</is_key_private>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>1 row</from>
<to>SVG of all actions</to>
<enabled>Y</enabled>
</hop>
<hop>
<from>SVG of all actions</from>
<to>/tmp/actions.svg</to>
<enabled>N</enabled>
</hop>
</order>
<transform>
<name>/tmp/actions.svg</name>
<type>TextFileOutput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<separator/>
<enclosure/>
<enclosure_forced>N</enclosure_forced>
<enclosure_fix_disabled>N</enclosure_fix_disabled>
<header>N</header>
<footer>N</footer>
<format>UNIX</format>
<compression>None</compression>
<encoding>UTF-8</encoding>
<endedLine/>
<fileNameInField>N</fileNameInField>
<fileNameField/>
<create_parent_folder>Y</create_parent_folder>
<file>
<name>/tmp/actions</name>
<servlet_output>N</servlet_output>
<do_not_open_new_file_init>N</do_not_open_new_file_init>
<extention>svg</extention>
<append>N</append>
<split>N</split>
<haspartno>N</haspartno>
<add_date>N</add_date>
<add_time>N</add_time>
<SpecifyFormat>N</SpecifyFormat>
<date_time_format/>
<add_to_result_filenames>Y</add_to_result_filenames>
<pad>N</pad>
<fast_dump>N</fast_dump>
<splitevery/>
</file>
<fields>
<field>
<name>svg</name>
<type>String</type>
<format/>
<currency/>
<decimal/>
<group/>
<nullif/>
<trim_type>both</trim_type>
<length>-1</length>
<precision>-1</precision>
</field>
</fields>
<attributes/>
<GUI>
<xloc>496</xloc>
<yloc>64</yloc>
</GUI>
</transform>
<transform>
<name>1 row</name>
<type>RowGenerator</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<fields>
</fields>
<limit>1</limit>
<never_ending>N</never_ending>
<interval_in_ms>5000</interval_in_ms>
<row_time_field>now</row_time_field>
<last_time_field>FiveSecondsAgo</last_time_field>
<attributes/>
<GUI>
<xloc>144</xloc>
<yloc>64</yloc>
</GUI>
</transform>
<transform>
<name>SVG of all actions</name>
<type>UserDefinedJavaClass</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<definitions>
<definition>
<class_type>TRANSFORM_CLASS</class_type>
<class_name>WorkflowSvgGenerator</class_name>
<class_source>import org.apache.hop.core.plugins.IPlugin;
import org.apache.hop.core.plugins.PluginRegistry;
import org.apache.hop.core.plugins.ActionPluginType;
import org.apache.hop.workflow.WorkflowMeta;
import org.apache.hop.workflow.action.IAction;
import org.apache.hop.workflow.action.ActionMeta;
import org.apache.hop.workflow.WorkflowSvgPainter;
import java.util.List;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.core.variables.Variables;
public boolean processRow() throws HopException
{
// We expect exactly 1 input row
//
Object[] r = getRow();
PluginRegistry registry = PluginRegistry.getInstance();
List&lt;IPlugin> plugins = registry.getPlugins(ActionPluginType.class);
WorkflowMeta workflowMeta = new WorkflowMeta();
int x = 50;
int y = 50;
for (IPlugin plugin : plugins) {
IAction iAction = (IAction) registry.loadClass( plugin );
ActionMeta actionMeta = new ActionMeta(iAction);
actionMeta.setName(plugin.getName());
actionMeta.setLocation( x, y );
workflowMeta.addAction( actionMeta );
x+=150;
if (x>1600) {
y+=100;
x=50;
}
}
// Now render this pipeline...
//
String svgXml = WorkflowSvgPainter.generateWorkflowSvg( workflowMeta, 1f, Variables.getADefaultVariableSpace() );
// First, get a row from the default input hop
//
Object[] outputRow = createOutputRow(r, data.outputRowMeta.size());
outputRow[0] = svgXml;
putRow(data.outputRowMeta, outputRow);
setOutputDone();
return false;
}</class_source>
</definition>
</definitions>
<fields>
<field>
<field_name>svg</field_name>
<field_type>String</field_type>
<field_length>-1</field_length>
<field_precision>-1</field_precision>
</field>
</fields>
<clear_result_fields>Y</clear_result_fields>
<info_transforms/>
<target_transforms/>
<usage_parameters/>
<attributes/>
<GUI>
<xloc>304</xloc>
<yloc>64</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>