forked from nedap/archie
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
4,290 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Gradle Build & Test | ||
|
||
on: | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up GraalVM JDK 17 | ||
uses: graalvm/setup-graalvm@v1 | ||
with: | ||
java-version: '17' | ||
distribution: 'graalvm-community' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Gradle Build | ||
uses: gradle/[email protected] | ||
with: | ||
arguments: build | ||
env: | ||
ORG_GRADLE_PROJECT_mavenUser: ${{ github.actor }} | ||
ORG_GRADLE_PROJECT_mavenPassword: ${{ secrets.GITHUB_TOKEN }} | ||
ORG_GRADLE_PROJECT_snapshotsRepoURL: https://maven.pkg.github.com/${{ github.repository }} | ||
ORG_GRADLE_PROJECT_releasesRepoURL: https://maven.pkg.github.com/${{ github.repository }} |
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,29 @@ | ||
name: Gradle Build & Test | ||
|
||
on: | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up GraalVM JDK 17 | ||
uses: graalvm/setup-graalvm@v1 | ||
with: | ||
java-version: '17' | ||
distribution: 'graalvm-community' | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Gradle Build | ||
uses: gradle/[email protected] | ||
with: | ||
arguments: build | ||
env: | ||
ORG_GRADLE_PROJECT_mavenUser: ${{ github.actor }} | ||
ORG_GRADLE_PROJECT_mavenPassword: ${{ secrets.GITHUB_TOKEN }} | ||
ORG_GRADLE_PROJECT_snapshotsRepoURL: https://maven.pkg.github.com/${{ github.repository }} | ||
ORG_GRADLE_PROJECT_releasesRepoURL: https://maven.pkg.github.com/${{ github.repository }} |
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
28 changes: 28 additions & 0 deletions
28
bmm/src/main/java/org/openehr/bmm/core/BmmIndexedContainerProperty.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,28 @@ | ||
package org.openehr.bmm.core; | ||
|
||
import com.nedap.archie.base.MultiplicityInterval; | ||
|
||
/** | ||
* Subtype of BMM_CONTAINER_PROPERTY that represents an indexed container type based on one of the inbuilt types | ||
* Hash <>. | ||
*/ | ||
public class BmmIndexedContainerProperty extends BmmProperty<BmmIndexedContainerType> { | ||
|
||
/** | ||
* We have to replicate cardinality here from BmmContainerProperty since we are inheriting from | ||
* BmmProperty <BmmIndexedContainerType> (which creates correct typing of the 'type' property) not BmmContainerProperty | ||
*/ | ||
private MultiplicityInterval cardinality; | ||
|
||
public BmmIndexedContainerProperty (String aName, BmmIndexedContainerType aType, String aDocumentation, boolean isMandatoryFlag, boolean isComputedFlag) { | ||
super(aName, aType, aDocumentation, isMandatoryFlag, isComputedFlag); | ||
cardinality = MultiplicityInterval.createOpen(); | ||
} | ||
|
||
public MultiplicityInterval getCardinality() { | ||
return cardinality; | ||
} | ||
public void setCardinality(MultiplicityInterval cardinality) { | ||
this.cardinality = cardinality; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
bmm/src/main/java/org/openehr/bmm/core/BmmIndexedContainerType.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,26 @@ | ||
package org.openehr.bmm.core; | ||
|
||
import org.openehr.bmm.persistence.validation.BmmDefinitions; | ||
|
||
public class BmmIndexedContainerType extends BmmContainerType { | ||
|
||
/** | ||
* The type of the index | ||
*/ | ||
private BmmSimpleType indexType; | ||
public BmmIndexedContainerType (BmmUnitaryType aBaseType, BmmSimpleType anIndexType, BmmGenericClass aContainerClass) { | ||
super (aBaseType, aContainerClass); | ||
indexType = anIndexType; | ||
} | ||
public BmmSimpleType getIndexType() { return indexType; } | ||
|
||
@Override | ||
public String getTypeName() { | ||
return getContainerType().getName() + | ||
BmmDefinitions.GENERIC_LEFT_DELIMITER + | ||
indexType.getTypeName() + BmmDefinitions.GENERIC_SEPARATOR + | ||
getBaseType().getTypeName() + | ||
BmmDefinitions.GENERIC_RIGHT_DELIMITER; | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
bmm/src/main/java/org/openehr/bmm/v2/persistence/PBmmIndexedContainerProperty.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,41 @@ | ||
package org.openehr.bmm.v2.persistence; | ||
|
||
import com.nedap.archie.base.Interval; | ||
import com.nedap.archie.base.MultiplicityInterval; | ||
import org.openehr.bmm.core.*; | ||
import org.openehr.bmm.v2.validation.converters.BmmClassProcessor; | ||
|
||
public class PBmmIndexedContainerProperty extends PBmmProperty<PBmmIndexedContainerType> { | ||
|
||
/** | ||
* We have to replicate cardinality here from PBmmContainerProperty since we are inheriting from | ||
* PBmmProperty<PBmmIndexedContainerType> (which creates correct typing of typeDef) not PBmmContainerProperty | ||
*/ | ||
private Interval<Integer> cardinality; | ||
|
||
public Interval<Integer> getCardinality() { | ||
return cardinality; | ||
} | ||
public void setCardinality(Interval<Integer> cardinality) { | ||
this.cardinality = cardinality; | ||
} | ||
public PBmmIndexedContainerProperty() { | ||
super(); | ||
} | ||
@Override | ||
public BmmIndexedContainerProperty createBmmProperty(BmmClassProcessor classProcessor, BmmClass bmmClass) { | ||
PBmmIndexedContainerType typeRef = getTypeRef(); | ||
if (typeRef != null) { | ||
BmmIndexedContainerType bmmType = (BmmIndexedContainerType) typeRef.createBmmType(classProcessor, bmmClass); | ||
BmmIndexedContainerProperty bmmProperty = new BmmIndexedContainerProperty(getName(), bmmType, getDocumentation(), nullToFalse(isMandatory()), nullToFalse(isComputed())); | ||
if (getCardinality() != null) { | ||
bmmProperty.setCardinality(new MultiplicityInterval(getCardinality())); | ||
} | ||
populateImBooleans(bmmProperty); | ||
return bmmProperty; | ||
} | ||
throw new RuntimeException("BmmTypeCreate failed for type " + typeRef + " of property " | ||
+ getName() + " in class " + bmmClass.getName()); | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
bmm/src/main/java/org/openehr/bmm/v2/persistence/PBmmIndexedContainerType.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,57 @@ | ||
package org.openehr.bmm.v2.persistence; | ||
|
||
import org.openehr.bmm.core.*; | ||
import org.openehr.bmm.persistence.validation.BmmDefinitions; | ||
import org.openehr.bmm.v2.validation.converters.BmmClassProcessor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class PBmmIndexedContainerType extends PBmmContainerType { | ||
|
||
private String indexType; | ||
|
||
public String getIndexType() { | ||
return indexType; | ||
} | ||
|
||
public void setIndexType(String indexType) { | ||
this.indexType = indexType; | ||
} | ||
|
||
@Override | ||
public BmmIndexedContainerType createBmmType(BmmClassProcessor processor, BmmClass classDefinition) { | ||
BmmClass containerClassDef = processor.getClassDefinition (getContainerType()); | ||
BmmClass indexClassDef = processor.getClassDefinition (indexType); | ||
PBmmUnitaryType containedType = getTypeRef(); //get the actual typeref for conversion | ||
if (containerClassDef instanceof BmmGenericClass && | ||
indexClassDef instanceof BmmSimpleClass && | ||
containedType != null) | ||
{ | ||
BmmType containedBmmType = containedType.createBmmType(processor, classDefinition); | ||
if (containedBmmType instanceof BmmUnitaryType) { | ||
return new BmmIndexedContainerType((BmmUnitaryType) containedBmmType, | ||
((BmmSimpleClass) indexClassDef).getType(), | ||
(BmmGenericClass) containerClassDef); | ||
} | ||
} | ||
|
||
throw new RuntimeException("BmmClass " + containerClassDef.getName() + " is not defined in this model or not an indexed container type"); | ||
} | ||
@Override | ||
public String asTypeString() { | ||
return getContainerType() + BmmDefinitions.GENERIC_LEFT_DELIMITER + | ||
indexType + BmmDefinitions.GENERIC_SEPARATOR + getTypeRef().asTypeString() + | ||
BmmDefinitions.GENERIC_RIGHT_DELIMITER; | ||
} | ||
@Override | ||
public List<String> flattenedTypeList() { | ||
List<String> result = new ArrayList<>(); | ||
result.add(getContainerType()); | ||
result.add(indexType); | ||
if (getTypeRef() != null) { | ||
result.addAll(getTypeRef().flattenedTypeList()); | ||
} | ||
return result; | ||
} | ||
} |
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
Oops, something went wrong.