Skip to content

Modify entity which fails SIRTFI check by replacing the SIRTFI entity attribute with a warning#35

Open
stskjisc wants to merge 5 commits into
mainfrom
516-modify-entity-which-fails-sirtfi-check-by-replacing-the-sirtfi-entity-attribute-with-a-warning
Open

Modify entity which fails SIRTFI check by replacing the SIRTFI entity attribute with a warning#35
stskjisc wants to merge 5 commits into
mainfrom
516-modify-entity-which-fails-sirtfi-check-by-replacing-the-sirtfi-entity-attribute-with-a-warning

Conversation

@stskjisc

Copy link
Copy Markdown
Collaborator

Create new bean 'StatusMetadataCheckStrategy' to tests whether the supplied metadata item contains a StatusMetadata of the configured type with a matching status message.

… attribute with a warning

Create new bean 'StatusMetadataCheckStrategy' to tests whether the supplied metadata item contains a StatusMetadata of the configured type with a matching status message.
@stskjisc stskjisc self-assigned this Jun 22, 2026
… attribute with a warning

Update Javadoc
Simpilfy if-else logic
@stskjisc stskjisc requested a review from philsmart June 23, 2026 13:01
… attribute with a warning

Update Javadoc
Update ItemMetadata remove method for concurrency safe
@stskjisc stskjisc requested a review from philsmart June 26, 2026 10:51
}
}

if (match != null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Removing outside the for loop is safe (so this is good). What happens if we have more than one StatusMessage with the same actual message? We will remove only one of them. That might be a problem?

… attribute with a warning

Change to support multiple match removal
@stskjisc stskjisc requested a review from philsmart June 29, 2026 15:46
@philsmart

Copy link
Copy Markdown
Member

The code changes look good right now. I think we should test this out based on this branch on ukf-mda in case we need to make further changes before merging this back in.

… attribute with a warning

Create test cases for StatusMetadataCheckStrategy

@philsmart philsmart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some minor improvments

/** Error status metadata. */
error(ErrorStatus.class);

private final Class<? extends StatusMetadata> statusClass;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: missing Javadoc

* @param statusClass the concrete {@link StatusMetadata} implementation class
*/
STATUS_TYPE(Class<? extends StatusMetadata> statusClass) {
this.statusClass = statusClass;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Often best not to hide/shadow fields (the method parameter has the same name as a field), so maybe call the method parameter 'status' and then you do not need the this., statusClass = status.

/** The type of {@link StatusMetadata} to evaluate. */
private final STATUS_TYPE statusType;
/** The message to match against status metadata entries. */
private final String message;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These final fields can have the @Nonnull annontation applied to them.

@Nonnull private final String message;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same for other final fields if they can not be null

* @param exactMatch {@code true} for exact message match; {@code false} for substring match
*/
public StatusMetadataCheckStrategy(@Nonnull final STATUS_TYPE statusType, @Nonnull final String message, final boolean exactMatch) {
this.message = message;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here about not hiding/shadowing fields (see above comment).

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