fix/enhance tinder-tests for new functions
This commit is contained in:
parent
698c21c6c1
commit
1452a29a09
|
@ -57,7 +57,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top">generateResources</td>
|
* <td valign="top">generateResources</td>
|
||||||
* <td valign="top">Should files be generated from FHIR resource metadata?<br>
|
* <td valign="top">Should files be generated from FHIR resource metadata?<br>
|
||||||
* Valid values: <code><b>true</b></code> | <code><b>false</b></code></td>
|
* Valid values: <code><b>true</b></code> | <code><b>false</b></code></td>
|
||||||
* <td valign="top" align="center" rowspan="4">At least one of these four options must be specified</td>
|
* <td valign="top" align="center" rowspan="4">One of these four options must be specified</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td valign="top">generateDataTypes</td>
|
* <td valign="top">generateDataTypes</td>
|
||||||
|
@ -82,9 +82,9 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* for FHIR resources or composite data types. There is one file
|
* for FHIR resources or composite data types. There is one file
|
||||||
* generated for each selected entity. The following configuration
|
* generated for each selected entity. The following configuration
|
||||||
* properties control the naming of the generated source files:<br>
|
* properties control the naming of the generated source files:<br>
|
||||||
* <targetSourceDirectory>/<packageName>/<filenamePrefix><i>element-name</i><filenameSuffix><br>
|
* <targetSourceDirectory>/<targetPackage>/<filenamePrefix><i>element-name</i><filenameSuffix><br>
|
||||||
* where: <i>element-name</i> is the "title-case" name of the selected resource or composite data type.<br>
|
* where: <i>element-name</i> is the "title-case" name of the selected resource or composite data type.<br>
|
||||||
* 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 <code>.java</code> will be added to the filenameSuffix if it is not already included.
|
* actual source file location. Also note that <code>.java</code> will be added to the filenameSuffix if it is not already included.
|
||||||
* </td>
|
* </td>
|
||||||
* </tr>
|
* </tr>
|
||||||
|
@ -94,7 +94,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top" align="center">Yes when Java source files are to be generated</td>
|
* <td valign="top" align="center">Yes when Java source files are to be generated</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td valign="top">packageName</td>
|
* <td valign="top">targetPackage</td>
|
||||||
* <td valign="top">The Java package that will contain the generated classes.
|
* <td valign="top">The Java package that will contain the generated classes.
|
||||||
* This package is generated in the <targetSourceDirectory> if needed.</td>
|
* This package is generated in the <targetSourceDirectory> if needed.</td>
|
||||||
* <td valign="top" align="center">Yes when <i>targetSourceDirectory</i> is specified</td>
|
* <td valign="top" align="center">Yes when <i>targetSourceDirectory</i> is specified</td>
|
||||||
|
@ -119,7 +119,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top" colspan="3">Maven resource files can also be generated
|
* <td valign="top" colspan="3">Maven resource files can also be generated
|
||||||
* for FHIR resources or composite data types. The following configuration
|
* for FHIR resources or composite data types. The following configuration
|
||||||
* properties control the naming of the generated resource files:<br>
|
* properties control the naming of the generated resource files:<br>
|
||||||
* <targetResourceDirectory>/<folderName>/<filenamePrefix><i>element-name</i><filenameSuffix><br>
|
* <targetResourceDirectory>/<targetFolder>/<filenamePrefix><i>element-name</i><filenameSuffix><br>
|
||||||
* where: <i>element-name</i> is the "title-case" name of the selected resource or composite data type.
|
* where: <i>element-name</i> is the "title-case" name of the selected resource or composite data type.
|
||||||
* </td>
|
* </td>
|
||||||
* </tr>
|
* </tr>
|
||||||
|
@ -129,7 +129,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top" align="center">Yes when resource files are to be generated</td>
|
* <td valign="top" align="center">Yes when resource files are to be generated</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td valign="top">folderName</td>
|
* <td valign="top">targetFolder</td>
|
||||||
* <td valign="top">The folder within the targetResourceDirectory where the generated files will be placed.
|
* <td valign="top">The folder within the targetResourceDirectory where the generated files will be placed.
|
||||||
* This folder is generated in the <targetResourceDirectory> if needed.</td>
|
* This folder is generated in the <targetResourceDirectory> if needed.</td>
|
||||||
* <td valign="top" align="center">No</td>
|
* <td valign="top" align="center">No</td>
|
||||||
|
@ -217,7 +217,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
|
||||||
private File targetSourceDirectory;
|
private File targetSourceDirectory;
|
||||||
|
|
||||||
@Parameter(required = false)
|
@Parameter(required = false)
|
||||||
private String packageName;
|
private String targetPackage;
|
||||||
|
|
||||||
@Parameter(required = false)
|
@Parameter(required = false)
|
||||||
private String filenamePrefix;
|
private String filenamePrefix;
|
||||||
|
@ -229,7 +229,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
|
||||||
private File targetResourceDirectory;
|
private File targetResourceDirectory;
|
||||||
|
|
||||||
@Parameter(required = false)
|
@Parameter(required = false)
|
||||||
private String folderName;
|
private String targetFolder;
|
||||||
|
|
||||||
// one of these two is required
|
// one of these two is required
|
||||||
@Parameter(required = false)
|
@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.");
|
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
|
||||||
}
|
}
|
||||||
targetType = TargetType.SOURCE;
|
targetType = TargetType.SOURCE;
|
||||||
if (null == packageName) {
|
if (null == targetPackage) {
|
||||||
throw new MojoFailureException("The [packageName] property must be specified when generating Java source code.");
|
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
|
} else
|
||||||
if (targetResourceDirectory != null) {
|
if (targetResourceDirectory != null) {
|
||||||
if (targetSourceDirectory != null) {
|
if (targetSourceDirectory != null) {
|
||||||
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
|
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
|
||||||
}
|
}
|
||||||
targetType = TargetType.RESOURCE;
|
targetType = TargetType.RESOURCE;
|
||||||
if (folderName != null) {
|
if (targetFolder != null) {
|
||||||
targetDirectory = new File(targetResourceDirectory, folderName);
|
targetDirectory = new File(targetResourceDirectory, targetFolder);
|
||||||
} else {
|
} else {
|
||||||
targetDirectory = targetResourceDirectory;
|
targetDirectory = targetResourceDirectory;
|
||||||
}
|
}
|
||||||
|
if (null == targetPackage) {
|
||||||
|
targetPackage = "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new MojoFailureException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
|
throw new MojoFailureException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
|
||||||
}
|
}
|
||||||
|
@ -316,7 +319,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
|
||||||
rp.setTemplate(template);
|
rp.setTemplate(template);
|
||||||
rp.setTemplateFile(templateFile);
|
rp.setTemplateFile(templateFile);
|
||||||
rp.setVelocityPath(velocityPath);
|
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.setTemplate(template);
|
||||||
dtp.setTemplateFile(templateFile);
|
dtp.setTemplateFile(templateFile);
|
||||||
dtp.setVelocityPath(velocityPath);
|
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.setTemplate(template);
|
||||||
vsp.setTemplateFile(templateFile);
|
vsp.setTemplateFile(templateFile);
|
||||||
vsp.setVelocityPath(velocityPath);
|
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.setTemplate(template);
|
||||||
pp.setTemplateFile(templateFile);
|
pp.setTemplateFile(templateFile);
|
||||||
pp.setVelocityPath(velocityPath);
|
pp.setVelocityPath(velocityPath);
|
||||||
pp.writeAll(targetType, targetDirectory, null, packageName);
|
pp.writeAll(targetType, targetDirectory, null, targetPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (targetType) {
|
switch (targetType) {
|
||||||
case SOURCE: {
|
case SOURCE: {
|
||||||
myProject.addCompileSourceRoot(targetDirectory.getAbsolutePath());
|
myProject.addCompileSourceRoot(targetSourceDirectory.getAbsolutePath());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RESOURCE: {
|
case RESOURCE: {
|
||||||
Resource resource = new Resource();
|
Resource resource = new Resource();
|
||||||
resource.setDirectory(targetDirectory.getAbsolutePath());
|
resource.setDirectory(targetResourceDirectory.getAbsolutePath());
|
||||||
resource.addInclude("*");
|
if (targetFolder != null) {
|
||||||
|
resource.addInclude(targetFolder+"/*");
|
||||||
|
} else {
|
||||||
|
resource.addInclude("*");
|
||||||
|
}
|
||||||
myProject.addResource(resource);
|
myProject.addResource(resource);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +405,7 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
|
||||||
TinderGenericMultiFileMojo mojo = new TinderGenericMultiFileMojo();
|
TinderGenericMultiFileMojo mojo = new TinderGenericMultiFileMojo();
|
||||||
mojo.myProject = new MavenProject();
|
mojo.myProject = new MavenProject();
|
||||||
mojo.version = "dstu2";
|
mojo.version = "dstu2";
|
||||||
mojo.packageName = "ca.uhn.test";
|
mojo.targetPackage = "ca.uhn.test";
|
||||||
mojo.template = "/vm/jpa_resource_provider.vm";
|
mojo.template = "/vm/jpa_resource_provider.vm";
|
||||||
mojo.targetSourceDirectory = new File("target/generated/valuesets");
|
mojo.targetSourceDirectory = new File("target/generated/valuesets");
|
||||||
mojo.execute();
|
mojo.execute();
|
||||||
|
|
|
@ -66,7 +66,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top">generateResources</td>
|
* <td valign="top">generateResources</td>
|
||||||
* <td valign="top">Should files be generated from FHIR resource metadata?<br>
|
* <td valign="top">Should files be generated from FHIR resource metadata?<br>
|
||||||
* Valid values: <code><b>true</b></code> | <code><b>false</b></code></td>
|
* Valid values: <code><b>true</b></code> | <code><b>false</b></code></td>
|
||||||
* <td valign="top" align="center" rowspan="2">At least one of these two options must be specified</td>
|
* <td valign="top" align="center" rowspan="2">One of these two options must be specified</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td valign="top">generateDataTypes</td>
|
* <td valign="top">generateDataTypes</td>
|
||||||
|
@ -81,8 +81,8 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* for FHIR resources or composite data types. There is one file
|
* for FHIR resources or composite data types. There is one file
|
||||||
* generated for each selected entity. The following configuration
|
* generated for each selected entity. The following configuration
|
||||||
* properties control the naming of the generated source files:<br>
|
* properties control the naming of the generated source files:<br>
|
||||||
* <targetSourceDirectory>/<packageName>/<targetFile><br>
|
* <targetSourceDirectory>/<targetPackage>/<targetFile><br>
|
||||||
* 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 <code>.java</code> will be added to the targetFile if it is not already included.
|
* actual source file location. Also note that <code>.java</code> will be added to the targetFile if it is not already included.
|
||||||
* </td>
|
* </td>
|
||||||
* </tr>
|
* </tr>
|
||||||
|
@ -92,12 +92,18 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top" align="center">Yes when a Java source file is to be generated</td>
|
* <td valign="top" align="center">Yes when a Java source file is to be generated</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td valign="top">packageName</td>
|
* <td valign="top">targetPackage</td>
|
||||||
* <td valign="top">The Java package that will contain the generated classes.
|
* <td valign="top">The Java package that will contain the generated classes.
|
||||||
* This package is generated in the <targetSourceDirectory> if needed.</td>
|
* This package is generated in the <targetSourceDirectory> if needed.</td>
|
||||||
* <td valign="top" align="center">Yes when <i>targetSourceDirectory</i> is specified</td>
|
* <td valign="top" align="center">Yes when <i>targetSourceDirectory</i> is specified</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
|
* <td valign="top">packageBase</td>
|
||||||
|
* <td valign="top">The base Java package for related classes. This property
|
||||||
|
* can be used to reference class in other places in a folder structure.</td>
|
||||||
|
* <td valign="top" align="center">No</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
* <td valign="top">targetFile</td>
|
* <td valign="top">targetFile</td>
|
||||||
* <td valign="top">The name of the file to be generated</td>
|
* <td valign="top">The name of the file to be generated</td>
|
||||||
* <td valign="top" align="center">Yes</td>
|
* <td valign="top" align="center">Yes</td>
|
||||||
|
@ -109,7 +115,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top" colspan="3">Maven resource files can also be generated
|
* <td valign="top" colspan="3">Maven resource files can also be generated
|
||||||
* for FHIR resources or composite data types. The following configuration
|
* for FHIR resources or composite data types. The following configuration
|
||||||
* properties control the naming of the generated resource files:<br>
|
* properties control the naming of the generated resource files:<br>
|
||||||
* <targetResourceDirectory>/<folderName>/<targetFile><br>
|
* <targetResourceDirectory>/<targetFolder>/<targetFile><br>
|
||||||
* </td>
|
* </td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
|
@ -118,7 +124,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top" align="center">Yes when a resource file is to be generated</td>
|
* <td valign="top" align="center">Yes when a resource file is to be generated</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td valign="top">folderName</td>
|
* <td valign="top">targetFolder</td>
|
||||||
* <td valign="top">The folder within the targetResourceDirectory where the generated file will be placed.
|
* <td valign="top">The folder within the targetResourceDirectory where the generated file will be placed.
|
||||||
* This folder is generated in the <targetResourceDirectory> if needed.</td>
|
* This folder is generated in the <targetResourceDirectory> if needed.</td>
|
||||||
* <td valign="top" align="center">No</td>
|
* <td valign="top" align="center">No</td>
|
||||||
|
@ -200,13 +206,16 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
|
||||||
private File targetSourceDirectory;
|
private File targetSourceDirectory;
|
||||||
|
|
||||||
@Parameter(required = false)
|
@Parameter(required = false)
|
||||||
private String packageName;
|
private String targetPackage;
|
||||||
|
|
||||||
|
@Parameter(required = false)
|
||||||
|
private String packageBase;
|
||||||
|
|
||||||
@Parameter(required = false)
|
@Parameter(required = false)
|
||||||
private File targetResourceDirectory;
|
private File targetResourceDirectory;
|
||||||
|
|
||||||
@Parameter(required = false)
|
@Parameter(required = false)
|
||||||
private String folderName;
|
private String targetFolder;
|
||||||
|
|
||||||
@Parameter(required = false)
|
@Parameter(required = false)
|
||||||
private String targetFile;
|
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.");
|
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
|
||||||
}
|
}
|
||||||
targetType = TargetType.SOURCE;
|
targetType = TargetType.SOURCE;
|
||||||
if (null == packageName) {
|
if (null == targetPackage) {
|
||||||
throw new MojoFailureException("The [targetPackage] property must be specified when generating Java source code.");
|
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")) {
|
if (!targetFile.endsWith(".java")) {
|
||||||
targetFile += ".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.");
|
throw new MojoFailureException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
|
||||||
}
|
}
|
||||||
targetType = TargetType.RESOURCE;
|
targetType = TargetType.RESOURCE;
|
||||||
if (folderName != null) {
|
if (targetFolder != null) {
|
||||||
folderName = folderName.replace('\\', '/');
|
targetFolder = targetFolder.replace('\\', '/');
|
||||||
folderName = folderName.replace('/', File.separatorChar);
|
targetFolder = targetFolder.replace('/', File.separatorChar);
|
||||||
targetDirectory = new File(targetResourceDirectory, folderName);
|
targetDirectory = new File(targetResourceDirectory, targetFolder);
|
||||||
} else {
|
} else {
|
||||||
targetDirectory = targetResourceDirectory;
|
targetDirectory = targetResourceDirectory;
|
||||||
}
|
}
|
||||||
|
if (null == targetPackage) {
|
||||||
|
targetPackage = "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new MojoFailureException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
|
throw new MojoFailureException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
|
||||||
}
|
}
|
||||||
|
@ -326,9 +338,19 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
|
||||||
* build new Velocity Context
|
* build new Velocity Context
|
||||||
*/
|
*/
|
||||||
VelocityContext ctx = new VelocityContext();
|
VelocityContext ctx = new VelocityContext();
|
||||||
int ix = packageName.lastIndexOf('.');
|
if (packageBase != null) {
|
||||||
ctx.put("packageBase", packageName.subSequence(0, ix));
|
ctx.put("packageBase", packageBase);
|
||||||
ctx.put("targetPackage", packageName);
|
} 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("version", version);
|
||||||
ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi());
|
ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi());
|
||||||
ctx.put("hash", "#");
|
ctx.put("hash", "#");
|
||||||
|
@ -366,15 +388,15 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
|
||||||
|
|
||||||
switch (targetType) {
|
switch (targetType) {
|
||||||
case SOURCE: {
|
case SOURCE: {
|
||||||
myProject.addCompileSourceRoot(targetDirectory.getAbsolutePath());
|
myProject.addCompileSourceRoot(targetSourceDirectory.getAbsolutePath());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RESOURCE: {
|
case RESOURCE: {
|
||||||
Resource resource = new Resource();
|
Resource resource = new Resource();
|
||||||
resource.setDirectory(targetDirectory.getAbsolutePath());
|
resource.setDirectory(targetResourceDirectory.getAbsolutePath());
|
||||||
String resName = targetFile;
|
String resName = targetFile;
|
||||||
if (folderName != null) {
|
if (targetFolder != null) {
|
||||||
resName = folderName+File.separator+targetFile;
|
resName = targetFolder+File.separator+targetFile;
|
||||||
}
|
}
|
||||||
resource.addInclude(resName);
|
resource.addInclude(resName);
|
||||||
myProject.addResource(resource);
|
myProject.addResource(resource);
|
||||||
|
@ -409,7 +431,7 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
|
||||||
mojo.myProject = new MavenProject();
|
mojo.myProject = new MavenProject();
|
||||||
mojo.template = "/vm/jpa_spring_beans.vm";
|
mojo.template = "/vm/jpa_spring_beans.vm";
|
||||||
mojo.version = "dstu2";
|
mojo.version = "dstu2";
|
||||||
mojo.packageName = "ca.uhn.test";
|
mojo.targetPackage = "ca.uhn.test";
|
||||||
mojo.targetSourceDirectory = new File("target/generated/valuesets");
|
mojo.targetSourceDirectory = new File("target/generated/valuesets");
|
||||||
mojo.targetFile = "tmp_beans.xml";
|
mojo.targetFile = "tmp_beans.xml";
|
||||||
mojo.execute();
|
mojo.execute();
|
||||||
|
|
|
@ -113,12 +113,12 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* be generated containing all of the selected entity. The following configuration
|
* be generated containing all of the selected entity. The following configuration
|
||||||
* properties control the naming of the generated source files:
|
* properties control the naming of the generated source files:
|
||||||
* <p>The following properties will be used when generating multiple source files:<br>
|
* <p>The following properties will be used when generating multiple source files:<br>
|
||||||
* <targetSourceDirectory>/<packageName>/<filenamePrefix><i>element-name</i><filenameSuffix><br>
|
* <targetSourceDirectory>/<targetPackage>/<filenamePrefix><i>element-name</i><filenameSuffix><br>
|
||||||
* where: <i>element-name</i> is the "title-case" name of the selected resource or composite data type.
|
* where: <i>element-name</i> is the "title-case" name of the selected resource or composite data type.
|
||||||
* <p>The following properties will be used when generating a single source file:<br>
|
* <p>The following properties will be used when generating a single source file:<br>
|
||||||
* <targetSourceDirectory>/<packageName>/<targetFile>
|
* <targetSourceDirectory>/<targetPackage>/<targetFile>
|
||||||
* <p>
|
* <p>
|
||||||
* 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 <code>.java</code> will be added to the filenameSuffix or targetFile if it is not already included.
|
* actual source file location. Also note that <code>.java</code> will be added to the filenameSuffix or targetFile if it is not already included.
|
||||||
* </td>
|
* </td>
|
||||||
* </tr>
|
* </tr>
|
||||||
|
@ -128,12 +128,18 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top" align="center">Yes when Java source files are to be generated</td>
|
* <td valign="top" align="center">Yes when Java source files are to be generated</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td valign="top">packageName</td>
|
* <td valign="top">targetPackage</td>
|
||||||
* <td valign="top">The Java package that will contain the generated classes.
|
* <td valign="top">The Java package that will contain the generated classes.
|
||||||
* This package is generated in the <targetSourceDirectory> if needed.</td>
|
* This package is generated in the <targetSourceDirectory> if needed.</td>
|
||||||
* <td valign="top" align="center">Yes when <i>targetSourceDirectory</i> is specified</td>
|
* <td valign="top" align="center">Yes when <i>targetSourceDirectory</i> is specified</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
|
* <td valign="top">packageBase</td>
|
||||||
|
* <td valign="top">The base Java package for related classes. This property
|
||||||
|
* can be used to reference class in other places in a folder structure.</td>
|
||||||
|
* <td valign="top" align="center">No</td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
* <td valign="top">targetFile</td>
|
* <td valign="top">targetFile</td>
|
||||||
* <td valign="top">The name of the file to be generated</td>
|
* <td valign="top">The name of the file to be generated</td>
|
||||||
* <td valign="top" align="center">Yes when generating a single file containing all selected elements</td>
|
* <td valign="top" align="center">Yes when generating a single file containing all selected elements</td>
|
||||||
|
@ -161,10 +167,10 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* be generated containing all of the selected entity. The following configuration
|
* be generated containing all of the selected entity. The following configuration
|
||||||
* properties control the naming of the generated files:
|
* properties control the naming of the generated files:
|
||||||
* <p>The following properties will be used when generating multiple files (one for each selected element):<br>
|
* <p>The following properties will be used when generating multiple files (one for each selected element):<br>
|
||||||
* <targetResourceDirectory>/<folderName>/<filenamePrefix><i>element-name</i><filenameSuffix><br>
|
* <targetResourceDirectory>/<targetFolder>/<filenamePrefix><i>element-name</i><filenameSuffix><br>
|
||||||
* where: <i>element-name</i> is the "title-case" name of the selected resource or composite data type.
|
* where: <i>element-name</i> is the "title-case" name of the selected resource or composite data type.
|
||||||
* <p>The following properties will be used when generating a single file containing all selected elements:<br>
|
* <p>The following properties will be used when generating a single file containing all selected elements:<br>
|
||||||
* <targetResourceDirectory>/<folderName>/<targetFile>
|
* <targetResourceDirectory>/<targetFolder>/<targetFile>
|
||||||
* </td>
|
* </td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
|
@ -173,7 +179,7 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
||||||
* <td valign="top" align="center">Yes when resource files are to be generated</td>
|
* <td valign="top" align="center">Yes when resource files are to be generated</td>
|
||||||
* </tr>
|
* </tr>
|
||||||
* <tr>
|
* <tr>
|
||||||
* <td valign="top">folderName</td>
|
* <td valign="top">targetFolder</td>
|
||||||
* <td valign="top">The folder within the targetResourceDirectory where the generated files will be placed.
|
* <td valign="top">The folder within the targetResourceDirectory where the generated files will be placed.
|
||||||
* This folder is generated in the <targetResourceDirectory> if needed.</td>
|
* This folder is generated in the <targetResourceDirectory> if needed.</td>
|
||||||
* <td valign="top" align="center">No</td>
|
* <td valign="top" align="center">No</td>
|
||||||
|
@ -250,7 +256,9 @@ public class TinderGeneratorTask extends Task {
|
||||||
|
|
||||||
private File targetSourceDirectory;
|
private File targetSourceDirectory;
|
||||||
|
|
||||||
private String packageName;
|
private String targetPackage;
|
||||||
|
|
||||||
|
private String packageBase;
|
||||||
|
|
||||||
private String targetFile;
|
private String targetFile;
|
||||||
|
|
||||||
|
@ -260,7 +268,7 @@ public class TinderGeneratorTask extends Task {
|
||||||
|
|
||||||
private File targetResourceDirectory;
|
private File targetResourceDirectory;
|
||||||
|
|
||||||
private String folderName;
|
private String targetFolder;
|
||||||
|
|
||||||
// one of these two is required
|
// one of these two is required
|
||||||
private String template;
|
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.");
|
throw new BuildException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
|
||||||
}
|
}
|
||||||
targetType = TargetType.SOURCE;
|
targetType = TargetType.SOURCE;
|
||||||
if (null == packageName) {
|
if (null == targetPackage) {
|
||||||
throw new BuildException("The [packageName] property must be specified when generating Java source code.");
|
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
|
} else
|
||||||
if (targetResourceDirectory != null) {
|
if (targetResourceDirectory != null) {
|
||||||
if (targetSourceDirectory != null) {
|
if (targetSourceDirectory != null) {
|
||||||
throw new BuildException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
|
throw new BuildException("Both [targetSourceDirectory] and [targetResourceDirectory] are specified. Please choose just one.");
|
||||||
}
|
}
|
||||||
targetType = TargetType.RESOURCE;
|
targetType = TargetType.RESOURCE;
|
||||||
if (folderName != null) {
|
if (targetFolder != null) {
|
||||||
targetDirectory = new File(targetResourceDirectory, folderName);
|
targetDirectory = new File(targetResourceDirectory, targetFolder);
|
||||||
} else {
|
} else {
|
||||||
targetDirectory = targetResourceDirectory;
|
targetDirectory = targetResourceDirectory;
|
||||||
}
|
}
|
||||||
|
if (null == targetPackage) {
|
||||||
|
targetPackage = "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new BuildException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
|
throw new BuildException("Either [targetSourceDirectory] or [targetResourceDirectory] must be specified.");
|
||||||
}
|
}
|
||||||
|
@ -383,9 +394,19 @@ public class TinderGeneratorTask extends Task {
|
||||||
* build new Velocity Context
|
* build new Velocity Context
|
||||||
*/
|
*/
|
||||||
VelocityContext ctx = new VelocityContext();
|
VelocityContext ctx = new VelocityContext();
|
||||||
int ix = packageName.lastIndexOf('.');
|
if (packageBase != null) {
|
||||||
ctx.put("packageBase", packageName.subSequence(0, ix));
|
ctx.put("packageBase", packageBase);
|
||||||
ctx.put("targetPackage", packageName);
|
} 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("version", version);
|
||||||
ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi());
|
ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi());
|
||||||
ctx.put("hash", "#");
|
ctx.put("hash", "#");
|
||||||
|
@ -436,7 +457,7 @@ public class TinderGeneratorTask extends Task {
|
||||||
rp.setTemplate(template);
|
rp.setTemplate(template);
|
||||||
rp.setTemplateFile(templateFile);
|
rp.setTemplateFile(templateFile);
|
||||||
rp.setVelocityPath(velocityPath);
|
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.setTemplate(template);
|
||||||
dtp.setTemplateFile(templateFile);
|
dtp.setTemplateFile(templateFile);
|
||||||
dtp.setVelocityPath(velocityPath);
|
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.setTemplate(template);
|
||||||
vsp.setTemplateFile(templateFile);
|
vsp.setTemplateFile(templateFile);
|
||||||
vsp.setVelocityPath(velocityPath);
|
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.setTemplate(template);
|
||||||
pp.setTemplateFile(templateFile);
|
pp.setTemplateFile(templateFile);
|
||||||
pp.setVelocityPath(velocityPath);
|
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;
|
this.targetSourceDirectory = targetSourceDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPackageName(String packageName) {
|
public void setTargetPackage(String targetPackage) {
|
||||||
this.packageName = packageName;
|
this.targetPackage = targetPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackageBase(String packageBase) {
|
||||||
|
this.packageBase = packageBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTargetFile(String targetFile) {
|
public void setTargetFile(String targetFile) {
|
||||||
|
@ -570,8 +595,8 @@ public class TinderGeneratorTask extends Task {
|
||||||
this.targetResourceDirectory = targetResourceDirectory;
|
this.targetResourceDirectory = targetResourceDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFolderName(String folderName) {
|
public void setTaargetFolder(String targetFolder) {
|
||||||
this.folderName = folderName;
|
this.targetFolder = targetFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTemplate(String template) {
|
public void setTemplate(String template) {
|
||||||
|
|
|
@ -180,11 +180,11 @@ public abstract class BaseStructureParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getFilenamePrefix() {
|
protected String getFilenamePrefix() {
|
||||||
return myFilenamePrefix;
|
return myFilenamePrefix != null ? myFilenamePrefix : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getFilenameSuffix() {
|
protected String getFilenameSuffix() {
|
||||||
return myFilenameSuffix;
|
return myFilenameSuffix != null ? myFilenameSuffix : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getLocalImports() {
|
public Map<String, String> getLocalImports() {
|
||||||
|
@ -536,6 +536,7 @@ public abstract class BaseStructureParser {
|
||||||
capitalize = "Dstu1";
|
capitalize = "Dstu1";
|
||||||
}
|
}
|
||||||
ctx.put("versionCapitalized", capitalize);
|
ctx.put("versionCapitalized", capitalize);
|
||||||
|
ctx.put("this", theResource);
|
||||||
|
|
||||||
VelocityEngine v = new VelocityEngine();
|
VelocityEngine v = new VelocityEngine();
|
||||||
InputStream templateIs = null;
|
InputStream templateIs = null;
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||||
<version>2.2-SNAPSHOT</version>
|
<version>2.2-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
|
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||||
|
<version>2.2-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -104,14 +109,34 @@
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<version>dstu</version>
|
<version>dstu</version>
|
||||||
|
<generateResources>true</generateResources>
|
||||||
<templateFile>${project.basedir}/src/test/resources/templates/resource_test.vm</templateFile>
|
<templateFile>${project.basedir}/src/test/resources/templates/resource_test.vm</templateFile>
|
||||||
<packageBase>ca.uhn.test.generic.multi</packageBase>
|
<targetSourceDirectory>${project.build.directory}/generated-sources/tinder</targetSourceDirectory>
|
||||||
<targetDirectory>${project.build.directory}/generated-sources/tinder</targetDirectory>
|
<targetPackage>ca.uhn.test.generic.multi</targetPackage>
|
||||||
<filenameSuffix>ResourceTest.java</filenameSuffix>
|
<filenameSuffix>ResourceTest.java</filenameSuffix>
|
||||||
<baseResourceNames>
|
<includeResources>
|
||||||
<baseResourceName>patient</baseResourceName>
|
<includeResource>patient</includeResource>
|
||||||
<baseResourceName>organization</baseResourceName>
|
<includeResource>organization</includeResource>
|
||||||
</baseResourceNames>
|
</includeResources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>generic_multi_json</id>
|
||||||
|
<goals>
|
||||||
|
<goal>generate-multi-files</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<version>dstu2</version>
|
||||||
|
<generateResources>true</generateResources>
|
||||||
|
<templateFile>${project.basedir}/src/test/resources/templates/resource_map.vm</templateFile>
|
||||||
|
<velocityPath>${project.basedir}/src/test/resources/macros</velocityPath>
|
||||||
|
<targetResourceDirectory>${project.build.directory}/generated-resources/tinder</targetResourceDirectory>
|
||||||
|
<targetFolder>maps</targetFolder>
|
||||||
|
<filenameSuffix>_Map.json</filenameSuffix>
|
||||||
|
<includeResources>
|
||||||
|
<includeResource>patient</includeResource>
|
||||||
|
<includeResource>organization</includeResource>
|
||||||
|
</includeResources>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -121,26 +146,56 @@
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<version>dstu</version>
|
<version>dstu</version>
|
||||||
|
<generateResources>true</generateResources>
|
||||||
<templateFile>${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm</templateFile>
|
<templateFile>${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm</templateFile>
|
||||||
<packageBase>ca.uhn.test.generic.multi</packageBase>
|
<targetSourceDirectory>${project.build.directory}/generated-sources/tinder</targetSourceDirectory>
|
||||||
<targetDirectory>${project.build.directory}/generated-sources/tinder</targetDirectory>
|
|
||||||
<targetPackage>ca.uhn.test.generic.single</targetPackage>
|
<targetPackage>ca.uhn.test.generic.single</targetPackage>
|
||||||
|
<packageBase>ca.uhn.test.generic.multi</packageBase>
|
||||||
<targetFile>TestConfigDstu1.java</targetFile>
|
<targetFile>TestConfigDstu1.java</targetFile>
|
||||||
<baseResourceNames>
|
<includeResources>
|
||||||
<baseResourceName>patient</baseResourceName>
|
<includeResource>patient</includeResource>
|
||||||
<baseResourceName>organization</baseResourceName>
|
<includeResource>organization</includeResource>
|
||||||
</baseResourceNames>
|
</includeResources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>generic_single_json</id>
|
||||||
|
<goals>
|
||||||
|
<goal>generate-single-file</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<version>dstu2</version>
|
||||||
|
<generateDatatypes>true</generateDatatypes>
|
||||||
|
<templateFile>${project.basedir}/src/test/resources/templates/composite_map.vm</templateFile>
|
||||||
|
<velocityPath>${project.basedir}/src/test/resources/macros</velocityPath>
|
||||||
|
<targetResourceDirectory>${project.build.directory}/generated-resources/tinder</targetResourceDirectory>
|
||||||
|
<targetFolder>maps</targetFolder>
|
||||||
|
<targetFile>Datatypes_Dstu2.json</targetFile>
|
||||||
|
<includeResources>
|
||||||
|
<includeResource>patient</includeResource>
|
||||||
|
<includeResource>organization</includeResource>
|
||||||
|
</includeResources>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<!-- <execution> <id>client</id> <goals> <goal>generate-client</goal> </goals> <configuration> <clientClassName>ca.uhn.hitest.HiTest</clientClassName> <serverBaseHref>http://fhir.healthintersections.com.au/open</serverBaseHref>
|
<!-- <execution> <id>client</id> <goals> <goal>generate-client</goal> </goals> <configuration> <clientClassName>ca.uhn.hitest.HiTest</clientClassName> <serverBaseHref>http://fhir.healthintersections.com.au/open</serverBaseHref>
|
||||||
<generateSearchForAllParams>true</generateSearchForAllParams> </configuration> </execution> -->
|
<generateSearchForAllParams>true</generateSearchForAllParams> </configuration> </execution> -->
|
||||||
</executions>
|
</executions>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
|
<artifactId>hapi-fhir-base</artifactId>
|
||||||
|
<version>2.2-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||||
<version>2.2-SNAPSHOT</version>
|
<version>2.2-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
|
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||||
|
<version>2.2-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -157,22 +212,24 @@
|
||||||
<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"
|
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test.vm"
|
||||||
targetDir="${project.build.directory}/generated-sources/tinder"
|
generateResources="true"
|
||||||
packageBase="ca.uhn.test.ant.multi"
|
targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
|
||||||
targetclassSuffix="ResourceTest.java"
|
targetPackage="ca.uhn.test.ant.multi"
|
||||||
|
filenameSuffix="ResourceTest.java"
|
||||||
projectHome="${project.basedir}/.."
|
projectHome="${project.basedir}/.."
|
||||||
version="dstu2"
|
version="dstu2"
|
||||||
baseResourceNames="patient,organization"
|
includeResources="patient,organization"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm"
|
<hapi-tinder templateFile="${project.basedir}/src/test/resources/templates/resource_test_beans_java.vm"
|
||||||
targetDir="${project.build.directory}/generated-sources/tinder"
|
generateResources="true"
|
||||||
|
targetSourceDirectory="${project.build.directory}/generated-sources/tinder"
|
||||||
targetFile="TestConfigDstu2.java"
|
targetFile="TestConfigDstu2.java"
|
||||||
targetPackage="ca.uhn.test.ant.single"
|
targetPackage="ca.uhn.test.ant.single"
|
||||||
packageBase="ca.uhn.test.ant.multi"
|
packageBase="ca.uhn.test.ant.multi"
|
||||||
projectHome="${project.basedir}/.."
|
projectHome="${project.basedir}/.."
|
||||||
version="dstu2"
|
version="dstu2"
|
||||||
baseResourceNames="patient,organization"
|
includeResources="patient,organization"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue