Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ private void validateMetadata(List<HpcMetadataEntry> existingMetadataEntries,
// If the restrict_metadata flag is set in the database, then ensure
// that the add/update metadata entry defined in the validation rules
// i.e. it is a mandatory or optional metadata for the applicable DOC
if (restrictMetadata && !allowSystemMetadata) {
if (restrictMetadata && !(allowSystemMetadata
&& systemGeneratedMetadataAttributes.contains(metadataEntry.getAttribute()))) {
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The exemption for DOC validation when allowSystemMetadata is true is currently keyed off the global systemGeneratedMetadataAttributes set. That set includes data-object-only system attributes (see constructor) in addition to the smaller collectionSystemGeneratedMetadataAttributeNames list. For collection metadata updates, this means object-only system attributes would also be treated as exempt from DOC validation. Consider using the collection/data-object specific system-attribute lists (or passing the relevant set into validateMetadata) so only resource-appropriate system attributes are exempted.

Suggested change
&& systemGeneratedMetadataAttributes.contains(metadataEntry.getAttribute()))) {
&& collectionSystemGeneratedMetadataAttributeNames.contains(metadataEntry.getAttribute()))) {

Copilot uses AI. Check for mistakes.
// Do this check only for new files or collections so that fixing
// of existing ones is not necessitated
if (CollectionUtils.isNullOrEmpty(existingMetadataEntries)) {
Expand Down