fix generate-multi-file and generate-single-file goals with R5 (#4134)

* fix generate-multi-file and generate-single-file goals with R5
structures

* clean up Javadoc & fix R5 issue when generating for all resources
This commit is contained in:
William Denton 2022-10-24 15:42:29 -07:00 committed by GitHub
parent 5328951f15
commit 51627fb873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 143 additions and 7 deletions

View File

@ -102,6 +102,11 @@
<artifactId>hapi-fhir-validation-resources-r4</artifactId> <artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>6.2.0-PRE17-SNAPSHOT</version> <version>6.2.0-PRE17-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r5</artifactId>
<version>6.2.0-PRE9-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.velocity</groupId> <groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId> <artifactId>velocity-engine-core</artifactId>

View File

@ -52,6 +52,9 @@ public abstract class AbstractGenerator {
} else if ("r4".equals(context.getVersion())) { } else if ("r4".equals(context.getVersion())) {
fhirContext = FhirContext.forR4(); fhirContext = FhirContext.forR4();
packageSuffix = ".r4"; packageSuffix = ".r4";
} else if ("r5".equals(context.getVersion())) {
fhirContext = FhirContext.forR5();
packageSuffix = ".r5";
} else { } else {
throw new FailureException(Msg.code(95) + "Unknown version configured: " + context.getVersion()); throw new FailureException(Msg.code(95) + "Unknown version configured: " + context.getVersion());
} }

View File

@ -45,6 +45,10 @@ public class Configuration {
fhirContext = FhirContext.forR4(); fhirContext = FhirContext.forR4();
packageSuffix = ".r4"; packageSuffix = ".r4";
break; break;
case "r5":
fhirContext = FhirContext.forR5();
packageSuffix = ".r5";
break;
default: default:
throw new IllegalArgumentException(Msg.code(92) + "Unknown version configured: " + version); throw new IllegalArgumentException(Msg.code(92) + "Unknown version configured: " + version);
} }

View File

@ -43,7 +43,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* <td valign="top">version</td> * <td valign="top">version</td>
* <td valign="top">The FHIR version whose resource metadata * <td valign="top">The FHIR version whose resource metadata
* is to be used to generate the files<br> * is to be used to generate the files<br>
* Valid values:&nbsp;<code><b>dstu2</b></code>&nbsp;|&nbsp;<code><b>dstu3</b></code>&nbsp;|&nbsp;<code><b>r4</b></code></td> * Valid values:&nbsp;<code><b>dstu2</b></code>&nbsp;|&nbsp;<code><b>dstu3</b></code>&nbsp;|&nbsp;<code><b>r4</b></code>&nbsp;|&nbsp;<code><b>r5</b></code></td>
* <td valign="top" align="center">Yes</td> * <td valign="top" align="center">Yes</td>
* </tr> * </tr>
* <tr> * <tr>

View File

@ -53,7 +53,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* <td valign="top">version</td> * <td valign="top">version</td>
* <td valign="top">The FHIR version whose resource metadata * <td valign="top">The FHIR version whose resource metadata
* is to be used to generate the files<br> * is to be used to generate the files<br>
* Valid values:&nbsp;<code><b>dstu2</b></code>&nbsp;|&nbsp;<code><b>dstu3</b></code>&nbsp;|&nbsp;<code><b>r4</b></code></td> * Valid values:&nbsp;<code><b>dstu2</b></code>&nbsp;|&nbsp;<code><b>dstu3</b></code>&nbsp;|&nbsp;<code><b>r4</b></code>&nbsp;|&nbsp;<code><b>r5</b></code></td>
* <td valign="top" align="center">Yes</td> * <td valign="top" align="center">Yes</td>
* </tr> * </tr>
* <tr> * <tr>

View File

@ -73,7 +73,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* <td valign="top">version</td> * <td valign="top">version</td>
* <td valign="top">The FHIR version whose resource metadata * <td valign="top">The FHIR version whose resource metadata
* is to be used to generate the files<br> * is to be used to generate the files<br>
* Valid values:&nbsp;<code><b>dstu2</b></code>&nbsp;|&nbsp;<code><b>dstu3</b></code>&nbsp;|&nbsp;<code><b>r4</b></code></td> * Valid values:&nbsp;<code><b>dstu2</b></code>&nbsp;|&nbsp;<code><b>dstu3</b></code>&nbsp;|&nbsp;<code><b>r4</b></code>&nbsp;|&nbsp;<code><b>r5</b></code></td>
* <td valign="top" align="center">Yes</td> * <td valign="top" align="center">Yes</td>
* </tr> * </tr>
* <tr> * <tr>

View File

@ -104,6 +104,11 @@
<artifactId>hapi-fhir-structures-r4</artifactId> <artifactId>hapi-fhir-structures-r4</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r5</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId> <artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
@ -124,6 +129,11 @@
<artifactId>hapi-fhir-validation-resources-r4</artifactId> <artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r5</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
<executions> <executions>
<!-- <!--
@ -234,6 +244,25 @@
</includeResources> </includeResources>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>generic_multi_r5</id>
<goals>
<goal>generate-multi-files</goal>
</goals>
<configuration>
<version>r5</version>
<generateResources>true</generateResources>
<resourceSource>model</resourceSource>
<templateFile>${project.basedir}/src/test/resources/templates/resource_test.vm</templateFile>
<targetSourceDirectory>${project.build.directory}/generated-sources/tinder</targetSourceDirectory>
<targetPackage>ca.uhn.test.generic.multi.r5</targetPackage>
<filenameSuffix>ResourceTest.java</filenameSuffix>
<includeResources>
<includeResource>patient</includeResource>
<includeResource>organization</includeResource>
</includeResources>
</configuration>
</execution>
<execution> <execution>
<id>generic_multi_json</id> <id>generic_multi_json</id>
<goals> <goals>
@ -275,6 +304,26 @@
</includeResources> </includeResources>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>generic_single_dstu3</id>
<goals>
<goal>generate-single-file</goal>
</goals>
<configuration>
<version>dstu3</version>
<generateResources>true</generateResources>
<resourceSource>model</resourceSource>
<templateFile>${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm</templateFile>
<targetSourceDirectory>${project.build.directory}/generated-sources/tinder</targetSourceDirectory>
<targetPackage>ca.uhn.test.generic.single</targetPackage>
<packageBase>ca.uhn.test.generic.multi</packageBase>
<targetFile>TestConfigDstu3.java</targetFile>
<includeResources>
<includeResource>patient</includeResource>
<includeResource>organization</includeResource>
</includeResources>
</configuration>
</execution>
<execution> <execution>
<id>generic_single_r4</id> <id>generic_single_r4</id>
<goals> <goals>
@ -295,6 +344,26 @@
</includeResources> </includeResources>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>generic_single_r5</id>
<goals>
<goal>generate-single-file</goal>
</goals>
<configuration>
<version>r5</version>
<generateResources>true</generateResources>
<resourceSource>model</resourceSource>
<templateFile>${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm</templateFile>
<targetSourceDirectory>${project.build.directory}/generated-sources/tinder</targetSourceDirectory>
<targetPackage>ca.uhn.test.generic.single.r5</targetPackage>
<packageBase>ca.uhn.test.generic.multi.r5</packageBase>
<targetFile>TestConfigR5.java</targetFile>
<includeResources>
<includeResource>patient</includeResource>
<includeResource>organization</includeResource>
</includeResources>
</configuration>
</execution>
<execution> <execution>
<id>generic_single_json</id> <id>generic_single_json</id>
<goals> <goals>
@ -331,11 +400,46 @@
<target> <target>
<taskdef name="hapi-tinder" classname="ca.uhn.fhir.tinder.ant.TinderGeneratorTask" classpathref="maven.plugin.classpath" /> <taskdef name="hapi-tinder" classname="ca.uhn.fhir.tinder.ant.TinderGeneratorTask" classpathref="maven.plugin.classpath" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test.vm" generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder" <hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test.vm"
targetPackage="ca.uhn.test.ant.multi" filenameSuffix="ResourceTest.java" projectHome="${project.basedir}/.." version="dstu2" includeResources="patient,organization" /> generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetPackage="ca.uhn.test.ant.multi" filenameSuffix="ResourceTest.java" projectHome="${project.basedir}/.."
version="dstu2" includeResources="patient,organization" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm" generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder" <hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test.vm" resourceSource="model"
targetFile="TestConfigDstu2.java" targetPackage="ca.uhn.test.ant.single" packageBase="ca.uhn.test.ant.multi" projectHome="${project.basedir}/.." version="dstu2" includeResources="patient,organization" /> generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetPackage="ca.uhn.test.ant.multi.dstu3" filenameSuffix="ResourceTest.java" projectHome="${project.basedir}/.."
version="dstu3" includeResources="patient,organization" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test.vm" resourceSource="model"
generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetPackage="ca.uhn.test.ant.multi.r4" filenameSuffix="ResourceTest.java" projectHome="${project.basedir}/.."
version="r4" includeResources="patient,organization" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test.vm" resourceSource="model"
generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetPackage="ca.uhn.test.ant.multi.r5" filenameSuffix="ResourceTest.java" projectHome="${project.basedir}/.."
version="r5" includeResources="patient,organization" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm"
generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetFile="TestConfigDstu2.java" targetPackage="ca.uhn.test.ant.single" packageBase="ca.uhn.test.ant.multi"
projectHome="${project.basedir}/.." version="dstu2" includeResources="patient,organization" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm" resourceSource="model"
generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetFile="TestConfigDstu3.java" targetPackage="ca.uhn.test.ant.single" packageBase="ca.uhn.test.ant.multi.dstu3"
projectHome="${project.basedir}/.." version="dstu3" includeResources="patient,organization" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm" resourceSource="model"
generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetFile="TestConfigR4.java" targetPackage="ca.uhn.test.ant.single" packageBase="ca.uhn.test.ant.multi.r4"
projectHome="${project.basedir}/.." version="r4" includeResources="patient,organization" />
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm" resourceSource="model"
generateResources="true" targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
targetFile="TestConfigR5.java" targetPackage="ca.uhn.test.ant.single" packageBase="ca.uhn.test.ant.multi.r5"
projectHome="${project.basedir}/.." version="r5" includeResources="patient,organization" />
</target> </target>
</configuration> </configuration>
@ -368,6 +472,16 @@
<artifactId>hapi-fhir-structures-dstu3</artifactId> <artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r5</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId> <artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
@ -383,6 +497,16 @@
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId> <artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r5</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>