Versions now builds completely!

This commit is contained in:
James Agnew 2014-10-24 15:43:35 -04:00
parent 81ddb3f1d5
commit c26602f0c8
44 changed files with 54227 additions and 249 deletions

View File

@ -1,4 +1,5 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//src/main/java=UTF-8 encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8 encoding//src/main/resources=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8 encoding/<project>=UTF-8

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
@ -17,12 +17,12 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -7,8 +7,7 @@ import ca.uhn.fhir.model.api.BaseResource;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.IResourceBlock; import ca.uhn.fhir.model.api.IResourceBlock;
import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum; import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
public abstract class BaseOperationOutcome extends BaseResource implements IResource { public abstract class BaseOperationOutcome extends BaseResource implements IResource {
@ -21,7 +20,7 @@ public abstract class BaseOperationOutcome extends BaseResource implements IReso
public static abstract class BaseIssue extends BaseIdentifiableElement implements IResourceBlock { public static abstract class BaseIssue extends BaseIdentifiableElement implements IResourceBlock {
public abstract BoundCodeDt<IssueSeverityEnum> getSeverity(); public abstract CodeDt getSeverity();
public abstract StringDt getDetails(); public abstract StringDt getDetails();
@ -29,8 +28,6 @@ public abstract class BaseOperationOutcome extends BaseResource implements IReso
public abstract BaseIssue addLocation( String theString); public abstract BaseIssue addLocation( String theString);
public abstract BaseIssue setSeverity(IssueSeverityEnum theSeverity);
public abstract BaseIssue setDetails(String theString); public abstract BaseIssue setDetails(String theString);
} }

View File

@ -1491,6 +1491,11 @@ class ParserState<T> {
} }
} }
@Override
public void enteringNewElementExtension(StartElement theElement, String theUrlAttr, boolean theIsModifier) {
myDepth++;
}
@Override @Override
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException { public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
myDepth++; myDepth++;

View File

@ -65,7 +65,6 @@ import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue; import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Binary; import ca.uhn.fhir.model.dstu.resource.Binary;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.parser.IParser;
@ -653,7 +652,7 @@ public class RestfulServer extends HttpServlet {
} }
BaseIssue issue = oo.addIssue(); BaseIssue issue = oo.addIssue();
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.ERROR); issue.getSeverity().setValue("error");
if (e instanceof InternalErrorException) { if (e instanceof InternalErrorException) {
ourLog.error("Failure during REST processing", e); ourLog.error("Failure during REST processing", e);
issue.getDetails().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e)); issue.getDetails().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e));

View File

@ -48,7 +48,6 @@ import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue; import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
class SchemaBaseValidator implements IValidator { class SchemaBaseValidator implements IValidator {
@ -156,26 +155,26 @@ class SchemaBaseValidator implements IValidator {
myContext = theContext; myContext = theContext;
} }
private void addIssue(SAXParseException theException, IssueSeverityEnum severity) { private void addIssue(SAXParseException theException, String severity) {
BaseIssue issue = myContext.getOperationOutcome().addIssue(); BaseIssue issue = myContext.getOperationOutcome().addIssue();
issue.getSeverity().setValueAsEnum(severity); issue.getSeverity().setValue(severity);
issue.getDetails().setValue(theException.getLocalizedMessage()); issue.getDetails().setValue(theException.getLocalizedMessage());
issue.addLocation("Line[" + theException.getLineNumber() + "] Col[" + theException.getColumnNumber() + "]"); issue.addLocation("Line[" + theException.getLineNumber() + "] Col[" + theException.getColumnNumber() + "]");
} }
@Override @Override
public void error(SAXParseException theException) throws SAXException { public void error(SAXParseException theException) throws SAXException {
addIssue(theException, IssueSeverityEnum.ERROR); addIssue(theException, "error");
} }
@Override @Override
public void fatalError(SAXParseException theException) throws SAXException { public void fatalError(SAXParseException theException) throws SAXException {
addIssue(theException, IssueSeverityEnum.FATAL); addIssue(theException, "fatal");
} }
@Override @Override
public void warning(SAXParseException theException) throws SAXException { public void warning(SAXParseException theException) throws SAXException {
addIssue(theException, IssueSeverityEnum.WARNING); addIssue(theException, "warning");
} }
} }

View File

@ -68,13 +68,13 @@ public class SchematronBaseValidator implements IValidator {
BaseIssue issue = theCtx.getOperationOutcome().addIssue(); BaseIssue issue = theCtx.getOperationOutcome().addIssue();
switch (next.getErrorLevel()) { switch (next.getErrorLevel()) {
case ERROR: case ERROR:
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.ERROR); issue.getSeverity().setValue("error");
break; break;
case FATAL_ERROR: case FATAL_ERROR:
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.FATAL); issue.getSeverity().setValue("fatal");
break; break;
case WARN: case WARN:
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.WARNING); issue.getSeverity().setValue("warning");
break; break;
case INFO: case INFO:
case SUCCESS: case SUCCESS:

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
@ -40,12 +40,12 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -44,7 +44,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>commons-logging</artifactId> <artifactId>commons-logging</artifactId>
@ -55,7 +55,7 @@
<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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -11,6 +11,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome; import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum; import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
@ -160,7 +161,9 @@ public class JpaResourceProvider<T extends IResource> extends BaseJpaProvider im
try { try {
MethodOutcome retVal = new MethodOutcome(); MethodOutcome retVal = new MethodOutcome();
retVal.setOperationOutcome(new OperationOutcome()); retVal.setOperationOutcome(new OperationOutcome());
retVal.getOperationOutcome().addIssue().setSeverity(IssueSeverityEnum.INFORMATION).setDetails("Resource validates successfully"); BaseIssue issue = retVal.getOperationOutcome().addIssue();
issue.getSeverity().setValue("information");
issue.setDetails("Resource validates successfully");
return retVal; return retVal;
} finally { } finally {
endRequest(theRequest); endRequest(theRequest);

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId> <artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.thymeleaf</groupId> <groupId>org.thymeleaf</groupId>
@ -127,7 +127,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<id>buildclient</id> <id>buildclient</id>
@ -156,7 +156,7 @@
<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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>

View File

@ -6,16 +6,16 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<dependent-module archiveName="hapi-fhir-jpaserver-base-0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-jpaserver-base/hapi-fhir-jpaserver-base"> <dependent-module archiveName="hapi-fhir-jpaserver-base-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-jpaserver-base/hapi-fhir-jpaserver-base">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="hapi-fhir-base-0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base"> <dependent-module archiveName="hapi-fhir-base-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="hapi-fhir-structures-dstu-0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu"> <dependent-module archiveName="hapi-fhir-structures-dstu-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.7-SNAPSHOT/hapi-fhir-testpage-overlay-0.7-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.8-SNAPSHOT/hapi-fhir-testpage-overlay-0.8-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type> <dependency-type>consumes</dependency-type>
</dependent-module> </dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -16,12 +16,17 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId> <artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId> <artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<type>war</type> <type>war</type>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -29,7 +34,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test</artifactId> <artifactId>hapi-fhir-jpaserver-test</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
@ -185,7 +190,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<id>buildclient</id> <id>buildclient</id>
@ -193,6 +198,7 @@
<goal>generate-jparest-server</goal> <goal>generate-jparest-server</goal>
</goals> </goals>
<configuration> <configuration>
<version>dstu</version>
<packageBase>ca.uhn.test.jpasrv</packageBase> <packageBase>ca.uhn.test.jpasrv</packageBase>
<baseResourceNames> <baseResourceNames>
<baseResourceName>adversereaction</baseResourceName> <baseResourceName>adversereaction</baseResourceName>
@ -202,7 +208,6 @@
<baseResourceName>appointment</baseResourceName> <baseResourceName>appointment</baseResourceName>
<baseResourceName>availability</baseResourceName> <baseResourceName>availability</baseResourceName>
<baseResourceName>careplan</baseResourceName> <baseResourceName>careplan</baseResourceName>
<baseResourceName>claim</baseResourceName>
<baseResourceName>composition</baseResourceName> <baseResourceName>composition</baseResourceName>
<baseResourceName>conceptmap</baseResourceName> <baseResourceName>conceptmap</baseResourceName>
<baseResourceName>condition</baseResourceName> <baseResourceName>condition</baseResourceName>
@ -256,7 +261,6 @@
<baseResourceName>specimen</baseResourceName> <baseResourceName>specimen</baseResourceName>
<baseResourceName>substance</baseResourceName> <baseResourceName>substance</baseResourceName>
<baseResourceName>supply</baseResourceName> <baseResourceName>supply</baseResourceName>
<!-- <baseResourceName>test</baseResourceName> -->
<baseResourceName>user</baseResourceName> <baseResourceName>user</baseResourceName>
<baseResourceName>valueset</baseResourceName> <baseResourceName>valueset</baseResourceName>
</baseResourceNames> </baseResourceNames>
@ -266,6 +270,13 @@
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -17,12 +17,12 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -1,2 +1,4 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8 encoding/<project>=UTF-8

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@ -195,7 +195,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -261,7 +261,9 @@
<baseResourceName>organization</baseResourceName> <baseResourceName>organization</baseResourceName>
<baseResourceName>other</baseResourceName> <baseResourceName>other</baseResourceName>
<baseResourceName>patient</baseResourceName> <baseResourceName>patient</baseResourceName>
<!--
<baseResourceName>person</baseResourceName> <baseResourceName>person</baseResourceName>
-->
<baseResourceName>practitioner</baseResourceName> <baseResourceName>practitioner</baseResourceName>
<baseResourceName>procedure</baseResourceName> <baseResourceName>procedure</baseResourceName>
<baseResourceName>profile</baseResourceName> <baseResourceName>profile</baseResourceName>

View File

@ -0,0 +1,352 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-structures-dev</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR Structures - DEV (FHIR Latest)</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet_api_version}</version>
<scope>provided</scope>
</dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback_version}</version>
<optional>true</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ebaysf.web</groupId>
<artifactId>cors-filter</artifactId>
<version>${ebay_cors_filter_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-schematron</artifactId>
<version>${phloc_schematron_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-commons</artifactId>
<version>${phloc_commons_version}</version>
<scope>test</scope>
</dependency>
<!-- UNIT TEST DEPENDENCIES -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15-sources</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>directory-naming</groupId>
<artifactId>naming-java</artifactId>
<version>0.8</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava_version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring_security_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring_security_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.2.RELEASE</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.7-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>generate-structures</goal>
</goals>
</execution>
</executions>
<configuration>
<package>ca.uhn.fhir.model.dev</package>
<version>dev</version>
<baseResourceNames>
<baseResourceName>account</baseResourceName>
<baseResourceName>adversereaction</baseResourceName>
<baseResourceName>adversereactionrisk</baseResourceName>
<baseResourceName>alert</baseResourceName>
<baseResourceName>allergyintolerance</baseResourceName>
<baseResourceName>appointment</baseResourceName>
<baseResourceName>appointmentresponse</baseResourceName>
<baseResourceName>availability</baseResourceName>
<baseResourceName>careplan</baseResourceName>
<!--
Doesn't seem to work yet
<baseResourceName>claim</baseResourceName>
-->
<baseResourceName>composition</baseResourceName>
<baseResourceName>conceptmap</baseResourceName>
<baseResourceName>condition</baseResourceName>
<baseResourceName>conformance</baseResourceName>
<baseResourceName>contract</baseResourceName>
<baseResourceName>contraindication</baseResourceName>
<baseResourceName>coverage</baseResourceName>
<baseResourceName>device</baseResourceName>
<baseResourceName>deviceobservationreport</baseResourceName>
<baseResourceName>diagnosticorder</baseResourceName>
<baseResourceName>diagnosticreport</baseResourceName>
<baseResourceName>documentmanifest</baseResourceName>
<baseResourceName>documentreference</baseResourceName>
<baseResourceName>encounter</baseResourceName>
<baseResourceName>familyhistory</baseResourceName>
<baseResourceName>geneexpression</baseResourceName>
<baseResourceName>geneticanalysis</baseResourceName>
<baseResourceName>group</baseResourceName>
<baseResourceName>imagingstudy</baseResourceName>
<baseResourceName>immunization</baseResourceName>
<baseResourceName>immunizationrecommendation</baseResourceName>
<baseResourceName>list</baseResourceName>
<baseResourceName>location</baseResourceName>
<baseResourceName>media</baseResourceName>
<baseResourceName>medication</baseResourceName>
<baseResourceName>medicationadministration</baseResourceName>
<baseResourceName>medicationdispense</baseResourceName>
<baseResourceName>medicationprescription</baseResourceName>
<baseResourceName>medicationstatement</baseResourceName>
<baseResourceName>messageheader</baseResourceName>
<baseResourceName>microarray</baseResourceName>
<baseResourceName>namespace</baseResourceName>
<baseResourceName>nutritionorder</baseResourceName>
<baseResourceName>observation</baseResourceName>
<baseResourceName>operationdefinition</baseResourceName>
<baseResourceName>operationoutcome</baseResourceName>
<baseResourceName>order</baseResourceName>
<baseResourceName>orderresponse</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>other</baseResourceName>
<baseResourceName>patient</baseResourceName>
<baseResourceName>person</baseResourceName>
<baseResourceName>practitioner</baseResourceName>
<baseResourceName>procedure</baseResourceName>
<baseResourceName>profile</baseResourceName>
<!--
Depends on "ActivityDefinition", which doesn't exist..
<baseResourceName>protocol</baseResourceName>
-->
<baseResourceName>provenance</baseResourceName>
<baseResourceName>query</baseResourceName>
<baseResourceName>questionnaire</baseResourceName>
<baseResourceName>questionnaireanswers</baseResourceName>
<baseResourceName>referralrequest</baseResourceName>
<baseResourceName>relatedperson</baseResourceName>
<baseResourceName>remittance</baseResourceName>
<baseResourceName>riskassessment</baseResourceName>
<baseResourceName>securityclaim</baseResourceName>
<baseResourceName>securityevent</baseResourceName>
<baseResourceName>securitygroup</baseResourceName>
<baseResourceName>securityprincipal</baseResourceName>
<!--
What is this?
<baseResourceName>sequence</baseResourceName>
-->
<baseResourceName>sequencinganalysis</baseResourceName>
<baseResourceName>sequencinglab</baseResourceName>
<baseResourceName>slot</baseResourceName>
<baseResourceName>specimen</baseResourceName>
<baseResourceName>subscription</baseResourceName>
<baseResourceName>substance</baseResourceName>
<baseResourceName>supply</baseResourceName>
<baseResourceName>user</baseResourceName>
<baseResourceName>valueset</baseResourceName>
</baseResourceNames>
<buildDatatypes>true</buildDatatypes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<versionRange>[0.4-SNAPSHOT,)</versionRange>
<goals>
<goal>generate-structures</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven_javadoc_plugin_version}</version>
<configuration>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -1,5 +1,5 @@
package ca.uhn.fhir.model.dev.composite; package ca.uhn.fhir.model.dev.composite;
public class AgeDt { public class AgeDt extends QuantityDt {
} }

View File

@ -0,0 +1,123 @@
package ca.uhn.fhir.model.dev.composite;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import static org.apache.commons.lang3.StringUtils.defaultString;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import ca.uhn.fhir.model.api.IBoundCodeableConcept;
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
@DatatypeDef(name = "CodeableConcept", isSpecialization = true)
public class BoundCodeableConceptDt<T extends Enum<?>> extends CodeableConceptDt implements IBoundCodeableConcept {
private IValueSetEnumBinder<T> myBinder;
/**
* Constructor
*/
public BoundCodeableConceptDt(IValueSetEnumBinder<T> theBinder) {
myBinder = theBinder;
}
/**
* Constructor
*/
public BoundCodeableConceptDt(IValueSetEnumBinder<T> theBinder, T theValue) {
myBinder = theBinder;
setValueAsEnum(theValue);
}
/**
* Constructor
*/
public BoundCodeableConceptDt(IValueSetEnumBinder<T> theBinder, Collection<T> theValues) {
myBinder = theBinder;
setValueAsEnum(theValues);
}
/**
* Sets the {@link #getCoding()} to contain a coding with the code and
* system defined by the given enumerated types, AND clearing any existing
* codings first. If theValue is null, existing codings are cleared and no
* codings are added.
*
* @param theValue
* The value to add, or <code>null</code>
*/
public void setValueAsEnum(Collection<T> theValues) {
getCoding().clear();
if (theValues != null) {
for (T next : theValues) {
getCoding().add(new CodingDt(myBinder.toSystemString(next), myBinder.toCodeString(next)));
}
}
}
/**
* Sets the {@link #getCoding()} to contain a coding with the code and
* system defined by the given enumerated type, AND clearing any existing
* codings first. If theValue is null, existing codings are cleared and no
* codings are added.
*
* @param theValue
* The value to add, or <code>null</code>
*/
public void setValueAsEnum(T theValue) {
getCoding().clear();
if (theValue == null) {
return;
}
getCoding().add(new CodingDt(myBinder.toSystemString(theValue), myBinder.toCodeString(theValue)));
}
/**
* Loops through the {@link #getCoding() codings} in this codeable concept
* and returns the first bound enumerated type that matches. <b>Use
* caution</b> using this method, see the return description for more
* information.
*
* @return Returns the bound enumerated type, or <code>null</code> if none
* are found. Note that a null return value doesn't neccesarily
* imply that this Codeable Concept has no codes, only that it has
* no codes that match the enum.
*/
public Set<T> getValueAsEnum() {
Set<T> retVal = new HashSet<T>();
for (CodingDt next : getCoding()) {
if (next == null) {
continue;
}
T nextT = myBinder.fromCodeString(defaultString(next.getCode().getValue()), defaultString(next.getSystem().getValueAsString()));
if (nextT != null) {
retVal.add(nextT);
} else {
// TODO: throw special exception type?
}
}
return retVal;
}
}

View File

@ -1,5 +1,5 @@
package ca.uhn.fhir.model.dev.composite; package ca.uhn.fhir.model.dev.composite;
public class CountDt { public class CountDt extends QuantityDt {
} }

View File

@ -1,5 +1,5 @@
package ca.uhn.fhir.model.dev.composite; package ca.uhn.fhir.model.dev.composite;
public class DistanceDt { public class DistanceDt extends QuantityDt {
} }

View File

@ -1,5 +1,5 @@
package ca.uhn.fhir.model.dev.composite; package ca.uhn.fhir.model.dev.composite;
public class DurationDt { public class DurationDt extends QuantityDt {
} }

View File

@ -1,5 +1,5 @@
package ca.uhn.fhir.model.dev.composite; package ca.uhn.fhir.model.dev.composite;
public class MoneyDt { public class MoneyDt extends QuantityDt {
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@ -195,7 +195,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -27,12 +27,12 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.thymeleaf</groupId> <groupId>org.thymeleaf</groupId>
@ -55,7 +55,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test</artifactId> <artifactId>hapi-fhir-jpaserver-test</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -19,7 +19,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<!-- <!--
<dependency> <dependency>

View File

@ -49,6 +49,12 @@ public class TinderClientMojo extends AbstractMojo {
@Parameter(required = true, defaultValue = "false") @Parameter(required = true, defaultValue = "false")
private boolean generateSearchForAllParams; private boolean generateSearchForAllParams;
@Parameter(alias = "version", required = true, defaultValue="dstu")
private String version = "dstu";
@Parameter(required = true, defaultValue = "${project.build.directory}/..")
private String baseDir;
private List<RestResourceTm> myResources = new ArrayList<RestResourceTm>(); private List<RestResourceTm> myResources = new ArrayList<RestResourceTm>();
private String myPackageBase; private String myPackageBase;
private File myDirectoryBase; private File myDirectoryBase;
@ -87,7 +93,7 @@ public class TinderClientMojo extends AbstractMojo {
throw new MojoFailureException("Conformance mode is not server, found: " + rest.getMode().getValue()); throw new MojoFailureException("Conformance mode is not server, found: " + rest.getMode().getValue());
} }
ProfileParser pp = new ProfileParser(); ProfileParser pp = new ProfileParser(version,baseDir );
int index = 0; int index = 0;
for (RestResource nextResource : rest.getResource()) { for (RestResource nextResource : rest.getResource()) {
if (StringUtils.isBlank(nextResource.getProfile().getReference().getValue())) { if (StringUtils.isBlank(nextResource.getProfile().getReference().getValue())) {

View File

@ -42,6 +42,9 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
@Parameter(required = true) @Parameter(required = true)
private List<String> baseResourceNames; private List<String> baseResourceNames;
@Parameter(required = true, defaultValue = "${project.build.directory}/..")
private String baseDir;
@Component @Component
private MavenProject myProject; private MavenProject myProject;
@ -51,7 +54,7 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
File directoryBase = new File(targetDirectory, packageBase.replace(".", File.separatorChar + "")); File directoryBase = new File(targetDirectory, packageBase.replace(".", File.separatorChar + ""));
directoryBase.mkdirs(); directoryBase.mkdirs();
ResourceGeneratorUsingSpreadsheet gen = new ResourceGeneratorUsingSpreadsheet("dstu"); ResourceGeneratorUsingSpreadsheet gen = new ResourceGeneratorUsingSpreadsheet("dstu", baseDir);
gen.setBaseResourceNames(baseResourceNames); gen.setBaseResourceNames(baseResourceNames);
try { try {

View File

@ -52,6 +52,9 @@ public class TinderStructuresMojo extends AbstractMojo {
@Parameter(required = true, defaultValue = "${project.build.directory}/generated-resources/tinder") @Parameter(required = true, defaultValue = "${project.build.directory}/generated-resources/tinder")
private String targetResourceDirectory; private String targetResourceDirectory;
@Parameter(required = true, defaultValue = "${project.build.directory}/..")
private String baseDir;
@Override @Override
public void execute() throws MojoExecutionException, MojoFailureException { public void execute() throws MojoExecutionException, MojoFailureException {
if (StringUtils.isBlank(packageName)) { if (StringUtils.isBlank(packageName)) {
@ -73,7 +76,7 @@ public class TinderStructuresMojo extends AbstractMojo {
directoryBase.mkdirs(); directoryBase.mkdirs();
ourLog.info(" * Output Source Directory: " + directoryBase.getAbsolutePath()); ourLog.info(" * Output Source Directory: " + directoryBase.getAbsolutePath());
ValueSetGenerator vsp = new ValueSetGenerator(); ValueSetGenerator vsp = new ValueSetGenerator(version);
vsp.setResourceValueSetFiles(resourceValueSetFiles); vsp.setResourceValueSetFiles(resourceValueSetFiles);
try { try {
vsp.parse(); vsp.parse();
@ -84,7 +87,7 @@ public class TinderStructuresMojo extends AbstractMojo {
ourLog.info("Loading Datatypes..."); ourLog.info("Loading Datatypes...");
Map<String, String> datatypeLocalImports = new HashMap<String, String>(); Map<String, String> datatypeLocalImports = new HashMap<String, String>();
DatatypeGeneratorUsingSpreadsheet dtp = new DatatypeGeneratorUsingSpreadsheet(version); DatatypeGeneratorUsingSpreadsheet dtp = new DatatypeGeneratorUsingSpreadsheet(version, baseDir);
if (buildDatatypes) { if (buildDatatypes) {
try { try {
dtp.parse(); dtp.parse();
@ -97,7 +100,7 @@ public class TinderStructuresMojo extends AbstractMojo {
datatypeLocalImports = dtp.getLocalImports(); datatypeLocalImports = dtp.getLocalImports();
} }
ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet(version); ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet(version, baseDir);
if (baseResourceNames != null && baseResourceNames.size() > 0) { if (baseResourceNames != null && baseResourceNames.size() > 0) {
ourLog.info("Loading Resources..."); ourLog.info("Loading Resources...");
try { try {
@ -118,7 +121,7 @@ public class TinderStructuresMojo extends AbstractMojo {
rp.writeAll(resSubDirectoryBase, resDirectoryBase, packageName); rp.writeAll(resSubDirectoryBase, resDirectoryBase, packageName);
} }
ProfileParser pp = new ProfileParser(); ProfileParser pp = new ProfileParser(version, baseDir);
if (resourceProfileFiles != null) { if (resourceProfileFiles != null) {
ourLog.info("Loading profiles..."); ourLog.info("Loading profiles...");
for (ProfileFileDefinition next : resourceProfileFiles) { for (ProfileFileDefinition next : resourceProfileFiles) {
@ -201,42 +204,44 @@ public class TinderStructuresMojo extends AbstractMojo {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// ProfileParser pp = new ProfileParser(); // ProfileParser pp = new ProfileParser();
// pp.parseSingleProfile(new File("../hapi-tinder-test/src/test/resources/profile/patient.xml"), "http://foo"); // pp.parseSingleProfile(new File("../hapi-tinder-test/src/test/resources/profile/patient.xml"), "http://foo");
ValueSetGenerator vsp = new ValueSetGenerator(); ValueSetGenerator vsp = new ValueSetGenerator("dev");
// vsp.setResourceValueSetFiles(theResourceValueSetFiles);Directory("src/main/resources/vs/"); // vsp.setResourceValueSetFiles(theResourceValueSetFiles);Directory("src/main/resources/vs/");
vsp.parse(); vsp.parse();
DatatypeGeneratorUsingSpreadsheet dtp = new DatatypeGeneratorUsingSpreadsheet("dev"); DatatypeGeneratorUsingSpreadsheet dtp = new DatatypeGeneratorUsingSpreadsheet("dev", ".");
dtp.parse(); dtp.parse();
dtp.bindValueSets(vsp);
dtp.markResourcesForImports(); dtp.markResourcesForImports();
dtp.bindValueSets(vsp);
Map<String, String> datatypeLocalImports = dtp.getLocalImports(); Map<String, String> datatypeLocalImports = dtp.getLocalImports();
String dtOutputDir = "target/generated-sources/ca/uhn/fhir/model/dstu/composite"; String dtOutputDir = "target/generated-sources/ca/uhn/fhir/model/dstu/composite";
ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet("dev"); ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet("dev", ".");
rp.setBaseResourceNames(Arrays.asList("referralrequest", "patient","practitioner","encounter","organization")); rp.setBaseResourceNames(Arrays.asList("referralrequest", "patient","practitioner","encounter",
"organization","location","relatedperson","appointment","slot","order","availability","device", "valueset"));
rp.parse(); rp.parse();
rp.bindValueSets(vsp); rp.bindValueSets(vsp);
rp.markResourcesForImports(); rp.markResourcesForImports();
// rp.bindValueSets(vsp); // rp.bindValueSets(vsp);
String rpOutputDir = "target/generated-sources/ca/uhn/fhir/model/dstu/resource"; String rpOutputDir = "target/generated-sources/ca/uhn/fhir/model/dev/resource";
String rpSOutputDir = "target/generated-resources/ca/uhn/fhir/model/dstu"; String rpSOutputDir = "target/generated-resources/ca/uhn/fhir/model/dev";
dtp.combineContentMaps(rp); dtp.combineContentMaps(rp);
rp.combineContentMaps(dtp); rp.combineContentMaps(dtp);
rp.getLocalImports().putAll(datatypeLocalImports); rp.getLocalImports().putAll(datatypeLocalImports);
datatypeLocalImports.putAll(rp.getLocalImports()); datatypeLocalImports.putAll(rp.getLocalImports());
dtp.writeAll(new File(dtOutputDir), null, "ca.uhn.fhir.model.dstu"); dtp.writeAll(new File(dtOutputDir), null, "ca.uhn.fhir.model.dev");
rp.writeAll(new File(rpOutputDir), new File(rpSOutputDir), "ca.uhn.fhir.model.dev"); rp.writeAll(new File(rpOutputDir), new File(rpSOutputDir), "ca.uhn.fhir.model.dev");
String vsOutputDir = "target/generated-sources/ca/uhn/fhir/model/dstu/valueset"; String vsOutputDir = "target/generated-sources/ca/uhn/fhir/model/dev/valueset";
vsp.writeMarkedValueSets(new File(vsOutputDir), "ca.uhn.fhir.model.dstu"); vsp.writeMarkedValueSets(new File(vsOutputDir), "ca.uhn.fhir.model.dev");
} }
public static class ProfileFileDefinition { public static class ProfileFileDefinition {

View File

@ -43,6 +43,11 @@ public class ValueSetGenerator {
private Map<String, ValueSetTm> myValueSets = new HashMap<String, ValueSetTm>(); private Map<String, ValueSetTm> myValueSets = new HashMap<String, ValueSetTm>();
private int myValueSetCount; private int myValueSetCount;
private int myConceptCount; private int myConceptCount;
private String myVersion;
public ValueSetGenerator(String theVersion) {
myVersion =theVersion;
}
public String getClassForValueSetIdAndMarkAsNeeded(String theId) { public String getClassForValueSetIdAndMarkAsNeeded(String theId) {
ValueSetTm vs = myValueSets.get(theId); ValueSetTm vs = myValueSets.get(theId);
@ -62,7 +67,7 @@ public class ValueSetGenerator {
IParser newXmlParser = new FhirContext(ValueSet.class).newXmlParser(); IParser newXmlParser = new FhirContext(ValueSet.class).newXmlParser();
ourLog.info("Parsing built-in ValueSets"); ourLog.info("Parsing built-in ValueSets");
String vs = IOUtils.toString(ValueSetGenerator.class.getResourceAsStream("/vs/all-valuesets-bundle.xml")); String vs = IOUtils.toString(ValueSetGenerator.class.getResourceAsStream("/vs/" + myVersion + "/all-valuesets-bundle.xml"));
Bundle bundle = newXmlParser.parseBundle(vs); Bundle bundle = newXmlParser.parseBundle(vs);
for (BundleEntry next : bundle.getEntries()) { for (BundleEntry next : bundle.getEntries()) {
ValueSet nextVs = (ValueSet) next.getResource(); ValueSet nextVs = (ValueSet) next.getResource();

View File

@ -77,7 +77,11 @@ public class SearchParameter {
} }
public void setName(String theName) { public void setName(String theName) {
myName = theName; if (theName != null && Character.isUpperCase(theName.charAt(0))) {
myName = theName.substring(theName.indexOf('.')+1);
}else {
myName = theName;
}
} }
public void setPath(String thePath) { public void setPath(String thePath) {

View File

@ -32,6 +32,7 @@ import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.model.api.annotation.SimpleSetter;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Binary;
import ca.uhn.fhir.tinder.TinderStructuresMojo; import ca.uhn.fhir.tinder.TinderStructuresMojo;
import ca.uhn.fhir.tinder.ValueSetGenerator; import ca.uhn.fhir.tinder.ValueSetGenerator;
import ca.uhn.fhir.tinder.model.BaseElement; import ca.uhn.fhir.tinder.model.BaseElement;
@ -47,41 +48,37 @@ import ca.uhn.fhir.tinder.model.SimpleSetter.Parameter;
public abstract class BaseStructureParser { public abstract class BaseStructureParser {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseStructureParser.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseStructureParser.class);
private String myBaseDir;
private ArrayList<Extension> myExtensions; private ArrayList<Extension> myExtensions;
private TreeSet<String> myImports = new TreeSet<String>(); private TreeSet<String> myImports = new TreeSet<String>();
private Map<String, String> myLocallyDefinedClassNames = new HashMap<String, String>();
private List<BaseRootType> myResources = new ArrayList<BaseRootType>();
private boolean myImportsResolved; private boolean myImportsResolved;
private TreeMap<String, String> myNameToResourceClass = new TreeMap<String, String>(); private Map<String, String> myLocallyDefinedClassNames = new HashMap<String, String>();
private TreeMap<String, String> myNameToDatatypeClass = new TreeMap<String, String>(); private TreeMap<String, String> myNameToDatatypeClass = new TreeMap<String, String>();
private TreeMap<String, String> myNameToResourceClass = new TreeMap<String, String>();
private String myPackageBase; private String myPackageBase;
private List<BaseRootType> myResources = new ArrayList<BaseRootType>();
private String myVersion;
public TreeMap<String, String> getNameToDatatypeClass() { public BaseStructureParser(String theVersion, String theBaseDir) {
return myNameToDatatypeClass; myVersion = theVersion;
myBaseDir = theBaseDir;
} }
public void combineContentMaps(BaseStructureParser theStructureParser) { private void addImport(String bindingClass) {
myNameToResourceClass.putAll(theStructureParser.myNameToResourceClass); myImports.add(bindingClass);
myNameToDatatypeClass.putAll(theStructureParser.myNameToDatatypeClass);
theStructureParser.myNameToResourceClass.putAll(myNameToResourceClass);
theStructureParser.myNameToDatatypeClass.putAll(myNameToDatatypeClass);
} }
public void addResource(BaseRootType theResource) { public void addResource(BaseRootType theResource) {
myResources.add(theResource); myResources.add(theResource);
} }
public Map<String, String> getLocalImports() {
return myLocallyDefinedClassNames;
}
private void bindValueSets(BaseElement theResource, ValueSetGenerator theVsp) { private void bindValueSets(BaseElement theResource, ValueSetGenerator theVsp) {
if (isNotBlank(theResource.getBinding())) { if (isNotBlank(theResource.getBinding())) {
String bindingClass = theVsp.getClassForValueSetIdAndMarkAsNeeded(theResource.getBinding()); String bindingClass = theVsp.getClassForValueSetIdAndMarkAsNeeded(theResource.getBinding());
if (bindingClass != null) { if (bindingClass != null) {
ourLog.info("Adding binding ValueSet class: {}", bindingClass); ourLog.info("Adding binding ValueSet class: {}", bindingClass);
theResource.setBindingClass(bindingClass); theResource.setBindingClass(bindingClass);
myImports.add(bindingClass); addImport(bindingClass);
myLocallyDefinedClassNames.put(bindingClass, "valueset"); myLocallyDefinedClassNames.put(bindingClass, "valueset");
} else { } else {
ourLog.info("No binding found for: {}", theResource.getBinding()); ourLog.info("No binding found for: {}", theResource.getBinding());
@ -99,6 +96,13 @@ public abstract class BaseStructureParser {
} }
} }
public void combineContentMaps(BaseStructureParser theStructureParser) {
myNameToResourceClass.putAll(theStructureParser.myNameToResourceClass);
myNameToDatatypeClass.putAll(theStructureParser.myNameToDatatypeClass);
theStructureParser.myNameToResourceClass.putAll(myNameToResourceClass);
theStructureParser.myNameToDatatypeClass.putAll(myNameToDatatypeClass);
}
private ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter findAnnotation(Class<?> theBase, Annotation[] theAnnotations, private ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter findAnnotation(Class<?> theBase, Annotation[] theAnnotations,
Class<ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter> theClass) { Class<ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter> theClass) {
for (Annotation next : theAnnotations) { for (Annotation next : theAnnotations) {
@ -109,8 +113,51 @@ public abstract class BaseStructureParser {
throw new IllegalArgumentException(theBase.getCanonicalName() + " has @" + SimpleSetter.class.getCanonicalName() + " constructor with no/invalid parameter annotation"); throw new IllegalArgumentException(theBase.getCanonicalName() + " has @" + SimpleSetter.class.getCanonicalName() + " constructor with no/invalid parameter annotation");
} }
/**
* Example: Encounter has an internal block class named "Location", but it also has a reference to the Location resource type, so we need to use the fully qualified name for that resource
* reference
*/
private void fixResourceReferenceClassNames(BaseElement theNext, String thePackageBase) {
for (BaseElement next : theNext.getChildren()) {
fixResourceReferenceClassNames(next, thePackageBase);
}
if (theNext.isResourceRef()) {
for (int i = 0; i < theNext.getType().size(); i++) {
String nextTypeName = theNext.getType().get(i);
if ("Any".equals(nextTypeName)) {
continue;
}
// if ("Location".equals(nextTypeName)) {
// ourLog.info("***** Checking for Location");
// ourLog.info("***** Imports are: {}", new
// TreeSet<String>(myImports));
// }
boolean found = false;
for (String nextImport : myImports) {
if (nextImport.endsWith(".resource." + nextTypeName)) {
// ourLog.info("***** Found match " + nextImport);
theNext.getType().set(i, nextImport);
found = true;
}
}
if (!found) {
theNext.getType().set(i, thePackageBase + ".resource." + nextTypeName);
}
}
}
}
protected abstract String getFilenameSuffix(); protected abstract String getFilenameSuffix();
public Map<String, String> getLocalImports() {
return myLocallyDefinedClassNames;
}
public TreeMap<String, String> getNameToDatatypeClass() {
return myNameToDatatypeClass;
}
public List<BaseRootType> getResources() { public List<BaseRootType> getResources() {
return myResources; return myResources;
} }
@ -121,6 +168,100 @@ public abstract class BaseStructureParser {
return true; return true;
} }
public void markResourcesForImports() {
for (BaseRootType next : myResources) {
if (next instanceof Resource) {
myLocallyDefinedClassNames.put(next.getName(), "resource");
} else if (next instanceof Composite) {
myLocallyDefinedClassNames.put(next.getName() + "Dt", "composite");
} else {
throw new IllegalStateException(next.getClass() + "");
}
}
}
private void scanForCorrections(BaseRootType theNext) {
if (theNext.getElementName().equals("ResourceReference")) {
for (BaseElement next : theNext.getChildren()) {
if (next.getElementName().equals("reference")) {
next.clearTypes();
next.setTypeFromString("id");
scanForSimpleSetters((Child) next);
}
}
}
}
private String scanForImportNamesAndReturnFqn(String theNextType) throws MojoFailureException {
if ("Any".equals(theNextType)) {
return (IResource.class.getCanonicalName());
}
if ("ExtensionDt".equals(theNextType)) {
return (ExtensionDt.class.getCanonicalName());
}
if ("ResourceReferenceDt".equals(theNextType)) {
return ResourceReferenceDt.class.getCanonicalName();
}
if ("Binary".equals(theNextType)) {
return Binary.class.getCanonicalName();
}
// QuantityCompararatorEnum
// QuantityComparatorEnum
if (myLocallyDefinedClassNames.containsKey(theNextType)) {
return (theNextType);
} else {
try {
String type = myPackageBase + ".composite." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e) {
try {
String type = "ca.uhn.fhir.model."+myVersion+ ".composite." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e5) {
try {
String type = "ca.uhn.fhir.model."+myVersion+".resource." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e1) {
try {
String type = "ca.uhn.fhir.model.primitive." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e2) {
try {
String type = myPackageBase + ".valueset." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e3) {
try {
String type = "ca.uhn.fhir.model.api." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e4) {
try {
String type = "ca.uhn.fhir.model."+myVersion+".valueset." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e6) {
String fileName = myBaseDir + "/src/main/java/" + myPackageBase.replace('.', '/') + "/composite/" + theNextType + ".java";
File file = new File(fileName);
if (file.exists()) {
return myPackageBase + ".composite." + theNextType;
}
throw new MojoFailureException("Unknown type: " + theNextType + " - Have locally defined names: " + new TreeSet<String>(myLocallyDefinedClassNames.keySet()));
}
}
}
}
}
}
}
}
}
private void scanForImportsNames(BaseElement theNext) throws MojoFailureException { private void scanForImportsNames(BaseElement theNext) throws MojoFailureException {
for (BaseElement next : theNext.getChildren()) { for (BaseElement next : theNext.getChildren()) {
ourLog.debug("Element Name: {}", next.getName()); ourLog.debug("Element Name: {}", next.getName());
@ -140,63 +281,7 @@ public abstract class BaseStructureParser {
} }
private void scanForImportsNames(String theNextType) throws MojoFailureException { private void scanForImportsNames(String theNextType) throws MojoFailureException {
myImports.add(scanForImportNamesAndReturnFqn(theNextType)); addImport(scanForImportNamesAndReturnFqn(theNextType));
}
private String scanForImportNamesAndReturnFqn(String theNextType) throws MojoFailureException {
if ("Any".equals(theNextType)) {
return (IResource.class.getCanonicalName());
}
if ("ExtensionDt".equals(theNextType)) {
return (ExtensionDt.class.getCanonicalName());
}
if (myLocallyDefinedClassNames.containsKey(theNextType)) {
return (theNextType);
} else {
try {
String type = myPackageBase + ".composite." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e) {
try {
String type = "ca.uhn.fhir.model.dstu.composite." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e5) {
try {
String type = "ca.uhn.fhir.model.dstu.resource." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e1) {
try {
String type = "ca.uhn.fhir.model.primitive." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e2) {
try {
String type = myPackageBase + ".valueset." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e3) {
try {
String type = "ca.uhn.fhir.model.api." + theNextType;
Class.forName(type);
return (type);
} catch (ClassNotFoundException e4) {
String fileName = "src/main/java/" + myPackageBase.replace('.', '/') + "/composite/" + theNextType + ".java";
File file = new File(fileName);
if (file.exists()) {
return myPackageBase + ".composite." + theNextType;
}
throw new MojoFailureException("Unknown type: " + theNextType + " - Have locally defined names: " + new TreeSet<String>(myLocallyDefinedClassNames.keySet()));
}
}
}
}
}
}
}
} }
protected void scanForSimpleSetters(Child theElem) { protected void scanForSimpleSetters(Child theElem) {
@ -205,9 +290,13 @@ public abstract class BaseStructureParser {
try { try {
childDt = Class.forName("ca.uhn.fhir.model.primitive." + theElem.getReferenceTypesForMultiple().get(0)); childDt = Class.forName("ca.uhn.fhir.model.primitive." + theElem.getReferenceTypesForMultiple().get(0));
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
try { if (myVersion.equals("dstu")) {
childDt = Class.forName("ca.uhn.fhir.model.dstu.composite." + theElem.getReferenceTypesForMultiple().get(0)); try {
} catch (ClassNotFoundException e2) { childDt = Class.forName("ca.uhn.fhir.model.dstu.composite." + theElem.getReferenceTypesForMultiple().get(0));
} catch (ClassNotFoundException e2) {
return;
}
} else {
return; return;
} }
} }
@ -234,7 +323,7 @@ public abstract class BaseStructureParser {
p.setDatatype(paramTypes[i].getCanonicalName()); p.setDatatype(paramTypes[i].getCanonicalName());
} else { } else {
if (paramTypes[i].getCanonicalName().startsWith("ca.uhn.fhir")) { if (paramTypes[i].getCanonicalName().startsWith("ca.uhn.fhir")) {
myImports.add(paramTypes[i].getSimpleName()); addImport(paramTypes[i].getSimpleName());
} }
p.setDatatype(paramTypes[i].getSimpleName()); p.setDatatype(paramTypes[i].getSimpleName());
} }
@ -275,6 +364,13 @@ public abstract class BaseStructureParser {
myExtensions = theExts; myExtensions = theExts;
} }
private String translateClassName(String theName) {
if ("List".equals(theName)) {
return "ListResource";
}
return theName;
}
private void write(BaseRootType theResource, File theFile, String thePackageBase) throws IOException, MojoFailureException { private void write(BaseRootType theResource, File theFile, String thePackageBase) throws IOException, MojoFailureException {
FileWriter w = new FileWriter(theFile, false); FileWriter w = new FileWriter(theFile, false);
@ -300,6 +396,7 @@ public abstract class BaseStructureParser {
ctx.put("hash", "#"); ctx.put("hash", "#");
ctx.put("imports", imports); ctx.put("imports", imports);
ctx.put("profile", theResource.getProfile()); ctx.put("profile", theResource.getProfile());
ctx.put("version", myVersion);
ctx.put("id", StringUtils.defaultString(theResource.getId())); ctx.put("id", StringUtils.defaultString(theResource.getId()));
if (theResource.getDeclaringClassNameComplete() != null) { if (theResource.getDeclaringClassNameComplete() != null) {
ctx.put("className", theResource.getDeclaringClassNameComplete()); ctx.put("className", theResource.getDeclaringClassNameComplete());
@ -330,18 +427,6 @@ public abstract class BaseStructureParser {
w.close(); w.close();
} }
public void markResourcesForImports() {
for (BaseRootType next : myResources) {
if (next instanceof Resource) {
myLocallyDefinedClassNames.put(next.getName(), "resource");
} else if (next instanceof Composite) {
myLocallyDefinedClassNames.put(next.getName() + "Dt", "composite");
} else {
throw new IllegalStateException(next.getClass() + "");
}
}
}
public void writeAll(File theOutputDirectory, File theResourceOutputDirectory, String thePackageBase) throws MojoFailureException { public void writeAll(File theOutputDirectory, File theResourceOutputDirectory, String thePackageBase) throws MojoFailureException {
myPackageBase = thePackageBase; myPackageBase = thePackageBase;
@ -404,6 +489,7 @@ public abstract class BaseStructureParser {
VelocityContext ctx = new VelocityContext(); VelocityContext ctx = new VelocityContext();
ctx.put("nameToResourceClass", myNameToResourceClass); ctx.put("nameToResourceClass", myNameToResourceClass);
ctx.put("nameToDatatypeClass", myNameToDatatypeClass); ctx.put("nameToDatatypeClass", myNameToDatatypeClass);
ctx.put("version", myVersion);
VelocityEngine v = new VelocityEngine(); VelocityEngine v = new VelocityEngine();
v.setProperty("resource.loader", "cp"); v.setProperty("resource.loader", "cp");
@ -421,60 +507,6 @@ public abstract class BaseStructureParser {
} }
} }
private void scanForCorrections(BaseRootType theNext) {
if (theNext.getElementName().equals("ResourceReference")) {
for (BaseElement next : theNext.getChildren()) {
if (next.getElementName().equals("reference")) {
next.clearTypes();
next.setTypeFromString("id");
scanForSimpleSetters((Child) next);
}
}
}
}
private String translateClassName(String theName) {
if ("List".equals(theName)) {
return "ListResource";
}
return theName;
}
/**
* Example: Encounter has an internal block class named "Location", but it also has a reference to the Location resource type, so we need to use the fully qualified name for that resource
* reference
*/
private void fixResourceReferenceClassNames(BaseElement theNext, String thePackageBase) {
for (BaseElement next : theNext.getChildren()) {
fixResourceReferenceClassNames(next, thePackageBase);
}
if (theNext.isResourceRef()) {
for (int i = 0; i < theNext.getType().size(); i++) {
String nextTypeName = theNext.getType().get(i);
if ("Any".equals(nextTypeName)) {
continue;
}
// if ("Location".equals(nextTypeName)) {
// ourLog.info("***** Checking for Location");
// ourLog.info("***** Imports are: {}", new
// TreeSet<String>(myImports));
// }
boolean found = false;
for (String nextImport : myImports) {
if (nextImport.endsWith(".resource." + nextTypeName)) {
// ourLog.info("***** Found match " + nextImport);
theNext.getType().set(i, nextImport);
found = true;
}
}
if (!found) {
theNext.getType().set(i, thePackageBase + ".resource." + nextTypeName);
}
}
}
}
static String cellValue(Node theRowXml, int theCellIndex) { static String cellValue(Node theRowXml, int theCellIndex) {
NodeList cells = ((Element) theRowXml).getElementsByTagName("Cell"); NodeList cells = ((Element) theRowXml).getElementsByTagName("Cell");

View File

@ -31,6 +31,11 @@ import ca.uhn.fhir.tinder.model.SimpleChild;
import ca.uhn.fhir.tinder.util.XMLUtils; import ca.uhn.fhir.tinder.util.XMLUtils;
public abstract class BaseStructureSpreadsheetParser extends BaseStructureParser { public abstract class BaseStructureSpreadsheetParser extends BaseStructureParser {
public BaseStructureSpreadsheetParser(String theVersion, String theBaseDir) {
super(theVersion, theBaseDir);
}
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseStructureSpreadsheetParser.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseStructureSpreadsheetParser.class);
private int myColBinding; private int myColBinding;
private int myColCard; private int myColCard;

View File

@ -22,7 +22,8 @@ public class DatatypeGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP
private String myVersion; private String myVersion;
public DatatypeGeneratorUsingSpreadsheet(String theVersion) { public DatatypeGeneratorUsingSpreadsheet(String theVersion, String theBaseDir) {
super(theVersion, theBaseDir);
myVersion = theVersion; myVersion = theVersion;
} }
@ -91,7 +92,7 @@ public class DatatypeGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP
if ("dstu".equals(myVersion)) { if ("dstu".equals(myVersion)) {
retVal.add(("/dt/" + myVersion + "/contact.xml")); retVal.add(("/dt/" + myVersion + "/contact.xml"));
retVal.add(("/dt/" + myVersion + "/resourcereference.xml")); // retVal.add(("/dt/" + myVersion + "/resourcereference.xml"));
retVal.add(("/dt/" + myVersion + "/schedule.xml")); retVal.add(("/dt/" + myVersion + "/schedule.xml"));
} }

View File

@ -38,6 +38,10 @@ import ca.uhn.fhir.tinder.model.Slicing;
public class ProfileParser extends BaseStructureParser { public class ProfileParser extends BaseStructureParser {
public ProfileParser(String theVersion, String theBaseDir) {
super(theVersion, theBaseDir);
}
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ProfileParser.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ProfileParser.class);
private ExtensionDefn findExtension(Profile theProfile, String theCode) { private ExtensionDefn findExtension(Profile theProfile, String theCode) {
@ -304,7 +308,7 @@ public class ProfileParser extends BaseStructureParser {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
IParser parser = new FhirContext(Profile.class).newXmlParser(); IParser parser = new FhirContext(Profile.class).newXmlParser();
ProfileParser pp = new ProfileParser(); ProfileParser pp = new ProfileParser("dev",".");
String str = IOUtils.toString(new FileReader("../hapi-tinder-test/src/test/resources/profile/organization.xml")); String str = IOUtils.toString(new FileReader("../hapi-tinder-test/src/test/resources/profile/organization.xml"));
Profile prof = parser.parseResource(Profile.class, str); Profile prof = parser.parseResource(Profile.class, str);

View File

@ -18,7 +18,8 @@ public class ResourceGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP
private String myTemplate = "/vm/resource.vm"; private String myTemplate = "/vm/resource.vm";
private String myVersion; private String myVersion;
public ResourceGeneratorUsingSpreadsheet(String theVersion) { public ResourceGeneratorUsingSpreadsheet(String theVersion, String theBaseDir) {
super(theVersion, theBaseDir);
myVersion = theVersion; myVersion = theVersion;
} }

View File

@ -115,6 +115,8 @@ public class ${className}
} }
#end #end
#if ( ${className} == "QuantityDt" ) #if ( ${className} == "QuantityDt" )
#{if}(${version}=="dstu") #{set}($ce="QuantityCompararatorEnum") #{else} #{set}($ce="QuantityComparatorEnum") #{end}
/** /**
* Constructor * Constructor
*/ */
@ -135,7 +137,7 @@ public class ${className}
* Constructor * Constructor
*/ */
@SimpleSetter @SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityCompararatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") double theValue, public QuantityDt(@SimpleSetter.Parameter(name = "theComparator") ${ce} theComparator, @SimpleSetter.Parameter(name = "theValue") double theValue,
@SimpleSetter.Parameter(name = "theUnits") String theUnits) { @SimpleSetter.Parameter(name = "theUnits") String theUnits) {
setValue(theValue); setValue(theValue);
setComparator(theComparator); setComparator(theComparator);
@ -146,7 +148,7 @@ public class ${className}
* Constructor * Constructor
*/ */
@SimpleSetter @SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityCompararatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") long theValue, public QuantityDt(@SimpleSetter.Parameter(name = "theComparator") ${ce} theComparator, @SimpleSetter.Parameter(name = "theValue") long theValue,
@SimpleSetter.Parameter(name = "theUnits") String theUnits) { @SimpleSetter.Parameter(name = "theUnits") String theUnits) {
setValue(theValue); setValue(theValue);
setComparator(theComparator); setComparator(theComparator);
@ -157,7 +159,7 @@ public class ${className}
* Constructor * Constructor
*/ */
@SimpleSetter @SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name="theComparator") QuantityCompararatorEnum theComparator, @SimpleSetter.Parameter(name="theValue") double theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) { public QuantityDt(@SimpleSetter.Parameter(name="theComparator") ${ce} theComparator, @SimpleSetter.Parameter(name="theValue") double theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) {
setValue(theValue); setValue(theValue);
setComparator(theComparator); setComparator(theComparator);
setSystem(theSystem); setSystem(theSystem);
@ -168,7 +170,7 @@ public class ${className}
* Constructor * Constructor
*/ */
@SimpleSetter @SimpleSetter
public QuantityDt(@SimpleSetter.Parameter(name="theComparator") QuantityCompararatorEnum theComparator, @SimpleSetter.Parameter(name="theValue") long theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) { public QuantityDt(@SimpleSetter.Parameter(name="theComparator") ${ce} theComparator, @SimpleSetter.Parameter(name="theValue") long theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) {
setValue(theValue); setValue(theValue);
setComparator(theComparator); setComparator(theComparator);
setSystem(theSystem); setSystem(theSystem);

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -17,12 +17,12 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@ -45,7 +45,7 @@
<plugin> <plugin>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId> <artifactId>hapi-tinder-plugin</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<id>custom-structs</id> <id>custom-structs</id>
@ -55,6 +55,7 @@
<configuration> <configuration>
<package>ca.uhn.test.customstructs</package> <package>ca.uhn.test.customstructs</package>
<profileHttpBase>http://foo</profileHttpBase> <profileHttpBase>http://foo</profileHttpBase>
<version>dstu</version>
<resourceProfileFiles> <resourceProfileFiles>
<resourceProfileFile> <resourceProfileFile>
<profileFile>${project.basedir}/src/test/resources/profile/patient.xml</profileFile> <profileFile>${project.basedir}/src/test/resources/profile/patient.xml</profileFile>
@ -82,6 +83,7 @@
</goals> </goals>
<configuration> <configuration>
<package>ca.uhn.test.realstructs</package> <package>ca.uhn.test.realstructs</package>
<version>dstu</version>
<baseResourceNames> <baseResourceNames>
<baseResourceName>patient</baseResourceName> <baseResourceName>patient</baseResourceName>
<baseResourceName>valueset</baseResourceName> <baseResourceName>valueset</baseResourceName>
@ -102,7 +104,7 @@
<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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>

View File

@ -12,7 +12,7 @@
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<name>HAPI-FHIR</name> <name>HAPI-FHIR</name>
<url>http://hl7api.sourceforge.net/hapi-fhir/</url> <url>http://hl7api.sourceforge.net/hapi-fhir/</url>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -17,12 +17,12 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -3,10 +3,13 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="hapi-fhir-base-0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base"> <dependent-module archiveName="hapi-fhir-base-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.7-SNAPSHOT/hapi-fhir-testpage-overlay-0.7-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module archiveName="hapi-fhir-structures-dstu-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.8-SNAPSHOT/hapi-fhir-testpage-overlay-0.8-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type> <dependency-type>consumes</dependency-type>
</dependent-module> </dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">

View File

@ -1,11 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<!--
HAPI projects use the Sonatype OSS parent project.
You do not need to use this in your own projects.
-->
<parent> <parent>
<!--
HAPI projects use the Sonatype OSS parent project.
You do not need to use this in your own projects
-->
<groupId>org.sonatype.oss</groupId> <groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId> <artifactId>oss-parent</artifactId>
<version>7</version> <version>7</version>
@ -34,21 +34,20 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId> <artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
</dependency> </dependency>
<!-- At least one "structures" JAR must also be included --> <!-- At least one "structures" JAR must also be included -->
<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>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<scope>test</scope>
</dependency> </dependency>
<!-- This dependency is used for the "FHIR Tester" web app overlay --> <!-- This dependency is used for the "FHIR Tester" web app overlay -->
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId> <artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>0.7-SNAPSHOT</version> <version>0.8-SNAPSHOT</version>
<type>war</type> <type>war</type>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>