-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into MAT-6267
- Loading branch information
Showing
14 changed files
with
699 additions
and
59 deletions.
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
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
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
7 changes: 7 additions & 0 deletions
7
src/main/java/cms/gov/madie/measure/services/ModelValidator.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,7 @@ | ||
package cms.gov.madie.measure.services; | ||
|
||
import gov.cms.madie.models.measure.Group; | ||
|
||
public interface ModelValidator { | ||
public void validateGroupAssociations(String model, Group group); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/cms/gov/madie/measure/services/ModelValidatorLocator.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,21 @@ | ||
package cms.gov.madie.measure.services; | ||
|
||
import org.springframework.beans.BeansException; | ||
|
||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ApplicationContextAware; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ModelValidatorLocator implements ApplicationContextAware { | ||
private ApplicationContext ctx; | ||
|
||
public ModelValidator get(String model) { | ||
return ctx.getBean(model + "ModelValidator", ModelValidator.class); | ||
} | ||
|
||
@Override | ||
public void setApplicationContext(ApplicationContext ctx) throws BeansException { | ||
this.ctx = ctx; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/cms/gov/madie/measure/services/QdmModelValidator.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,23 @@ | ||
package cms.gov.madie.measure.services; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import cms.gov.madie.measure.exceptions.InvalidGroupException; | ||
import gov.cms.madie.models.measure.Group; | ||
|
||
@Service | ||
public class QdmModelValidator implements ModelValidator { | ||
|
||
@Override | ||
public void validateGroupAssociations(String model, Group group) { | ||
|
||
boolean isAssociated; | ||
|
||
isAssociated = | ||
group.getStratifications().stream().anyMatch(map -> map.getAssociation() != null); | ||
|
||
if (isAssociated) { | ||
throw new InvalidGroupException("QDM group stratifications cannot be associated."); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/cms/gov/madie/measure/services/QicoreModelValidator.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,24 @@ | ||
package cms.gov.madie.measure.services; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import cms.gov.madie.measure.exceptions.InvalidGroupException; | ||
import gov.cms.madie.models.measure.Group; | ||
|
||
@Service | ||
public class QicoreModelValidator implements ModelValidator { | ||
|
||
@Override | ||
public void validateGroupAssociations(String model, Group group) { | ||
|
||
boolean isNotAssociated; | ||
|
||
isNotAssociated = | ||
group.getStratifications().stream().anyMatch(map -> map.getAssociation() == null); | ||
|
||
if (isNotAssociated) { | ||
throw new InvalidGroupException( | ||
"QI-Core group stratifications should be associated to a valid population type."); | ||
} | ||
} | ||
} |
Oops, something went wrong.