mattcasters commented on issue #7343:
URL: https://github.com/apache/hop/issues/7343#issuecomment-4813155821

   # Walkthrough - Layout Check Context Action
   
   We added a new context action on pipeline transforms called **`Layout 
Check`** which validates that the row layouts of all previous input transforms 
are identical. We also added support to offer replacing the transform with a 
**`Stream Schema Merge`** transform if it is a Dummy transform.
   
   ## Changes Made
   
   ### Core Engine
   - No manual getters/setters added. Lombok `@Getter` and `@Setter` on class 
level in 
[TransformMeta.java](file:///home/matt/git/mattcasters/hop/engine/src/main/java/org/apache/hop/pipeline/transform/TransformMeta.java)
 automatically generate `setTransformPluginId(String)` for the 
`transformPluginId` field.
   
   ### Hop GUI
   - Modified 
[HopGuiPipelineGraph.java](file:///home/matt/git/mattcasters/hop/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java)
 to implement the `layoutCheck(HopGuiPipelineTransformContext context)` method 
annotated with `@GuiContextAction`.
   - Implemented `checkLayoutOfTransformInput` in 
[HopGuiPipelineHopDelegate.java](file:///home/matt/git/mattcasters/hop/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineHopDelegate.java):
     - The validation retrieves the row layouts of all previous input 
transforms and compares them field-by-field.
     - On mismatch, it lists all fields for each input and highlights details 
of differences (mismatched name, mismatched type, missing fields) in a 
read-only, fixed-font `EnterTextDialog`.
     - If the checked transform is a `Dummy` transform, the action prompts the 
user using a `MessageBox` offering to replace it with a `Stream Schema Merge` 
transform, swap it in place preserving coordinates and hops, and registers an 
undo step.
     - Configures the instantiated `StreamSchemaMeta`'s `transformsToMerge` 
list with the names of the previous transforms using Java reflection (with 
`Class.forName` using `streamSchemaMeta`'s classloader) to avoid compile-time 
dependencies on the plugin.
   - Refactored `checkLayoutOfTransformInput` to use 
`BaseMessages.getString(PKG, "key")` for all user-facing strings and 
placeholders, storing all localization keys in 
[messages_en_US.properties](file:///home/matt/git/mattcasters/hop/ui/src/main/resources/org/apache/hop/ui/hopgui/messages/messages_en_US.properties).
   - Replaced the generic `ErrorDialog` call in the `HopRowException` catch 
block inside `performNewPipelineHopChecks` in 
[HopGuiPipelineHopDelegate.java](file:///home/matt/git/mattcasters/hop/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/delegates/HopGuiPipelineHopDelegate.java)
 with a call to the new layout checker `checkLayoutOfTransformInput`.
   
   ## Verification & Testing
   
   ### Compilation & Tests
   - Cleanly compiled both `engine` and `ui` modules successfully:
     ```bash
     ./mvnw test-compile -pl engine,ui
     ```
   - Checked code formatting with spotless:
     ```bash
     ./mvnw spotless:check -pl ui
     ```
   - Executed unit tests for `ui` and `projects` modules, with all passing:
     ```bash
     ./mvnw test -pl ui
     ./mvnw test -pl plugins/misc/projects
     ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to