Changeset 3795
- Timestamp:
- 04/02/08 15:57:11 (9 months ago)
- Files:
-
- openmrs/branches/report_api_refactoring/src/api/org/openmrs/Cohort.java (modified) (1 diff)
- openmrs/branches/report_api_refactoring/src/api/org/openmrs/api/impl/CohortServiceImpl.java (modified) (8 diffs)
- openmrs/branches/report_api_refactoring/src/api/org/openmrs/cohort/api/impl/PatientSearchCohortDefinitionProvider.java (modified) (6 diffs)
- openmrs/branches/report_api_refactoring/test/api/org/openmrs/test/hackathon/PepfarReportSerializationTest.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/branches/report_api_refactoring/src/api/org/openmrs/Cohort.java
r3791 r3795 47 47 } 48 48 49 /** 50 * Convenience constructor to create a Cohort object that 51 * has an primarykey/internal identifier of <code>cohortId</code> 52 * 53 * @param cohortId the internal identifier for this cohort 54 */ 55 public Cohort(Integer cohortId) { 56 this.cohortId = cohortId; 57 } 58 49 59 public Cohort(Set<Integer> memberIds) { 50 60 this.memberIds = memberIds; openmrs/branches/report_api_refactoring/src/api/org/openmrs/api/impl/CohortServiceImpl.java
r3791 r3795 125 125 * @see org.openmrs.api.CohortService#evaluate(org.openmrs.cohort.CohortDefinition, org.openmrs.report.EvaluationContext) 126 126 */ 127 @Override128 127 public Cohort evaluate(CohortDefinition definition, EvaluationContext evalContext) throws APIException { 129 128 CohortDefinitionProvider provider = getCohortDefinitionProvider(definition.getClass()); … … 136 135 * @see org.openmrs.api.CohortService#getAllPatientsCohortDefinition() 137 136 */ 138 @Override139 137 public CohortDefinition getAllPatientsCohortDefinition() { 140 138 PatientSearch ps = new PatientSearch(); … … 146 144 * @see org.openmrs.api.CohortService#getCohortDefinition(java.lang.Class, java.lang.Integer) 147 145 */ 148 @Override149 146 public CohortDefinition getCohortDefinition(Class<CohortDefinition> clazz, Integer id) { 150 147 CohortDefinitionProvider provider = getCohortDefinitionProvider(clazz); … … 155 152 * @see org.openmrs.api.CohortService#getCohortDefinitions() 156 153 */ 157 @Override158 154 public List<CohortDefinition> getAllCohortDefinitions() { 159 155 List<CohortDefinition> ret = new ArrayList<CohortDefinition>(); … … 167 163 * @see org.openmrs.api.CohortService#purgeCohortDefinition(org.openmrs.cohort.CohortDefinition) 168 164 */ 169 @Override170 165 public void purgeCohortDefinition(CohortDefinition definition) { 171 166 CohortDefinitionProvider provider = getCohortDefinitionProvider(definition.getClass()); … … 176 171 * @see org.openmrs.api.CohortService#registerCohortDefinitionProvider(java.lang.Class) 177 172 */ 178 @Override179 173 public void registerCohortDefinitionProvider(Class<? extends CohortDefinitionProvider> providerClass) { 180 174 try { … … 190 184 * @see org.openmrs.api.CohortService#removeCohortDefinitionProvider(java.lang.Class) 191 185 */ 192 @Override193 186 public void removeCohortDefinitionProvider(Class<? extends CohortDefinitionProvider> providerClass) { 194 187 for (Iterator<CohortDefinitionProvider> i = cohortDefinitionProviders.values().iterator(); i.hasNext(); ) { … … 201 194 * @see org.openmrs.api.CohortService#saveCohortDefinition(org.openmrs.cohort.CohortDefinition) 202 195 */ 203 @Override204 196 public CohortDefinition saveCohortDefinition(CohortDefinition definition) throws APIException { 205 197 CohortDefinitionProvider provider = getCohortDefinitionProvider(definition.getClass()); openmrs/branches/report_api_refactoring/src/api/org/openmrs/cohort/api/impl/PatientSearchCohortDefinitionProvider.java
r3794 r3795 39 39 * @see org.openmrs.cohort.api.CohortDefinitionProvider#getClassHandled() 40 40 */ 41 @Override42 41 public Class<? extends CohortDefinition> getClassHandled() { 43 42 return PatientSearch.class; … … 47 46 * @see org.openmrs.cohort.api.CohortDefinitionProvider#evaluate(org.openmrs.cohort.CohortDefinition, org.openmrs.report.EvaluationContext) 48 47 */ 49 @Override50 48 public Cohort evaluate(CohortDefinition cohortDefinition, EvaluationContext evaluationContext) { 51 49 PatientSearch search = (PatientSearch) cohortDefinition; … … 59 57 * @see org.openmrs.cohort.api.CohortDefinitionProvider#getAllCohortDefinitions() 60 58 */ 61 @Override62 59 public List<CohortDefinition> getAllCohortDefinitions() { 63 60 List<CohortDefinition> ret = new ArrayList<CohortDefinition>(); … … 72 69 * @see org.openmrs.cohort.api.CohortDefinitionProvider#getCohortDefinition(java.lang.Integer) 73 70 */ 74 @Override75 71 public CohortDefinition getCohortDefinition(Integer id) { 76 72 PatientSearchReportObject psro = (PatientSearchReportObject) Context.getReportObjectService().getReportObject(id); … … 81 77 * @see org.openmrs.cohort.api.CohortDefinitionProvider#purgeCohortDefinition(org.openmrs.cohort.CohortDefinition) 82 78 */ 83 @Override84 79 public void purgeCohortDefinition(CohortDefinition cohortDefinition) { 85 80 throw new APIException("Not Yet Implemented"); … … 89 84 * @see org.openmrs.cohort.api.CohortDefinitionProvider#saveCohortDefinition(org.openmrs.cohort.CohortDefinition) 90 85 */ 91 @Override92 86 public CohortDefinition saveCohortDefinition(CohortDefinition cohortDefinition) { 93 87 throw new APIException("Not Yet Implemented"); openmrs/branches/report_api_refactoring/test/api/org/openmrs/test/hackathon/PepfarReportSerializationTest.java
r3762 r3795 24 24 import org.openmrs.Location; 25 25 import org.openmrs.User; 26 import org.openmrs. cohort.StaticCohort;26 import org.openmrs.Cohort; 27 27 import org.openmrs.dataset.CohortDataSetDefinition; 28 28 import org.openmrs.dataset.DataSetDefinition; … … 56 56 cohortDataSetDef.setName("Sheet1"); 57 57 58 cohortDataSetDef.addStrategy("1.a", new StaticCohort());58 cohortDataSetDef.addStrategy("1.a", new Cohort()); 59 59 pepfarReportSchema.setDataSetDefinitions(dataSets); 60 60 … … 70 70 71 71 // add the rows (cohort) to the report 72 StaticCohort inputStaticCohort = new StaticCohort(1);73 inputStaticCohort.add PersonId(1001);74 inputStaticCohort.add PersonId(1002);75 inputStaticCohort.add PersonId(1003);72 Cohort inputStaticCohort = new Cohort(1); 73 inputStaticCohort.addMember(1001); 74 inputStaticCohort.addMember(1002); 75 inputStaticCohort.addMember(1003); 76 76 pepfarReportSchema.setCohort(inputStaticCohort); 77 77 … … 95 95 assertTrue("The # of params shouldn't be: " + deserializedSchema.getParameters().size(), deserializedSchema.getParameters().size() == 3); 96 96 assertTrue("The name shouldn't be: " + deserializedSchema.getName(), deserializedSchema.getName().equals("PEPFAR report")); 97 int size = deserializedSchema.getCohort().get PersonIds(null).size();97 int size = deserializedSchema.getCohort().getMemberIds(null).size(); 98 98 assertTrue("There should be 3 patients in the static cohort, not: " + size, size == 3); 99 99