Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EvaluatedCohortResourceTest extends BaseEvaluatedResourceTest<EvaluatedCohortResource, EvaluatedCohort> {
- // original file content was here
- // I added this to the end
- @Test
- public void andelaExample() throws Exception {
- GenderCohortDefinition query1 = new GenderCohortDefinition();
- query1.setMaleIncluded(true);
- AgeCohortDefinition query2 = new AgeCohortDefinition();
- query2.setMinAge(15);
- // BEGIN added this after the call; this is how I should have done it in the first place
- DefinitionLibraryCohortDefinition alternative1 = new DefinitionLibraryCohortDefinition
- ("reporting.library.cohortDefinition.builtIn.males");
- DefinitionLibraryCohortDefinition alternative2 = new DefinitionLibraryCohortDefinition
- ("reporting.library.cohortDefinition.builtIn.atLeastAgeOnDate");
- alternative2.addParameterValue("minAge", 15);
- // END added this after the call; this is how I should have done it in the first place
- Map<String, Mapped<CohortDefinition>> searches = new HashMap<String, Mapped<CohortDefinition>>();
- searches.put("1", Mapped.<CohortDefinition>noMappings(query1));
- searches.put("2", Mapped.<CohortDefinition>noMappings(query2));
- CompositionCohortDefinition composition = new CompositionCohortDefinition();
- composition.setCompositionString("1 AND 2");
- composition.setSearches(searches);
- OpenmrsSerializer serializer = Context.getSerializationService().getSerializer(ReportingSerializer.class);
- String xml = serializer.serialize(composition);
- System.out.println(xml);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement