This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new f602d5ff1d Add a variable resolver sample to the repository, fixes 
#6036 (#6037)
f602d5ff1d is described below

commit f602d5ff1da7847cce66daf0779dfc55ed009db8
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Wed Nov 19 13:36:18 2025 +0100

    Add a variable resolver sample to the repository, fixes #6036 (#6037)
    
    * Add a variable resolver sample to the repository, fixes #6036
    
    * Add missing headers
---
 .../resolvers/pipeline/src/assembly/assembly.xml   |   8 ++
 .../metadata/variable-resolver/sampleResolver.json |  13 ++
 .../sample_pipeline_resolver.hpl                   | 136 +++++++++++++++++++++
 .../sample_pipeline_resolver_usage.hpl             | 122 ++++++++++++++++++
 4 files changed, 279 insertions(+)

diff --git a/plugins/resolvers/pipeline/src/assembly/assembly.xml 
b/plugins/resolvers/pipeline/src/assembly/assembly.xml
index 87db33cc09..56e1ae3ace 100644
--- a/plugins/resolvers/pipeline/src/assembly/assembly.xml
+++ b/plugins/resolvers/pipeline/src/assembly/assembly.xml
@@ -31,6 +31,14 @@
             <filtered>true</filtered>
         </file>
     </files>
+
+    <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/src/main/samples</directory>
+            <outputDirectory>config/projects/samples/</outputDirectory>
+        </fileSet>
+    </fileSets>
+
     <dependencySets>
         <dependencySet>
             <includes>
diff --git 
a/plugins/resolvers/pipeline/src/main/samples/metadata/variable-resolver/sampleResolver.json
 
b/plugins/resolvers/pipeline/src/main/samples/metadata/variable-resolver/sampleResolver.json
new file mode 100644
index 0000000000..fdcac6c37a
--- /dev/null
+++ 
b/plugins/resolvers/pipeline/src/main/samples/metadata/variable-resolver/sampleResolver.json
@@ -0,0 +1,13 @@
+{
+  "virtualPath": "",
+  "name": "sampleResolver",
+  "description": "",
+  "variable-resolver": {
+    "Variable-Resolver-Pipeline": {
+      "outputTransformName": "OUTPUT",
+      "filename": 
"${PROJECT_HOME}/variable_resolvers/sample_pipeline_resolver.hpl",
+      "expressionVariableName": "VARIABLE_TO_RESOLVE",
+      "runConfigurationName": "local"
+    }
+  }
+}
\ No newline at end of file
diff --git 
a/plugins/resolvers/pipeline/src/main/samples/variable_resolvers/sample_pipeline_resolver.hpl
 
b/plugins/resolvers/pipeline/src/main/samples/variable_resolvers/sample_pipeline_resolver.hpl
new file mode 100644
index 0000000000..f182342e0e
--- /dev/null
+++ 
b/plugins/resolvers/pipeline/src/main/samples/variable_resolvers/sample_pipeline_resolver.hpl
@@ -0,0 +1,136 @@
+<?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>sample_pipeline_resolver</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>2025/11/19 10:31:02.939</created_date>
+    <modified_user>-</modified_user>
+    <modified_date>2025/11/19 10:31:02.939</modified_date>
+  </info>
+  <notepads>
+  </notepads>
+  <order>
+    <hop>
+      <from>Get variables</from>
+      <to>Calculator</to>
+      <enabled>Y</enabled>
+    </hop>
+    <hop>
+      <from>Calculator</from>
+      <to>OUTPUT</to>
+      <enabled>Y</enabled>
+    </hop>
+  </order>
+  <transform>
+    <name>Calculator</name>
+    <type>Calculator</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <calculation>
+      <calc_type>CONSTANT</calc_type>
+      <field_a>5</field_a>
+      <field_name>C_5</field_name>
+      <remove>N</remove>
+      <value_length>-1</value_length>
+      <value_precision>-1</value_precision>
+      <value_type>Integer</value_type>
+    </calculation>
+    <calculation>
+      <calc_type>ADD</calc_type>
+      <field_a>input_value</field_a>
+      <field_b>C_5</field_b>
+      <field_name>output_value</field_name>
+      <remove>N</remove>
+      <value_length>-1</value_length>
+      <value_precision>-1</value_precision>
+      <value_type>Integer</value_type>
+    </calculation>
+    <failIfNoFile>Y</failIfNoFile>
+    <attributes/>
+    <GUI>
+      <xloc>384</xloc>
+      <yloc>144</yloc>
+    </GUI>
+  </transform>
+  <transform>
+    <name>Get variables</name>
+    <type>GetVariable</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <fields>
+      <field>
+        <length>-1</length>
+        <name>input_value</name>
+        <precision>-1</precision>
+        <trim_type>none</trim_type>
+        <type>Integer</type>
+        <variable>${VARIABLE_TO_RESOLVE}</variable>
+      </field>
+    </fields>
+    <attributes/>
+    <GUI>
+      <xloc>208</xloc>
+      <yloc>144</yloc>
+    </GUI>
+  </transform>
+  <transform>
+    <name>OUTPUT</name>
+    <type>Dummy</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <attributes/>
+    <GUI>
+      <xloc>544</xloc>
+      <yloc>144</yloc>
+    </GUI>
+  </transform>
+  <transform_error_handling>
+  </transform_error_handling>
+  <attributes/>
+</pipeline>
diff --git 
a/plugins/resolvers/pipeline/src/main/samples/variable_resolvers/sample_pipeline_resolver_usage.hpl
 
b/plugins/resolvers/pipeline/src/main/samples/variable_resolvers/sample_pipeline_resolver_usage.hpl
new file mode 100644
index 0000000000..8211989fab
--- /dev/null
+++ 
b/plugins/resolvers/pipeline/src/main/samples/variable_resolvers/sample_pipeline_resolver_usage.hpl
@@ -0,0 +1,122 @@
+<?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>sample_pipeline_resolver_usage</name>
+    <name_sync_with_filename>Y</name_sync_with_filename>
+    <description/>
+    <extended_description/>
+    <pipeline_version/>
+    <pipeline_type>Normal</pipeline_type>
+    <pipeline_status>0</pipeline_status>
+    <parameters>
+      <parameter>
+        <name>INPUT_NUMBER</name>
+        <default_value>100</default_value>
+        <description/>
+      </parameter>
+    </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>2025/11/19 10:31:59.653</created_date>
+    <modified_user>-</modified_user>
+    <modified_date>2025/11/19 10:31:59.653</modified_date>
+  </info>
+  <notepads>
+    <notepad>
+      <backgroundcolorblue>251</backgroundcolorblue>
+      <backgroundcolorgreen>232</backgroundcolorgreen>
+      <backgroundcolorred>201</backgroundcolorred>
+      <bordercolorblue>90</bordercolorblue>
+      <bordercolorgreen>58</bordercolorgreen>
+      <bordercolorred>14</bordercolorred>
+      <fontbold>N</fontbold>
+      <fontcolorblue>90</fontcolorblue>
+      <fontcolorgreen>58</fontcolorgreen>
+      <fontcolorred>14</fontcolorred>
+      <fontitalic>N</fontitalic>
+      <fontname>.AppleSystemUIFont</fontname>
+      <fontsize>13</fontsize>
+      <height>154</height>
+      <xloc>144</xloc>
+      <yloc>16</yloc>
+      <note>This Sample uses the sample_pipeline_resolver.hpl to add 5 to a 
given number.
+
+The syntax is: #{sampleResolver:&lt;NUMBER>:output_value}
+
+The first part sampleResolver is the name of the resolver to use.
+The second part is the value given to the resolving pipeline
+The third part is the output field from the resolving pipeline
+
+It is possible to combine variable resolvers or use parameters using the 
${MY_PARAMETER} syntax inside the variable</note>
+      <width>721</width>
+    </notepad>
+  </notepads>
+  <order>
+  </order>
+  <transform>
+    <name>Get some numbers</name>
+    <type>GetVariable</type>
+    <description/>
+    <distribute>Y</distribute>
+    <custom_distribution/>
+    <copies>1</copies>
+    <partitioning>
+      <method>none</method>
+      <schema_name/>
+    </partitioning>
+    <fields>
+      <field>
+        <length>-1</length>
+        <name>add_5_to_5</name>
+        <precision>-1</precision>
+        <trim_type>none</trim_type>
+        <type>Integer</type>
+        <variable>#{sampleResolver:5:output_value}</variable>
+      </field>
+      <field>
+        <length>-1</length>
+        <name>add_5_to_10</name>
+        <precision>-1</precision>
+        <trim_type>none</trim_type>
+        <type>Integer</type>
+        <variable>#{sampleResolver:10:output_value}</variable>
+      </field>
+      <field>
+        <length>-1</length>
+        <name>add_5_to_variable</name>
+        <precision>-1</precision>
+        <trim_type>none</trim_type>
+        <type>Integer</type>
+        <variable>#{sampleResolver:${INPUT_NUMBER}:output_value}</variable>
+      </field>
+    </fields>
+    <attributes/>
+    <GUI>
+      <xloc>320</xloc>
+      <yloc>208</yloc>
+    </GUI>
+  </transform>
+  <transform_error_handling>
+  </transform_error_handling>
+  <attributes/>
+</pipeline>

Reply via email to