Modify entity which fails SIRTFI check by replacing the SIRTFI entity attribute with a warning#35
Conversation
… 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.
… attribute with a warning Update Javadoc Simpilfy if-else logic
… attribute with a warning Update Javadoc Update ItemMetadata remove method for concurrency safe
| } | ||
| } | ||
|
|
||
| if (match != null) { |
There was a problem hiding this comment.
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
|
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
| /** Error status metadata. */ | ||
| error(ErrorStatus.class); | ||
|
|
||
| private final Class<? extends StatusMetadata> statusClass; |
| * @param statusClass the concrete {@link StatusMetadata} implementation class | ||
| */ | ||
| STATUS_TYPE(Class<? extends StatusMetadata> statusClass) { | ||
| this.statusClass = statusClass; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
These final fields can have the @Nonnull annontation applied to them.
@Nonnull private final String message;
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Same here about not hiding/shadowing fields (see above comment).
Create new bean 'StatusMetadataCheckStrategy' to tests whether the supplied metadata item contains a StatusMetadata of the configured type with a matching status message.