Skip to content

fix: fix use of EntityMatch and condition for multiple candidates#1497

Merged
stempler merged 1 commit intomasterfrom
ING-5131
Apr 23, 2026
Merged

fix: fix use of EntityMatch and condition for multiple candidates#1497
stempler merged 1 commit intomasterfrom
ING-5131

Conversation

@stempler
Copy link
Copy Markdown
Member

  • DefaultSchemaMigration.entityReplacement now returns Optional (return type was mismatched with interface despite @CompileStatic due to Groovy generic erasure; would ClassCast at runtime on any call site using .map(EntityMatch::getMatch))
  • UnmigratedCell returns Optional.empty() when lookup misses, rather than wrapping a null match inside EntityMatch.of()
  • AbstractMergeCellMigrator: fix two multipleCandidates flags that used size() > 0 (always true) instead of size() > 1
  • minor fixes

ING-5131

- DefaultSchemaMigration.entityReplacement now returns Optional<EntityMatch>
  (return type was mismatched with interface despite @CompileStatic due to
  Groovy generic erasure; would ClassCast at runtime on any call site using
  .map(EntityMatch::getMatch))
- UnmigratedCell returns Optional.empty() when lookup misses, rather than
  wrapping a null match inside EntityMatch.of()
- AbstractMergeCellMigrator: fix two multipleCandidates flags that used
  size() > 0 (always true) instead of size() > 1
- minor fixes

ING-5131
@stempler stempler requested a review from Copilot April 22, 2026 15:06
@github-actions
Copy link
Copy Markdown

This PR cannot be merged yet because a required label is missing: challenged, renovate/patch, renovate/minor. It needs to be added before this PR can be merged.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes alignment migration entity replacement handling by consistently returning Optional<EntityMatch> and correcting join-context migration logic so multi-candidate/join flags are computed correctly. This addresses a runtime ClassCast risk and improves behavior when no replacement exists.

Changes:

  • Update DefaultSchemaMigration and UnmigratedCell to return Optional<EntityMatch> correctly (and return Optional.empty() on lookup misses).
  • Fix incorrect “multiple candidates/sources” conditions in AbstractMergeCellMigrator (size() > 0size() > 1) and clean up related variable naming.
  • Minor log/message escaping and test comment corrections.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
common/plugins/eu.esdihumboldt.hale.common.filter/src/eu/esdihumboldt/hale/common/filter/internal/EntityReplacementVisitor.java Javadoc correction for mismatch detection helper.
common/plugins/eu.esdihumboldt.hale.common.filter/src/eu/esdihumboldt/hale/common/filter/AbstractGeotoolsFilter.java Escape apostrophes for MessageFormat-formatted SimpleLog messages.
common/plugins/eu.esdihumboldt.hale.common.align/src/eu/esdihumboldt/hale/common/align/migrate/impl/UnmigratedCell.java Return Optional.empty() when no mapping exists; wrap mappings via EntityMatch.of.
common/plugins/eu.esdihumboldt.hale.common.align.merge/src/eu/esdihumboldt/hale/common/align/merge/impl/DefaultSchemaMigration.groovy Align return type with AlignmentMigration (Optional<EntityMatch>) and avoid null matches.
common/plugins/eu.esdihumboldt.hale.common.align.merge/src/eu/esdihumboldt/hale/common/align/merge/impl/AbstractMigration.groovy Log message updated to print the matched entity (EntityMatch.match).
common/plugins/eu.esdihumboldt.hale.common.align.merge/src/eu/esdihumboldt/hale/common/align/merge/impl/AbstractMergeCellMigrator.java Correct multi-candidate/source conditions and rename transferedSourcetransferredSource.
common/plugins/eu.esdihumboldt.hale.common.align.merge.test/src/eu/esdihumboldt/hale/common/align/merge/test/impl/JoinRetainConditionsTest.groovy Update comments to match expected propagation target.
common/plugins/eu.esdihumboldt.hale.common.align.merge.test/src/eu/esdihumboldt/hale/common/align/merge/test/impl/DefaultMergeCellMigratorTest.groovy Update comment to reflect expected absence of a condition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

hale studio builds for this pull request:

Build triggered for commit 7e789ba.
Artifacts are retained for 14 days.

@stempler stempler merged commit ca15523 into master Apr 23, 2026
16 of 18 checks passed
@stempler stempler deleted the ING-5131 branch April 23, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants