-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from MeasureAuthoringTool/feature/mat-7437-im…
…provement-notation-desc-validation [MAT-7437] Enforce non-blank Improvement Notation Description for QDM Measures when Improvement Notation is set to 'Other'
- Loading branch information
Showing
4 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/gov/cms/madie/models/validators/OtherImprovementNotationValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package gov.cms.madie.models.validators; | ||
|
||
import gov.cms.madie.models.measure.*; | ||
import jakarta.validation.ConstraintValidator; | ||
import jakarta.validation.ConstraintValidatorContext; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
@Slf4j | ||
public class OtherImprovementNotationValidator | ||
implements ConstraintValidator<ValidOtherImprovementNotation, QdmMeasure> { | ||
|
||
@Override | ||
public boolean isValid(QdmMeasure measure, ConstraintValidatorContext context) { | ||
if (StringUtils.equalsIgnoreCase(measure.getImprovementNotation(), "Other")) { | ||
return StringUtils.isNotBlank(measure.getImprovementNotationDescription()); | ||
} | ||
return true; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/gov/cms/madie/models/validators/ValidOtherImprovementNotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package gov.cms.madie.models.validators; | ||
|
||
import jakarta.validation.Constraint; | ||
import jakarta.validation.Payload; | ||
|
||
import java.lang.annotation.*; | ||
|
||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Constraint(validatedBy = OtherImprovementNotationValidator.class) | ||
@Documented | ||
public @interface ValidOtherImprovementNotation { | ||
|
||
String message() default "Improvement Notation Description is required when Other is selected"; | ||
|
||
Class<?>[] groups() default {}; | ||
|
||
Class<? extends Payload>[] payload() default {}; | ||
} |