Skip to content

Commit 88d0b8b

Browse files
committed
Update to Platform 2.7.0 and Support Java 21
Revert PropertiesType Annotate ReportingSerializer as a Component Convert org.openmrs.Cohort cohort to org.openmrs.cohort.Cohort Update UserType sub classes Add scope to reportingcompatibility-api Remove deprecated tests Fix test errors Make powermock an exclusion Remove XStream sub modules org.mockito.ArgumentMatchers.argThat; Update Xstream Remove groovy Remove profiles Remove jackson Update the Java version to 8 Update maven.yml Update all sub modules Update 1.9 and 2.0 Update surefire-plugin
1 parent 5419198 commit 88d0b8b

File tree

36 files changed

+1470
-1066
lines changed

36 files changed

+1470
-1066
lines changed

.github/workflows/maven.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
platform: [ ubuntu-latest ]
16-
java-version: [ 8 ]
17-
profile: [ 1.10, 1.11, 1.12, 2.0, 2.1, 2.2, 2.3, 2.4 ]
16+
java-version: [ 8, 11, 17, 21, 24 ]
1817

1918
runs-on: ${{ matrix.platform }}
2019
env:
@@ -36,5 +35,5 @@ jobs:
3635
restore-keys: |
3736
${{ runner.os }}-maven-
3837
- name: Build with Maven
39-
run: mvn clean install -P ${{ matrix.profile }} --batch-mode --show-version --file pom.xml
38+
run: mvn clean install --batch-mode --show-version --file pom.xml
4039

api-1.10/pom.xml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<description>1.10 api project for reporting</description>
1414

1515
<properties>
16-
<openMRSVersion>1.10.6</openMRSVersion>
16+
<openMRSVersion>2.7.0</openMRSVersion>
1717
</properties>
1818

1919
<dependencies>
@@ -45,6 +45,16 @@
4545
<type>test-jar</type>
4646
<version>${openMRSVersion}</version>
4747
<scope>test</scope>
48+
<exclusions>
49+
<exclusion>
50+
<groupId>org.powermock</groupId>
51+
<artifactId>powermock-api-mockito</artifactId>
52+
</exclusion>
53+
<exclusion>
54+
<groupId>org.powermock</groupId>
55+
<artifactId>powermock-api-mockito2</artifactId>
56+
</exclusion>
57+
</exclusions>
4858
</dependency>
4959

5060
<dependency>
@@ -53,6 +63,16 @@
5363
<version>${openMRSVersion}</version>
5464
<type>pom</type>
5565
<scope>test</scope>
66+
<exclusions>
67+
<exclusion>
68+
<groupId>org.powermock</groupId>
69+
<artifactId>powermock-api-mockito</artifactId>
70+
</exclusion>
71+
<exclusion>
72+
<groupId>org.powermock</groupId>
73+
<artifactId>powermock-api-mockito2</artifactId>
74+
</exclusion>
75+
</exclusions>
5676
</dependency>
5777

5878
</dependencies>

api-1.10/src/main/java/org/openmrs/module/reporting/cohort/definition/evaluator/DrugOrderCohortDefinitionEvaluator.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
package org.openmrs.module.reporting.cohort.definition.evaluator;
1212

13-
import org.apache.commons.lang3.time.DateUtils;
1413
import org.openmrs.Cohort;
1514
import org.openmrs.DrugOrder;
1615
import org.openmrs.module.reporting.cohort.definition.CohortDefinition;
@@ -25,7 +24,6 @@
2524

2625
import org.springframework.beans.factory.annotation.Autowired;
2726
import java.util.List;
28-
import java.util.Date;
2927

3028
@Handler(supports = { DrugOrderCohortDefinition.class })
3129
public class DrugOrderCohortDefinitionEvaluator implements CohortDefinitionEvaluator {

api-1.10/src/test/resources/org/openmrs/module/reporting/include/DrugOrderCohortEvaluationData.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@
7474
<patient patient_id="24" creator="1" date_created="2009-01-18 00:00:00.0" voided="false" void_reason=""/>
7575
<patient patient_id="999" creator="1" date_created="2006-01-18 00:00:00.0" changed_by="1" date_changed="2008-08-18 12:24:34.0" voided="true" void_reason="For test purposes"/>
7676

77-
<patient_identifier_type patient_identifier_type_id="1" name="OpenMRS Identification Number" description="Unique number used in OpenMRS" format="" check_digit="true" creator="1" date_created="2005-09-22 00:00:00.0" required="false" validator="org.openmrs.patient.impl.LuhnIdentifierValidator" retired="false" uuid="1a339fe9-38bc-4ab3-b180-320988c0b968"/>
77+
<patient_identifier_type patient_identifier_type_id="1" name="OpenMRS Identification Number" description="Unique number used in OpenMRS" format="" creator="1" date_created="2005-09-22 00:00:00.0" required="false" validator="org.openmrs.patient.impl.LuhnIdentifierValidator" retired="false" uuid="1a339fe9-38bc-4ab3-b180-320988c0b968"/>
7878
<patient_identifier patient_identifier_id="4" patient_id="7" identifier="6TS-4" identifier_type="1" preferred="0" location_id="1" creator="1" date_created="2006-01-18 00:00:00.0" voided="false" void_reason="" uuid="489edb7f-0786-4726-88a3-f0fcd2505d1a"/>
79-
<patient_identifier_type patient_identifier_type_id="2" name="Old Identification Number" description="Number given out prior to the OpenMRS system (No check digit)" format="" check_digit="false" creator="1" date_created="2005-09-22 00:00:00.0" required="false" retired="false" uuid="2f470aa8-1d73-43b7-81b5-01f0c0dfa53c"/>
80-
<patient_identifier_type patient_identifier_type_id="4" name="Social Security Number" description="Soc security ID" format="" check_digit="false" creator="1" date_created="2008-08-15 15:59:20.0" required="false" format_description="" validator="" retired="true" retired_by="1" date_retired="2008-08-15 00:00:00.0" retire_reason="test" uuid="158d6b17-a8ab-435b-8fe3-952a04bda757"/>
79+
<patient_identifier_type patient_identifier_type_id="2" name="Old Identification Number" description="Number given out prior to the OpenMRS system (No check digit)" format="" creator="1" date_created="2005-09-22 00:00:00.0" required="false" retired="false" uuid="2f470aa8-1d73-43b7-81b5-01f0c0dfa53c"/>
80+
<patient_identifier_type patient_identifier_type_id="4" name="Social Security Number" description="Soc security ID" format="" creator="1" date_created="2008-08-15 15:59:20.0" required="false" format_description="" validator="" retired="true" retired_by="1" date_retired="2008-08-15 00:00:00.0" retire_reason="test" uuid="158d6b17-a8ab-435b-8fe3-952a04bda757"/>
8181

8282
<patient_identifier patient_identifier_id="1" patient_id="2" identifier="101" identifier_type="2" preferred="0" location_id="1" creator="1" date_created="2005-09-22 00:00:00.0" voided="false" void_reason="" uuid="ff41928c-3bca-48d9-a4dc-9198f6b2873b"/>
8383
<patient_identifier patient_identifier_id="2" patient_id="2" identifier="101-6" identifier_type="1" preferred="1" location_id="1" creator="1" date_created="2005-09-22 00:00:00.0" voided="false" void_reason="" uuid="8a9aac6e-3f9f-4ed2-8fb5-25215f8bb614"/>

api-1.9/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<description>1.9 api project for reporting</description>
1414

1515
<properties>
16-
<openMRSVersion>1.9.9</openMRSVersion>
16+
<openMRSVersion>2.7.0</openMRSVersion>
1717
</properties>
1818

1919
<dependencies>
@@ -47,6 +47,12 @@
4747
<scope>test</scope>
4848
</dependency>
4949

50+
<dependency>
51+
<groupId>org.openmrs.module</groupId>
52+
<artifactId>reportingcompatibility-api</artifactId>
53+
<version>3.0.0-SNAPSHOT</version>
54+
<scope>provided</scope>
55+
</dependency>
5056
</dependencies>
5157

5258
<build>

api-1.9/src/main/java/org/openmrs/module/reporting/dataset/definition/evaluator/DataExportDataSetEvaluator.java

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,57 +36,77 @@
3636
@Handler(supports={DataExportDataSetDefinition.class})
3737
@SuppressWarnings("deprecation")
3838
public class DataExportDataSetEvaluator implements DataSetEvaluator {
39-
39+
4040
private Log log = LogFactory.getLog(this.getClass());
41-
41+
4242
/**
4343
* Public constructor
4444
*/
45-
public DataExportDataSetEvaluator() {}
46-
45+
public DataExportDataSetEvaluator() {}
46+
4747
/**
4848
* @see DataSetEvaluator#evaluate(DataSetDefinition, EvaluationContext)
4949
* @should evaluate a DataExportDataSetDefinition
5050
*/
5151
public DataSet evaluate(DataSetDefinition definition, EvaluationContext context) {
52-
52+
5353
context = ObjectUtil.nvl(context, new EvaluationContext());
5454
SimpleDataSet dataSet = new SimpleDataSet(definition, context);
5555
try {
5656
DataExportDataSetDefinition dataExportDefinition = (DataExportDataSetDefinition) definition;
5757
DataExportReportObject dataExport = dataExportDefinition.getDataExport();
58-
DataExportUtil.generateExport(dataExport, context.getBaseCohort(), null);
59-
58+
DataExportUtil.generateExport(dataExport, convertCohort(context.getBaseCohort()), null);
59+
6060
File dataFile = DataExportUtil.getGeneratedFile(dataExportDefinition.getDataExport());
6161

62-
// Get contents as a string
62+
// Get contents as a string
6363
// TODO Test whether this is faster than another approach
64-
String contents = OpenmrsUtil.getFileAsString(dataFile);
64+
String contents = OpenmrsUtil.getFileAsString(dataFile);
6565
String [] rows = contents.split("\\n");
66-
67-
// Get column names
66+
67+
// Get column names
6868
String [] columns = rows[0].split("\\t");
6969
Map<String, DataSetColumn> cols = new HashMap<String, DataSetColumn>();
7070
for (String s : columns) {
7171
DataSetColumn c = new DataSetColumn(s, s, String.class);
7272
cols.put(s, c);
7373
dataSet.getMetaData().addColumn(c);
7474
}
75-
75+
7676
// Iterate over remaining rows
77-
for (int i=1; i<rows.length;i++) {
77+
for (int i=1; i<rows.length;i++) {
7878
DataSetRow row = new DataSetRow();
7979
String [] cells = rows[i].split("\\t");
80-
for (int j=0; j<cells.length; j++) {
80+
for (int j=0; j<cells.length; j++) {
8181
row.addColumnValue(cols.get(columns[j]), cells[j]);
8282
}
83-
dataSet.addRow(row);
83+
dataSet.addRow(row);
8484
}
85-
}
85+
}
8686
catch (Exception e) {
8787
log.error("An error occurred while generating a data export.", e);
8888
throw new RuntimeException("An error occurred while generating a data export.", e);
8989
}
9090
return dataSet;
9191
}
92+
93+
private org.openmrs.cohort.Cohort convertCohort(org.openmrs.Cohort cohort) {
94+
org.openmrs.cohort.Cohort c = new org.openmrs.cohort.Cohort();
95+
c.setCohortId(cohort.getId());
96+
c.setName(cohort.getName());
97+
c.setDescription(cohort.getDescription());
98+
c.setMemberIds(cohort.getMemberIds());
99+
100+
c.setUuid(cohort.getUuid());
101+
c.setCreator(cohort.getCreator());
102+
c.setDateCreated(cohort.getDateCreated());
103+
c.setChangedBy(cohort.getChangedBy());
104+
c.setDateChanged(cohort.getDateChanged());
105+
c.setVoided(cohort.getVoided());
106+
c.setVoidedBy(cohort.getVoidedBy());
107+
c.setDateVoided(cohort.getDateVoided());
108+
c.setVoidReason(cohort.getVoidReason());
109+
110+
return c;
111+
}
92112
}

0 commit comments

Comments
 (0)