Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
Fixed Copy and Move attachments failures when custom properties with specific types (date/codelist) are attached to documents. The root cause was improper handling of CDS association fields - for codelist properties, both the foreign key field (e.g., customProperty1_code) and its association (customProperty1) were being included, causing "Invalid CQN: Unexpected value for association" errors during Move operations. Similarly, Copy operations failed with date properties due to missing type conversion from Long timestamps to Instant.
The fix adds association filtering in DBQuery.getValidSecondaryPropertiesWithEntity(matching the existing pattern in copyAttachments, adds an association check in processSecondaryProperty to skip association fields during Move, and implements convertCustomPropertyValue() for proper type conversion during Copy operations.
Type of change
Please delete options that are not relevant.
Checklist before requesting a review
Upload Screenshots/lists of the scenarios tested
Single tenant integration test - https://github.com/cap-java/sdm/actions/runs/21602612041
Multi-tenant integration test - https://github.com/cap-java/sdm/actions/runs/21602884174
List of scenarios tested:
Copy attachment having custom properties of type Integer, Boolean, Drop-down codelist & Date type from nested entity to root entity.
Copy attachment having custom properties of type Integer, Boolean, Drop-down codelist & Date type from a root entity to another root entity.
Move attachment having custom properties of type Integer, Boolean, Drop-down codelist & Date type from nested entity to root entity.
Move attachment having custom properties of type Integer, Boolean, Drop-down codelist & Date type from a root entity to another root entity.