only support 'generateResources' when resourceSource=model
This commit is contained in:
parent
1ac2ccf363
commit
c7a7a079b2
|
@ -1,128 +1,128 @@
|
|||
target/
|
||||
/bin
|
||||
|
||||
# Created by https://www.gitignore.io
|
||||
|
||||
### Java ###
|
||||
*.class
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
|
||||
### Maven ###
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
|
||||
|
||||
### Vim ###
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
*~
|
||||
|
||||
|
||||
### Intellij ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
|
||||
|
||||
*.iml
|
||||
|
||||
## Directory-based project format:
|
||||
.idea/
|
||||
# if you remove the above rule, at least ignore the following:
|
||||
|
||||
# User-specific stuff:
|
||||
# .idea/workspace.xml
|
||||
# .idea/tasks.xml
|
||||
# .idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
# .idea/dataSources.ids
|
||||
# .idea/dataSources.xml
|
||||
# .idea/sqlDataSources.xml
|
||||
# .idea/dynamic.xml
|
||||
# .idea/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
# .idea/gradle.xml
|
||||
# .idea/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
# .idea/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
|
||||
|
||||
|
||||
### Eclipse ###
|
||||
*.pydevproject
|
||||
.metadata
|
||||
.gradle
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
target/
|
||||
/bin
|
||||
|
||||
# Created by https://www.gitignore.io
|
||||
|
||||
### Java ###
|
||||
*.class
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
|
||||
### Maven ###
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
|
||||
|
||||
### Vim ###
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
*~
|
||||
|
||||
|
||||
### Intellij ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
|
||||
|
||||
*.iml
|
||||
|
||||
## Directory-based project format:
|
||||
.idea/
|
||||
# if you remove the above rule, at least ignore the following:
|
||||
|
||||
# User-specific stuff:
|
||||
# .idea/workspace.xml
|
||||
# .idea/tasks.xml
|
||||
# .idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
# .idea/dataSources.ids
|
||||
# .idea/dataSources.xml
|
||||
# .idea/sqlDataSources.xml
|
||||
# .idea/dynamic.xml
|
||||
# .idea/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
# .idea/gradle.xml
|
||||
# .idea/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
# .idea/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
|
||||
|
||||
|
||||
### Eclipse ###
|
||||
*.pydevproject
|
||||
.metadata
|
||||
.gradle
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package ca.uhn.fhir.tinder;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.tinder.GeneratorContext.ResourceSource;
|
||||
import ca.uhn.fhir.tinder.parser.BaseStructureParser;
|
||||
import ca.uhn.fhir.tinder.parser.DatatypeGeneratorUsingSpreadsheet;
|
||||
import ca.uhn.fhir.tinder.parser.ResourceGeneratorUsingModel;
|
||||
|
@ -112,35 +113,37 @@ public abstract class AbstractGenerator {
|
|||
DatatypeGeneratorUsingSpreadsheet dtp = null;
|
||||
Map<String, String> datatypeLocalImports = new HashMap<String, String>();
|
||||
|
||||
vsp = new ValueSetGenerator(context.getVersion());
|
||||
vsp.setResourceValueSetFiles(context.getValueSetFiles());
|
||||
context.setValueSetGenerator(vsp);
|
||||
try {
|
||||
vsp.parse();
|
||||
} catch (Exception e) {
|
||||
throw new FailureException("Failed to load valuesets", e);
|
||||
if (ResourceSource.SPREADSHEET.equals(context.getResourceSource())) {
|
||||
vsp = new ValueSetGenerator(context.getVersion());
|
||||
vsp.setResourceValueSetFiles(context.getValueSetFiles());
|
||||
context.setValueSetGenerator(vsp);
|
||||
try {
|
||||
vsp.parse();
|
||||
} catch (Exception e) {
|
||||
throw new FailureException("Failed to load valuesets", e);
|
||||
}
|
||||
|
||||
/*
|
||||
* A few enums are not found by default because none of the generated classes
|
||||
* refer to them, but we still want them.
|
||||
*/
|
||||
vsp.getClassForValueSetIdAndMarkAsNeeded("NarrativeStatus");
|
||||
|
||||
logInfo("Loading Datatypes...");
|
||||
|
||||
dtp = new DatatypeGeneratorUsingSpreadsheet(context.getVersion(), context.getBaseDir());
|
||||
context.setDatatypeGenerator(dtp);
|
||||
try {
|
||||
dtp.parse();
|
||||
dtp.markResourcesForImports();
|
||||
} catch (Exception e) {
|
||||
throw new FailureException("Failed to load datatypes", e);
|
||||
}
|
||||
dtp.bindValueSets(vsp);
|
||||
|
||||
datatypeLocalImports = dtp.getLocalImports();
|
||||
}
|
||||
|
||||
/*
|
||||
* A few enums are not found by default because none of the generated classes
|
||||
* refer to them, but we still want them.
|
||||
*/
|
||||
vsp.getClassForValueSetIdAndMarkAsNeeded("NarrativeStatus");
|
||||
|
||||
logInfo("Loading Datatypes...");
|
||||
|
||||
dtp = new DatatypeGeneratorUsingSpreadsheet(context.getVersion(), context.getBaseDir());
|
||||
context.setDatatypeGenerator(dtp);
|
||||
try {
|
||||
dtp.parse();
|
||||
dtp.markResourcesForImports();
|
||||
} catch (Exception e) {
|
||||
throw new FailureException("Failed to load datatypes", e);
|
||||
}
|
||||
dtp.bindValueSets(vsp);
|
||||
|
||||
datatypeLocalImports = dtp.getLocalImports();
|
||||
|
||||
/*
|
||||
* Load the requested resources
|
||||
*/
|
||||
|
@ -173,6 +176,7 @@ public abstract class AbstractGenerator {
|
|||
|
||||
rp.setBaseResourceNames(includeResources);
|
||||
rp.parse();
|
||||
rp.markResourcesForImports();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.apache.maven.project.MavenProject;
|
|||
|
||||
import ca.uhn.fhir.tinder.AbstractGenerator.ExecutionException;
|
||||
import ca.uhn.fhir.tinder.AbstractGenerator.FailureException;
|
||||
import ca.uhn.fhir.tinder.GeneratorContext.ResourceSource;
|
||||
import ca.uhn.fhir.tinder.TinderStructuresMojo.ValueSetFileDefinition;
|
||||
import ca.uhn.fhir.tinder.parser.BaseStructureParser;
|
||||
import ca.uhn.fhir.tinder.parser.DatatypeGeneratorUsingSpreadsheet;
|
||||
|
@ -76,7 +77,8 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
|||
* <td valign="top">Which source of resource definitions should be processed? Valid values are:<br>
|
||||
* <ul>
|
||||
* <li><code><b>spreadsheet</b></code> to cause resources to be generated based on the FHIR spreadsheets</li>
|
||||
* <li><code><b>model</b></code> to cause resources to be generated based on the model structure classes</li></ul></td>
|
||||
* <li><code><b>model</b></code> to cause resources to be generated based on the model structure classes. Note that
|
||||
* <code>generateResources</code> is the only one of the above options that can be used when <code>model</code> is specified.</li></ul></td>
|
||||
* <td valign="top" align="center">No. Defaults to: <code><b>spreadsheet</b></code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
|
@ -276,6 +278,14 @@ public class TinderGenericMultiFileMojo extends AbstractMojo {
|
|||
context.setExcludeResources(excludeResources);
|
||||
context.setResourceSource(resourceSource);
|
||||
context.setValueSetFiles(valueSetFiles);
|
||||
if (ResourceSource.MODEL.equals(context.getResourceSource())) {
|
||||
if (generateDatatypes) {
|
||||
throw new MojoFailureException("Cannot use \"generateDatatypes\" when resourceSource=model");
|
||||
}
|
||||
if (generateValueSets) {
|
||||
throw new MojoFailureException("Cannot use \"generateValueSets\" when resourceSource=model");
|
||||
}
|
||||
}
|
||||
|
||||
generator.prepare(context);
|
||||
} catch (ExecutionException e) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.velocity.tools.generic.EscapeTool;
|
|||
|
||||
import ca.uhn.fhir.tinder.AbstractGenerator.ExecutionException;
|
||||
import ca.uhn.fhir.tinder.AbstractGenerator.FailureException;
|
||||
import ca.uhn.fhir.tinder.GeneratorContext.ResourceSource;
|
||||
import ca.uhn.fhir.tinder.TinderStructuresMojo.ValueSetFileDefinition;
|
||||
import ca.uhn.fhir.tinder.parser.BaseStructureParser;
|
||||
import ca.uhn.fhir.tinder.parser.BaseStructureSpreadsheetParser;
|
||||
|
@ -76,7 +77,8 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
|||
* <td valign="top">Which source of resource definitions should be processed? Valid values are:<br>
|
||||
* <ul>
|
||||
* <li><code><b>spreadsheet</b></code> to cause resources to be generated based on the FHIR spreadsheets</li>
|
||||
* <li><code><b>model</b></code> to cause resources to be generated based on the model structure classes</li></ul></td>
|
||||
* <li><code><b>model</b></code> to cause resources to be generated based on the model structure classes. Note that
|
||||
* <code>generateResources</code> is the only one of the above options that can be used when <code>model</code> is specified.</li></ul></td>
|
||||
* <td valign="top" align="center">No. Defaults to: <code><b>spreadsheet</b></code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
|
@ -269,6 +271,11 @@ public class TinderGenericSingleFileMojo extends AbstractMojo {
|
|||
context.setExcludeResources(excludeResources);
|
||||
context.setResourceSource(resourceSource);
|
||||
context.setValueSetFiles(valueSetFiles);
|
||||
if (ResourceSource.MODEL.equals(context.getResourceSource())) {
|
||||
if (generateDatatypes) {
|
||||
throw new MojoFailureException("Cannot use \"generateDatatypes\" when resourceSource=model");
|
||||
}
|
||||
}
|
||||
|
||||
generator.prepare(context);
|
||||
} catch (ExecutionException e) {
|
||||
|
|
|
@ -41,6 +41,7 @@ import ca.uhn.fhir.tinder.AbstractGenerator;
|
|||
import ca.uhn.fhir.tinder.AbstractGenerator.ExecutionException;
|
||||
import ca.uhn.fhir.tinder.AbstractGenerator.FailureException;
|
||||
import ca.uhn.fhir.tinder.GeneratorContext;
|
||||
import ca.uhn.fhir.tinder.GeneratorContext.ResourceSource;
|
||||
import ca.uhn.fhir.tinder.TinderStructuresMojo.ValueSetFileDefinition;
|
||||
import ca.uhn.fhir.tinder.ValueSetGenerator;
|
||||
import ca.uhn.fhir.tinder.VelocityHelper;
|
||||
|
@ -107,7 +108,8 @@ import ca.uhn.fhir.tinder.parser.TargetType;
|
|||
* <td valign="top">Which source of resource definitions should be processed? Valid values are:<br>
|
||||
* <ul>
|
||||
* <li><code><b>spreadsheet</b></code> to cause resources to be generated based on the FHIR spreadsheets</li>
|
||||
* <li><code><b>model</b></code> to cause resources to be generated based on the model structure classes</li></ul></td>
|
||||
* <li><code><b>model</b></code> to cause resources to be generated based on the model structure classes. Note that
|
||||
* <code>generateResources</code> is the only one of the above options that can be used when <code>model</code> is specified.</li></ul></td>
|
||||
* <td valign="top" align="center">No. Defaults to: <code><b>spreadsheet</b></code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
|
@ -327,6 +329,14 @@ public class TinderGeneratorTask extends Task {
|
|||
context.setExcludeResources(excludeResources);
|
||||
context.setResourceSource(resourceSource);
|
||||
context.setValueSetFiles(valueSetFiles);
|
||||
if (ResourceSource.MODEL.equals(context.getResourceSource())) {
|
||||
if (generateDatatypes) {
|
||||
throw new BuildException("Cannot use \"generateDatatypes\" when resourceSource=model");
|
||||
}
|
||||
if (generateValueSets) {
|
||||
throw new BuildException("Cannot use \"generateValueSets\" when resourceSource=model");
|
||||
}
|
||||
}
|
||||
|
||||
generator.prepare(context);
|
||||
} catch (ExecutionException e) {
|
||||
|
|
Loading…
Reference in New Issue