rmannibucau opened a new pull request, #9078: URL: https://github.com/apache/hop/pull/9078
Fixes #9077 ## Problem The MetaInject (ETL Metadata Injection) transform had a single `allowEmptyStreamOnExecution` boolean that only distinguished whether every stream must have data (`false`) or at least one must (`true`). There was **no way to run the injected template pipeline when *all* input streams are empty**, even though templates relying on constant mappings alone are valid. ## Solution Replace the boolean with a three-state `ConditionStreamBehavior` enum: - `ALL_NON_EMPTY` -- run only when every stream has data (legacy `false`/`N`) - `AT_LEAST_ONE_NON_EMPTY` -- run when at least one stream has data (legacy `true`/`Y`) - `ALWAYS` -- **new**: run even when every input stream is empty ## Backward compatibility The old `allow_empty_stream_on_execution` field is removed from *new* serialized metadata (new files carry only `condition_stream_behavior`), but **old files still load and map deterministically**: `Y`/`true` -> `AT_LEAST_ONE_NON_EMPTY`, `N`/`false` -> `ALL_NON_EMPTY`, missing (pre-legacy) -> `ALL_NON_EMPTY`. An explicit `Y` is never confused with a missing tag. This is implemented through a **new, general core mechanism**: the `@OnUnknownDeserializationProperty` annotation, honored by **both** the XML and JSON serializers, lets any annotated metadata class translate a legacy/renamed key into a current field during deserialization. `ReflectionUtil` returns instance-bound `Consumer<UnknownProperty>` callbacks built from `Class.getMethods()`, so: - only **public** annotated methods are discovered (private/protected ignored), - a **public override masks the overridden parent method**, - multiple annotated methods are all invoked, - a method whose signature is not exactly `(UnknownProperty)` fails fast with `IllegalArgumentException`, with the discovery result cached per class. ## UI & docs - The Options-tab checkbox becomes a dropdown of the three modes, with `en`/`fr`/`pt_BR` labels. - User manual documents the new "When to run the resulting pipeline" option. - Dev manual adds a *"Legacy and renamed keys"* section documenting the callback contract. ## Tests - Core: `UnknownDeserializationPropertyTest` (8) -- XML + JSON firing, no-fire for annotated keys, multiple callbacks, override-masking, invalid signature -> `IllegalArgumentException`, non-public exclusion. - `MetaInjectMetaTest` (7) + `MetaInjectTest` (13) -- new-code round-trip, legacy `Y`/`N`, missing -> default, "new writes only enum" check, and the `shouldSkipExecution` gate matrix. ## Verification - `mvn -T1C` metainject clean test: **20 tests, 0 failures** - Core serialization suites green; RAT + Spotless clean - No javadoc/doclint issues in the new code (the single core javadoc error is a pre-existing, unrelated `ConfigFile.java:54`) -- 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]
