diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderGenericMultiFileMojo.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderGenericMultiFileMojo.java
index d858521ede3..27f19b7f722 100644
--- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderGenericMultiFileMojo.java
+++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderGenericMultiFileMojo.java
@@ -57,7 +57,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
*
generateResources |
* Should files be generated from FHIR resource metadata?
* Valid values: true | false |
- * At least one of these four options must be specified |
+ * One of these four options must be specified |
*
*
* generateDataTypes |
@@ -82,9 +82,9 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* for FHIR resources or composite data types. There is one file
* generated for each selected entity. The following configuration
* properties control the naming of the generated source files:
- * <targetSourceDirectory>/<packageName>/<filenamePrefix>element-name<filenameSuffix>
+ * <targetSourceDirectory>/<targetPackage>/<filenamePrefix>element-name<filenameSuffix>
* where: element-name is the "title-case" name of the selected resource or composite data type.
- * Note that all dots in the packageName will be replaced by the path separator character when building the
+ * Note that all dots in the targetPackage will be replaced by the path separator character when building the
* actual source file location. Also note that .java
will be added to the filenameSuffix if it is not already included.
*
*
@@ -94,7 +94,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* Yes when Java source files are to be generated |
*
*
- * packageName |
+ * targetPackage |
* The Java package that will contain the generated classes.
* This package is generated in the <targetSourceDirectory> if needed. |
* Yes when targetSourceDirectory is specified |
@@ -119,7 +119,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* Maven resource files can also be generated
* for FHIR resources or composite data types. The following configuration
* properties control the naming of the generated resource files:
- * <targetResourceDirectory>/<folderName>/<filenamePrefix>element-name<filenameSuffix>
+ * <targetResourceDirectory>/<targetFolder>/<filenamePrefix>element-name<filenameSuffix>
* where: element-name is the "title-case" name of the selected resource or composite data type.
* |
*
@@ -129,7 +129,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* Yes when resource files are to be generated |
*
*
- * folderName |
+ * targetFolder |
* The folder within the targetResourceDirectory where the generated files will be placed.
* This folder is generated in the <targetResourceDirectory> if needed. |
* No |
@@ -217,7 +217,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
private File targetSourceDirectory;
@Parameter(required = false)
- private String packageName;
+ private String targetPackage;
@Parameter(required = false)
private String filenamePrefix;
@@ -229,7 +229,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
private File targetResourceDirectory;
@Parameter(required = false)
- private String folderName;
+ private String targetFolder;
// one of these two is required
@Parameter(required = false)
@@ -284,21 +284,24 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
}
targetType = TargetType.SOURCE;
- if (null == packageName) {
- throw new MojoFailureException("The [packageName] property must be specified when generating Java source code.");
+ if (null == targetPackage) {
+ throw new MojoFailureException("The [targetPackage] property must be specified when generating Java source code.");
}
- targetDirectory = new File(targetSourceDirectory, packageName.replace('.', File.separatorChar));
+ targetDirectory = new File(targetSourceDirectory, targetPackage.replace('.', File.separatorChar));
} else
if (targetResourceDirectory != null) {
if (targetSourceDirectory != null) {
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
}
targetType = TargetType.RESOURCE;
- if (folderName != null) {
- targetDirectory = new File(targetResourceDirectory, folderName);
+ if (targetFolder != null) {
+ targetDirectory = new File(targetResourceDirectory, targetFolder);
} else {
targetDirectory = targetResourceDirectory;
}
+ if (null == targetPackage) {
+ targetPackage = "";
+ }
} else {
throw new MojoFailureException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
}
@@ -316,7 +319,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
rp.setTemplate(template);
rp.setTemplateFile(templateFile);
rp.setVelocityPath(velocityPath);
- rp.writeAll(targetType, targetDirectory, null, packageName);
+ rp.writeAll(targetType, targetDirectory, null, targetPackage);
}
/*
@@ -330,7 +333,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
dtp.setTemplate(template);
dtp.setTemplateFile(templateFile);
dtp.setVelocityPath(velocityPath);
- dtp.writeAll(targetType, targetDirectory, null, packageName);
+ dtp.writeAll(targetType, targetDirectory, null, targetPackage);
}
/*
@@ -344,7 +347,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
vsp.setTemplate(template);
vsp.setTemplateFile(templateFile);
vsp.setVelocityPath(velocityPath);
- vsp.writeMarkedValueSets(targetType, targetDirectory, packageName);
+ vsp.writeMarkedValueSets(targetType, targetDirectory, targetPackage);
}
/*
@@ -358,18 +361,22 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
pp.setTemplate(template);
pp.setTemplateFile(templateFile);
pp.setVelocityPath(velocityPath);
- pp.writeAll(targetType, targetDirectory, null, packageName);
+ pp.writeAll(targetType, targetDirectory, null, targetPackage);
}
switch (targetType) {
case SOURCE: {
- myProject.addCompileSourceRoot(targetDirectory.getAbsolutePath());
+ myProject.addCompileSourceRoot(targetSourceDirectory.getAbsolutePath());
break;
}
case RESOURCE: {
Resource resource = new Resource();
- resource.setDirectory(targetDirectory.getAbsolutePath());
- resource.addInclude("*");
+ resource.setDirectory(targetResourceDirectory.getAbsolutePath());
+ if (targetFolder != null) {
+ resource.addInclude(targetFolder+"/*");
+ } else {
+ resource.addInclude("*");
+ }
myProject.addResource(resource);
break;
}
@@ -398,7 +405,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
TinderGenericMultiFileMojo mojo = new TinderGenericMultiFileMojo();
mojo.myProject = new MavenProject();
mojo.version = "dstu2";
- mojo.packageName = "ca.uhn.test";
+ mojo.targetPackage = "ca.uhn.test";
mojo.template = "/vm/jpa_resource_provider.vm";
mojo.targetSourceDirectory = new File("target/generated/valuesets");
mojo.execute();
diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderGenericSingleFileMojo.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderGenericSingleFileMojo.java
index c522c326df3..ca8b87aed15 100644
--- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderGenericSingleFileMojo.java
+++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/TinderGenericSingleFileMojo.java
@@ -66,7 +66,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* generateResources |
* Should files be generated from FHIR resource metadata?
* Valid values: true | false |
- * At least one of these two options must be specified |
+ * One of these two options must be specified |
*
*
* generateDataTypes |
@@ -81,8 +81,8 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* for FHIR resources or composite data types. There is one file
* generated for each selected entity. The following configuration
* properties control the naming of the generated source files:
- * <targetSourceDirectory>/<packageName>/<targetFile>
- * Note that all dots in the packageName will be replaced by the path separator character when building the
+ * <targetSourceDirectory>/<targetPackage>/<targetFile>
+ * Note that all dots in the targetPackage will be replaced by the path separator character when building the
* actual source file location. Also note that .java
will be added to the targetFile if it is not already included.
*
*
@@ -92,12 +92,18 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* Yes when a Java source file is to be generated |
*
*
- * packageName |
+ * targetPackage |
* The Java package that will contain the generated classes.
* This package is generated in the <targetSourceDirectory> if needed. |
* Yes when targetSourceDirectory is specified |
*
*
+ * packageBase |
+ * The base Java package for related classes. This property
+ * can be used to reference class in other places in a folder structure. |
+ * No |
+ *
+ *
* targetFile |
* The name of the file to be generated |
* Yes |
@@ -109,7 +115,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* Maven resource files can also be generated
* for FHIR resources or composite data types. The following configuration
* properties control the naming of the generated resource files:
- * <targetResourceDirectory>/<folderName>/<targetFile>
+ * <targetResourceDirectory>/<targetFolder>/<targetFile>
* |
*
*
@@ -118,7 +124,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* Yes when a resource file is to be generated |
*
*
- * folderName |
+ * targetFolder |
* The folder within the targetResourceDirectory where the generated file will be placed.
* This folder is generated in the <targetResourceDirectory> if needed. |
* No |
@@ -200,13 +206,16 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
private File targetSourceDirectory;
@Parameter(required = false)
- private String packageName;
+ private String targetPackage;
+
+ @Parameter(required = false)
+ private String packageBase;
@Parameter(required = false)
private File targetResourceDirectory;
@Parameter(required = false)
- private String folderName;
+ private String targetFolder;
@Parameter(required = false)
private String targetFile;
@@ -268,10 +277,10 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
}
targetType = TargetType.SOURCE;
- if (null == packageName) {
+ if (null == targetPackage) {
throw new MojoFailureException("The [targetPackage] property must be specified when generating Java source code.");
}
- targetDirectory = new File(targetSourceDirectory, packageName.replace('.', File.separatorChar));
+ targetDirectory = new File(targetSourceDirectory, targetPackage.replace('.', File.separatorChar));
if (!targetFile.endsWith(".java")) {
targetFile += ".java";
}
@@ -281,13 +290,16 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
}
targetType = TargetType.RESOURCE;
- if (folderName != null) {
- folderName = folderName.replace('\\', '/');
- folderName = folderName.replace('/', File.separatorChar);
- targetDirectory = new File(targetResourceDirectory, folderName);
+ if (targetFolder != null) {
+ targetFolder = targetFolder.replace('\\', '/');
+ targetFolder = targetFolder.replace('/', File.separatorChar);
+ targetDirectory = new File(targetResourceDirectory, targetFolder);
} else {
targetDirectory = targetResourceDirectory;
}
+ if (null == targetPackage) {
+ targetPackage = "";
+ }
} else {
throw new MojoFailureException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
}
@@ -326,9 +338,19 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
* build new Velocity Context
*/
VelocityContext ctx = new VelocityContext();
- int ix = packageName.lastIndexOf('.');
- ctx.put("packageBase", packageName.subSequence(0, ix));
- ctx.put("targetPackage", packageName);
+ if (packageBase != null) {
+ ctx.put("packageBase", packageBase);
+ } else
+ if (targetPackage != null) {
+ int ix = targetPackage.lastIndexOf('.');
+ if (ix > 0) {
+ ctx.put("packageBase", targetPackage.subSequence(0, ix));
+ } else {
+ ctx.put("packageBase", targetPackage);
+ }
+ }
+ ctx.put("targetPackage", targetPackage);
+ ctx.put("targetFolder", targetFolder);
ctx.put("version", version);
ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi());
ctx.put("hash", "#");
@@ -366,15 +388,15 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
switch (targetType) {
case SOURCE: {
- myProject.addCompileSourceRoot(targetDirectory.getAbsolutePath());
+ myProject.addCompileSourceRoot(targetSourceDirectory.getAbsolutePath());
break;
}
case RESOURCE: {
Resource resource = new Resource();
- resource.setDirectory(targetDirectory.getAbsolutePath());
+ resource.setDirectory(targetResourceDirectory.getAbsolutePath());
String resName = targetFile;
- if (folderName != null) {
- resName = folderName+File.separator+targetFile;
+ if (targetFolder != null) {
+ resName = targetFolder+File.separator+targetFile;
}
resource.addInclude(resName);
myProject.addResource(resource);
@@ -409,7 +431,7 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
mojo.myProject = new MavenProject();
mojo.template = "/vm/jpa_spring_beans.vm";
mojo.version = "dstu2";
- mojo.packageName = "ca.uhn.test";
+ mojo.targetPackage = "ca.uhn.test";
mojo.targetSourceDirectory = new File("target/generated/valuesets");
mojo.targetFile = "tmp_beans.xml";
mojo.execute();
diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ant/TinderGeneratorTask.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ant/TinderGeneratorTask.java
index 73f3451cfb8..63533c25467 100644
--- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ant/TinderGeneratorTask.java
+++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ant/TinderGeneratorTask.java
@@ -113,12 +113,12 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* be generated containing all of the selected entity. The following configuration
* properties control the naming of the generated source files:
* The following properties will be used when generating multiple source files:
- * <targetSourceDirectory>/<packageName>/<filenamePrefix>element-name<filenameSuffix>
+ * <targetSourceDirectory>/<targetPackage>/<filenamePrefix>element-name<filenameSuffix>
* where: element-name is the "title-case" name of the selected resource or composite data type.
*
The following properties will be used when generating a single source file:
- * <targetSourceDirectory>/<packageName>/<targetFile>
+ * <targetSourceDirectory>/<targetPackage>/<targetFile>
*
- * Note that all dots in the packageName will be replaced by the path separator character when building the
+ * Note that all dots in the targetPackage will be replaced by the path separator character when building the
* actual source file location. Also note that .java
will be added to the filenameSuffix or targetFile if it is not already included.
*
*
@@ -128,12 +128,18 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* Yes when Java source files are to be generated |
*
*
- * packageName |
+ * targetPackage |
* The Java package that will contain the generated classes.
* This package is generated in the <targetSourceDirectory> if needed. |
* Yes when targetSourceDirectory is specified |
*
*
+ * packageBase |
+ * The base Java package for related classes. This property
+ * can be used to reference class in other places in a folder structure. |
+ * No |
+ *
+ *
* targetFile |
* The name of the file to be generated |
* Yes when generating a single file containing all selected elements |
@@ -161,10 +167,10 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* be generated containing all of the selected entity. The following configuration
* properties control the naming of the generated files:
* The following properties will be used when generating multiple files (one for each selected element):
- * <targetResourceDirectory>/<folderName>/<filenamePrefix>element-name<filenameSuffix>
+ * <targetResourceDirectory>/<targetFolder>/<filenamePrefix>element-name<filenameSuffix>
* where: element-name is the "title-case" name of the selected resource or composite data type.
*
The following properties will be used when generating a single file containing all selected elements:
- * <targetResourceDirectory>/<folderName>/<targetFile>
+ * <targetResourceDirectory>/<targetFolder>/<targetFile>
*
*
*
@@ -173,7 +179,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
* Yes when resource files are to be generated |
*
*
- * folderName |
+ * targetFolder |
* The folder within the targetResourceDirectory where the generated files will be placed.
* This folder is generated in the <targetResourceDirectory> if needed. |
* No |
@@ -250,7 +256,9 @@ public class TinderGeneratorTask extends Task {
private File targetSourceDirectory;
- private String packageName;
+ private String targetPackage;
+
+ private String packageBase;
private String targetFile;
@@ -260,7 +268,7 @@ public class TinderGeneratorTask extends Task {
private File targetResourceDirectory;
- private String folderName;
+ private String targetFolder;
// one of these two is required
private String template;
@@ -319,21 +327,24 @@ public class TinderGeneratorTask extends Task {
throw new BuildException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
}
targetType = TargetType.SOURCE;
- if (null == packageName) {
- throw new BuildException("The [packageName] property must be specified when generating Java source code.");
+ if (null == targetPackage) {
+ throw new BuildException("The [targetPackage] property must be specified when generating Java source code.");
}
- targetDirectory = new File(targetSourceDirectory, packageName.replace('.', File.separatorChar));
+ targetDirectory = new File(targetSourceDirectory, targetPackage.replace('.', File.separatorChar));
} else
if (targetResourceDirectory != null) {
if (targetSourceDirectory != null) {
throw new BuildException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
}
targetType = TargetType.RESOURCE;
- if (folderName != null) {
- targetDirectory = new File(targetResourceDirectory, folderName);
+ if (targetFolder != null) {
+ targetDirectory = new File(targetResourceDirectory, targetFolder);
} else {
targetDirectory = targetResourceDirectory;
}
+ if (null == targetPackage) {
+ targetPackage = "";
+ }
} else {
throw new BuildException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
}
@@ -383,9 +394,19 @@ public class TinderGeneratorTask extends Task {
* build new Velocity Context
*/
VelocityContext ctx = new VelocityContext();
- int ix = packageName.lastIndexOf('.');
- ctx.put("packageBase", packageName.subSequence(0, ix));
- ctx.put("targetPackage", packageName);
+ if (packageBase != null) {
+ ctx.put("packageBase", packageBase);
+ } else
+ if (targetPackage != null) {
+ int ix = targetPackage.lastIndexOf('.');
+ if (ix > 0) {
+ ctx.put("packageBase", targetPackage.subSequence(0, ix));
+ } else {
+ ctx.put("packageBase", targetPackage);
+ }
+ }
+ ctx.put("targetPackage", targetPackage);
+ ctx.put("targetFolder", targetFolder);
ctx.put("version", version);
ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi());
ctx.put("hash", "#");
@@ -436,7 +457,7 @@ public class TinderGeneratorTask extends Task {
rp.setTemplate(template);
rp.setTemplateFile(templateFile);
rp.setVelocityPath(velocityPath);
- rp.writeAll(targetType, targetDirectory, null, packageName);
+ rp.writeAll(targetType, targetDirectory, null, targetPackage);
}
/*
@@ -450,7 +471,7 @@ public class TinderGeneratorTask extends Task {
dtp.setTemplate(template);
dtp.setTemplateFile(templateFile);
dtp.setVelocityPath(velocityPath);
- dtp.writeAll(targetType, targetDirectory, null, packageName);
+ dtp.writeAll(targetType, targetDirectory, null, targetPackage);
}
/*
@@ -464,7 +485,7 @@ public class TinderGeneratorTask extends Task {
vsp.setTemplate(template);
vsp.setTemplateFile(templateFile);
vsp.setVelocityPath(velocityPath);
- vsp.writeMarkedValueSets(targetType, targetDirectory, packageName);
+ vsp.writeMarkedValueSets(targetType, targetDirectory, targetPackage);
}
/*
@@ -478,7 +499,7 @@ public class TinderGeneratorTask extends Task {
pp.setTemplate(template);
pp.setTemplateFile(templateFile);
pp.setVelocityPath(velocityPath);
- pp.writeAll(targetType, targetDirectory, null, packageName);
+ pp.writeAll(targetType, targetDirectory, null, targetPackage);
}
}
@@ -550,8 +571,12 @@ public class TinderGeneratorTask extends Task {
this.targetSourceDirectory = targetSourceDirectory;
}
- public void setPackageName(String packageName) {
- this.packageName = packageName;
+ public void setTargetPackage(String targetPackage) {
+ this.targetPackage = targetPackage;
+ }
+
+ public void setPackageBase(String packageBase) {
+ this.packageBase = packageBase;
}
public void setTargetFile(String targetFile) {
@@ -570,8 +595,8 @@ public class TinderGeneratorTask extends Task {
this.targetResourceDirectory = targetResourceDirectory;
}
- public void setFolderName(String folderName) {
- this.folderName = folderName;
+ public void setTaargetFolder(String targetFolder) {
+ this.targetFolder = targetFolder;
}
public void setTemplate(String template) {
diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java
index 1e9ae568cff..f59e210c761 100644
--- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java
+++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java
@@ -180,11 +180,11 @@ public abstract class BaseStructureParser {
}
protected String getFilenamePrefix() {
- return myFilenamePrefix;
+ return myFilenamePrefix != null ? myFilenamePrefix : "";
}
protected String getFilenameSuffix() {
- return myFilenameSuffix;
+ return myFilenameSuffix != null ? myFilenameSuffix : "";
}
public Map getLocalImports() {
@@ -536,6 +536,7 @@ public abstract class BaseStructureParser {
capitalize = "Dstu1";
}
ctx.put("versionCapitalized", capitalize);
+ ctx.put("this", theResource);
VelocityEngine v = new VelocityEngine();
InputStream templateIs = null;
diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml
index f04d19eb32c..f7367e5410b 100644
--- a/hapi-tinder-test/pom.xml
+++ b/hapi-tinder-test/pom.xml
@@ -24,6 +24,11 @@
hapi-fhir-structures-dstu
2.2-SNAPSHOT
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-structures-dstu2
+ 2.2-SNAPSHOT
+
junit
@@ -104,14 +109,34 @@
dstu
+ true
${project.basedir}/src/test/resources/templates/resource_test.vm
- ca.uhn.test.generic.multi
- ${project.build.directory}/generated-sources/tinder
+ ${project.build.directory}/generated-sources/tinder
+ ca.uhn.test.generic.multi
ResourceTest.java
-
- patient
- organization
-
+
+ patient
+ organization
+
+
+
+
+ generic_multi_json
+
+ generate-multi-files
+
+
+ dstu2
+ true
+ ${project.basedir}/src/test/resources/templates/resource_map.vm
+ ${project.basedir}/src/test/resources/macros
+ ${project.build.directory}/generated-resources/tinder
+ maps
+ _Map.json
+
+ patient
+ organization
+
@@ -121,26 +146,56 @@
dstu
+ true
${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm
- ca.uhn.test.generic.multi
- ${project.build.directory}/generated-sources/tinder
+ ${project.build.directory}/generated-sources/tinder
ca.uhn.test.generic.single
+ ca.uhn.test.generic.multi
TestConfigDstu1.java
-
- patient
- organization
-
+
+ patient
+ organization
+
+
+
+
+ generic_single_json
+
+ generate-single-file
+
+
+ dstu2
+ true
+ ${project.basedir}/src/test/resources/templates/composite_map.vm
+ ${project.basedir}/src/test/resources/macros
+ ${project.build.directory}/generated-resources/tinder
+ maps
+ Datatypes_Dstu2.json
+
+ patient
+ organization
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-base
+ 2.2-SNAPSHOT
+
ca.uhn.hapi.fhir
hapi-fhir-structures-dstu
2.2-SNAPSHOT
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-structures-dstu2
+ 2.2-SNAPSHOT
+
@@ -157,22 +212,24 @@
diff --git a/hapi-tinder-test/src/test/resources/macros/dump_templates.vm b/hapi-tinder-test/src/test/resources/macros/dump_templates.vm
new file mode 100644
index 00000000000..c7b8fb75f38
--- /dev/null
+++ b/hapi-tinder-test/src/test/resources/macros/dump_templates.vm
@@ -0,0 +1,84 @@
+##################################################################
+## dumpBaseElement
+##################################################################
+#macro ( dumpBaseElement $lead, $elem )
+${lead}BaseElement:
+${lead} binding: $!{elem.binding}
+${lead} bindingClass: $!{elem.bindingClass}
+${lead} cardMax: $!{elem.cardMax}
+${lead} cardMin: $!{elem.cardMin}
+${lead} comments: $!{elem.comments}
+${lead} declaringClassNameComplete: $!{elem.declaringClassNameComplete}
+${lead} declaringClassNameCompleteForChildren: $!{elem.declaringClassNameCompleteForChildren}
+${lead} definition: $!{elem.definition}
+${lead} elementName: $!{elem.elementName}
+${lead} elementParentName: $!{elem.elementParentName}
+${lead} extensionUrl: $!{elem.extensionUrl}
+${lead} name: $!{elem.name}
+${lead} requirement: $!{elem.requirement}
+${lead} shortName: $!{elem.shortName}
+${lead} type: [#{foreach}(${t} in $!{elem.type})${t}#{if}($foreach.hasNext),#{end}#{end}]
+${lead} v2Mapping: $!{elem.v2Mapping}
+${lead} isExtensionLocal: $!{elem.extensionLocal}
+${lead} isExtensionModifier: $!{elem.extensionModifier}
+${lead} isHasExtensionUrl: $!{elem.hasExtensionUrl}
+${lead} isHasMultipleTypes: $!{elem.hasMultipleTypes}
+${lead} isModifier: $!{elem.modifier}
+${lead} isResourceRef: $!{elem.resourceRef}
+${lead} isSummary: $!{elem.summary}
+#end
+##################################################################
+## dumpChild
+##################################################################
+#macro ( dumpChild $lead, $child )
+${lead}Child:
+${lead} annotationType: $!{child.annotationType}
+#set ( $st = $!{child.singleType} )
+${lead} boundDatatype: #{if}(${st}=="CodeDt"||${st}=="CodeableConceptDt")$!{child.boundDatatype}#{end} .
+${lead} cardMaxForChildAnnotation: $!{child.cardMaxForChildAnnotation}
+${lead} elementNameSimplified: $!{child.elementNameSimplified}
+${lead} methodName: $!{child.methodName}
+${lead} referenceType: $!{child.referenceType}
+${lead} referenceTypeForConstructor: $!{child.referenceTypeForConstructor}
+${lead} referenceTypesForMultiple: $!{child.referenceTypesForMultiple}
+${lead} singleType: $!{child.singleType}
+${lead} variableName: $!{child.variableName}
+${lead} isBlock: $!{child.block}
+${lead} isPrimitive: $!{child.primitive}
+${lead} primitiveType: #{if}(${child.primitive})$!{child.primitiveType}#{end} .
+${lead} isBoundCode: $!{child.boundCode}
+${lead} isRepeatable: $!{child.repeatable}
+${lead} isSingleChildInstantiable: $!{child.singleChildInstantiable}
+#end ## of macro
+##################################################################
+## childVars
+##################################################################
+#macro ( childVars $lead, $childElements )
+#foreach ( $child in $childElements )
+
+${lead}Child: $!{child.elementName}
+${lead} Class: $child.class.name
+#dumpBaseElement ("${lead} ", $child )
+#dumpChild ("${lead} ", $child )
+#end ## end for-each on child
+#end ## of macro
+##################################################################
+## childResourceBlocks
+##################################################################
+#macro ( childResourceBlocks $lead, $resourceBlockChildren )
+#foreach ( $blockChild in $resourceBlockChildren )
+
+${lead}Block: $!{blockChild.name}
+${lead} Class: $blockChild.class.name
+#dumpBaseElement ("${lead} ", $blockChild )
+#dumpChild ("${lead} ", $blockChild )
+${lead} ResourceBlock:
+${lead} className: $!{blockChild.className}
+
+${lead} Children:
+#childVars( "${lead} ", $blockChild.children )
+
+${lead} Blocks:
+#childResourceBlocks( "${lead} ", $blockChild.resourceBlockChildren )
+#end
+#end
\ No newline at end of file
diff --git a/hapi-tinder-test/src/test/resources/templates/composite_map.vm b/hapi-tinder-test/src/test/resources/templates/composite_map.vm
new file mode 100644
index 00000000000..dde5893d044
--- /dev/null
+++ b/hapi-tinder-test/src/test/resources/templates/composite_map.vm
@@ -0,0 +1,21 @@
+#parse ( "dump_templates.vm" )
+#foreach ( $d in $datatypes )
+Type: ${d.elementName}
+ Class: $d.class.name
+#dumpBaseElement (" ", $d)
+ BaseRootType:
+ id: $!{d.id}
+ profile: $!{d.profile}
+ Composite:
+ --
+
+Children:
+#childVars( " ", $d.children )
+
+Blocks
+#childResourceBlocks(" ", $d.resourceBlockChildren)
+
+================================================================================
+================================================================================
+
+#end
diff --git a/hapi-tinder-test/src/test/resources/templates/resource_map.vm b/hapi-tinder-test/src/test/resources/templates/resource_map.vm
new file mode 100644
index 00000000000..486bb1e54fb
--- /dev/null
+++ b/hapi-tinder-test/src/test/resources/templates/resource_map.vm
@@ -0,0 +1,17 @@
+#parse ( "dump_templates.vm" )
+Resource: ${elementName}
+ Class: ${this.class.name}
+#dumpBaseElement (" ", ${this} )
+ BaseRootType:
+ id: $!{this.id}
+ profile: $!{this.profile}
+ Resource:
+ searchParameterNames: #{foreach}(${n} in ${this.searchParameterNames})${n}#{if}($foreach.hasNext), #{end}#{end}
+
+
+Children:
+#childVars( " ", $children )
+
+Blocks:
+#childResourceBlocks( " ", $resourceBlockChildren)
+