Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up JDK 8
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '8'
java-version: '21'

- name: Build and Test
run: mvn --batch-mode --update-snapshots clean package -P validator
run: mvn --batch-mode --update-snapshots clean package

- name: Set settings.xml
uses: s4u/maven-settings-action@v2.6.0
Expand All @@ -37,5 +37,5 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'mekomsolutions' }}

- name: Publish
run: mvn --batch-mode clean deploy -P validator
run: mvn --batch-mode clean deploy
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'mekomsolutions' }}
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11']
java: [ '21', '25' ]

steps:
- uses: actions/checkout@v2
Expand All @@ -24,4 +24,4 @@ jobs:
java-version: ${{ matrix.java }}

- name: Build and Test
run: mvn --batch-mode --update-snapshots clean package -P validator
run: mvn --batch-mode --update-snapshots clean package
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,24 @@ mvn clean package
```

### Runtime compatibility
* OpenMRS Core 2.1.1 (*required*)
* OpenMRS Core 3.0.0 (*required*), on Java 21
* Bahmni Appointments 1.2.1 (*compatible*)
* Bahmni Core 0.93 (*compatible*)
* Bahmni I.e Apps 1.1.0 (*compatible*)
* Billing 1.1.0 (*compatible*)
* Data Filter 1.0.0 (*compatible*)
* Flags 3.0.9 (*compatible*)
* HTML Form Entry 4.0.0 (*compatible*)
* ID Gen 4.3 (*compatible*)
* ID Gen 7.0.0 (*compatible*)
* Metadata Sharing 1.2.2 (*compatible*)
* Metadata Mapping 1.3.4 (*compatible*)
* Metadata Mapping 3.0.0 (*compatible*)
* Open Concept Lab 1.2.9 (*compatible*)
* Tasks 1.0.0 (*compatible*)

Apart from ID Gen and Metadata Mapping, these modules have no OpenMRS Core 3.0 version yet, so Initializer is not tested against them on this version.

On OpenMRS Core 2.x, use an Initializer 2.x release.

### Test your OpenMRS configs
See the [Initializer Validator README page](readme/validator.md).

Expand Down Expand Up @@ -233,7 +237,10 @@ See the [documentation on Initializer's logging properties](readme/rtprops.md#lo
----

## Releases notes
#### version 2.13.0
#### version 3.0.0
* Requires OpenMRS Core 3.0.0 and Java 21. Initializer 2.x releases remain the ones for OpenMRS Core 2.x.
* Most boolean CSV columns, `Void/Retire` included, and the `initializer.skip.checksums` and `initializer.row.checksums.enabled` properties now read `1` as true. Initializer 2.x read it as false.
* The [Initializer Validator](readme/validator.md) is not available for this version yet and remains on the 2.x line.

#### version 2.12.1
* Fix order types domain to apply the parent for order types with concrete Java classes (e.g. org.openmrs.DrugOrder)
Expand Down
5 changes: 1 addition & 4 deletions api-2.2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>initializer</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>initializer-api-2.2</artifactId>
<packaging>jar</packaging>
<name>Initializer API 2.2</name>
<description>API 2.2 project for Initializer</description>

<properties>
<openmrsPlatformVersion>${openmrsVersion2.2}</openmrsPlatformVersion>
</properties>

<dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.text.IsEmptyString.isEmptyOrNullString;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.openmrs.module.initializer.api.AttributeTypesLoaderTest.assertCustomDatatype;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openmrs.ConceptAttributeType;
import org.openmrs.ProgramAttributeType;
import org.openmrs.api.ConceptService;
Expand All @@ -30,7 +31,7 @@ public class AttributeTypesLoaderTest2_2 extends DomainBaseModuleContextSensitiv
@Qualifier("programWorkflowService")
private ProgramWorkflowService pws;

@Before
@BeforeEach
public void setup() {
executeDataSet("testdata/test-metadata-2.2.xml");
}
Expand All @@ -40,13 +41,13 @@ public void load_shouldLoadAccordingToCsvFiles() {
// Verify setup
{
ProgramAttributeType attType = pws.getProgramAttributeType(1089);
Assert.assertNotNull(attType);
Assertions.assertNotNull(attType);
assertCustomDatatype(attType.getDatatypeClassname());
Assert.assertEquals("org.openmrs.customdatatype.datatype.FloatDatatype", attType.getDatatypeClassname());
Assert.assertEquals("Program Efficiency Score", attType.getName());
Assert.assertEquals("Metric of the program efficiency", attType.getDescription());
Assert.assertThat(attType.getMinOccurs(), is(0));
Assert.assertThat(attType.getMaxOccurs(), is(1));
Assertions.assertEquals("org.openmrs.customdatatype.datatype.FloatDatatype", attType.getDatatypeClassname());
Assertions.assertEquals("Program Efficiency Score", attType.getName());
Assertions.assertEquals("Metric of the program efficiency", attType.getDescription());
MatcherAssert.assertThat(attType.getMinOccurs(), is(0));
MatcherAssert.assertThat(attType.getMaxOccurs(), is(1));
}

// Replay
Expand All @@ -55,42 +56,42 @@ public void load_shouldLoadAccordingToCsvFiles() {
// Verify creations
{
ConceptAttributeType attType = cs.getConceptAttributeTypeByUuid("7d002484-0fcd-4759-a67a-04dbf8fdaab1");
Assert.assertNotNull(attType);
Assertions.assertNotNull(attType);
assertCustomDatatype(attType.getDatatypeClassname());
Assert.assertEquals("org.openmrs.customdatatype.datatype.LocationDatatype", attType.getDatatypeClassname());
Assert.assertEquals("Concept Location", attType.getName());
Assertions.assertEquals("org.openmrs.customdatatype.datatype.LocationDatatype", attType.getDatatypeClassname());
Assertions.assertEquals("Concept Location", attType.getName());
assertThat(attType.getDescription(), isEmptyOrNullString());
Assert.assertThat(attType.getMinOccurs(), is(1));
Assert.assertThat(attType.getMaxOccurs(), is(1));
MatcherAssert.assertThat(attType.getMinOccurs(), is(1));
MatcherAssert.assertThat(attType.getMaxOccurs(), is(1));
}
{
ProgramAttributeType attType = pws.getProgramAttributeTypeByUuid("3884c889-35f5-47b4-a6b7-5b1165cee218");
Assert.assertNotNull(attType);
Assertions.assertNotNull(attType);
assertCustomDatatype(attType.getDatatypeClassname());
Assert.assertEquals("org.openmrs.customdatatype.datatype.FreeTextDatatype", attType.getDatatypeClassname());
Assert.assertEquals("Program Assessment", attType.getName());
Assert.assertEquals("Program Assessment's description", attType.getDescription());
Assert.assertNull(attType.getMinOccurs());
Assert.assertNull(attType.getMaxOccurs());
Assertions.assertEquals("org.openmrs.customdatatype.datatype.FreeTextDatatype", attType.getDatatypeClassname());
Assertions.assertEquals("Program Assessment", attType.getName());
Assertions.assertEquals("Program Assessment's description", attType.getDescription());
Assertions.assertNull(attType.getMinOccurs());
Assertions.assertNull(attType.getMaxOccurs());
}

// Verify editions
{
ProgramAttributeType attType = pws.getProgramAttributeTypeByUuid("b1d98f27-c058-46f2-9c12-87dd7c92f7e3");
Assert.assertNotNull(attType);
Assertions.assertNotNull(attType);
assertCustomDatatype(attType.getDatatypeClassname());
Assert.assertEquals("org.openmrs.customdatatype.datatype.FloatDatatype", attType.getDatatypeClassname());
Assert.assertEquals("Program Efficiency Indicator", attType.getName());
Assert.assertEquals("Metric of the program efficiency", attType.getDescription());
Assert.assertThat(attType.getMinOccurs(), is(0));
Assert.assertThat(attType.getMaxOccurs(), is(1));
Assertions.assertEquals("org.openmrs.customdatatype.datatype.FloatDatatype", attType.getDatatypeClassname());
Assertions.assertEquals("Program Efficiency Indicator", attType.getName());
Assertions.assertEquals("Metric of the program efficiency", attType.getDescription());
MatcherAssert.assertThat(attType.getMinOccurs(), is(0));
MatcherAssert.assertThat(attType.getMaxOccurs(), is(1));
}

// Verify retirement using name as the pivot
{
ConceptAttributeType attType = cs.getConceptAttributeTypeByName("Concept Family");
Assert.assertNotNull(attType);
Assert.assertTrue(attType.getRetired());
Assertions.assertNotNull(attType);
Assertions.assertTrue(attType.getRetired());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import static org.hamcrest.CoreMatchers.is;
import static org.openmrs.module.initializer.api.attributes.types.AttributeTypeEntity.CONCEPT;

import org.apache.commons.lang.RandomStringUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.apache.commons.lang3.RandomStringUtils;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openmrs.ConceptAttributeType;
import org.openmrs.api.ConceptService;
import org.openmrs.attribute.BaseAttributeType;
Expand All @@ -26,7 +27,7 @@ public class AttributeTypesProxyServiceTest extends DomainBaseModuleContextSensi
@Qualifier("conceptService")
private ConceptService cs;

@Before
@BeforeEach
public void setup() {
executeDataSet("testdata/test-metadata-2.2.xml");
}
Expand All @@ -37,9 +38,9 @@ public void getAttributeTypeByUuid_shouldGetAttributeType() {
BaseAttributeType<?> attType = service.getAttributeTypeByUuid(CONCEPT_ATT_TYPE_UUID, CONCEPT);

// Verif
Assert.assertNotNull(attType);
Assert.assertThat(attType.getName(), is("Concept Family"));
Assert.assertTrue(attType instanceof ConceptAttributeType);
Assertions.assertNotNull(attType);
MatcherAssert.assertThat(attType.getName(), is("Concept Family"));
Assertions.assertTrue(attType instanceof ConceptAttributeType);
}

@Test
Expand All @@ -54,7 +55,7 @@ public void saveAttributeType_shouldSaveAttributeType() {

// Verif
attType = service.getAttributeTypeByName(newName, CONCEPT);
Assert.assertNotNull(attType);
Assert.assertThat(attType.getId(), is(1089));
Assertions.assertNotNull(attType);
MatcherAssert.assertThat(attType.getId(), is(1089));
}
}
40 changes: 21 additions & 19 deletions api-2.3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>initializer</artifactId>
<version>2.13.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>initializer-api-2.3</artifactId>
<packaging>jar</packaging>
<name>Initializer API 2.3</name>
<description>API 2.3 project for Initializer</description>

<properties>
<openmrsPlatformVersion>${openmrsVersion2.3}</openmrsPlatformVersion>
</properties>

<dependencies>

Expand Down Expand Up @@ -60,6 +57,13 @@
<artifactId>appframework-api</artifactId>
<version>${appframeworkVersion}</version>
<scope>test</scope>
<exclusions>
<!-- handlebars' antlr4-runtime 4.1 would shadow the 4.13 that Hibernate 7 needs -->
<exclusion>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -74,24 +78,22 @@
<scope>provided</scope>
</dependency>

<!-- Dependencies required to compile against Java 11 -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<!-- datafilter and queue have no Platform 3.0 release yet, see Platform3ModuleContextLoader -->
<exclude>**/DataFilterMappingsLoaderTest.java</exclude>
<exclude>**/QueueLoaderIntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
<testResources>
<testResource>
<directory>../api/src/test/resources</directory>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.openmrs.module.initializer.api.datafilter.mappings;

import org.hibernate.Criteria;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.Root;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.openmrs.OpenmrsObject;
import org.openmrs.annotation.OpenmrsProfile;
import org.openmrs.module.datafilter.impl.api.DataFilterService;
Expand Down Expand Up @@ -33,9 +36,16 @@ public class DataFilterMappingLineProcessor extends BaseLineProcessor<DataFilter

@Transactional(readOnly = true)
public OpenmrsObject getOpenmrsObject(String uuid, String className) throws HibernateException, ClassNotFoundException {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Class.forName(className));
criteria.add(Restrictions.eq("uuid", uuid));
return (OpenmrsObject) criteria.uniqueResult();
return (OpenmrsObject) getByUuid(Class.forName(className), uuid);
}

private <T> T getByUuid(Class<T> clazz, String uuid) {
Session session = sessionFactory.getCurrentSession();
CriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<T> cq = cb.createQuery(clazz);
Root<T> root = cq.from(clazz);
cq.where(cb.equal(root.get("uuid"), uuid));
return session.createQuery(cq).uniqueResult();
}

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.openmrs.module.initializer.api.datafilter.mappings;

import org.hibernate.Criteria;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.Root;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.openmrs.OpenmrsObject;
import org.openmrs.annotation.OpenmrsProfile;
import org.openmrs.module.initializer.Domain;
Expand Down Expand Up @@ -36,9 +39,16 @@ public Domain getDomain() {

@Transactional(readOnly = true)
public OpenmrsObject getOpenmrsObject(String uuid, String className) throws HibernateException, ClassNotFoundException {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Class.forName(className));
criteria.add(Restrictions.eq("uuid", uuid));
return (OpenmrsObject) criteria.uniqueResult();
return (OpenmrsObject) getByUuid(Class.forName(className), uuid);
}

private <T> T getByUuid(Class<T> clazz, String uuid) {
Session session = sessionFactory.getCurrentSession();
CriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<T> cq = cb.createQuery(clazz);
Root<T> root = cq.from(clazz);
cq.where(cb.equal(root.get("uuid"), uuid));
return session.createQuery(cq).uniqueResult();
}

@Override
Expand Down
Loading