Versions now builds completely!
This commit is contained in:
parent
81ddb3f1d5
commit
c26602f0c8
|
@ -1,4 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,12 +17,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-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.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ import ca.uhn.fhir.model.api.BaseResource;
|
|||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IResourceBlock;
|
||||
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
|
||||
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 abstract BoundCodeDt<IssueSeverityEnum> getSeverity();
|
||||
public abstract CodeDt getSeverity();
|
||||
|
||||
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 setSeverity(IssueSeverityEnum theSeverity);
|
||||
|
||||
public abstract BaseIssue setDetails(String theString);
|
||||
|
||||
}
|
||||
|
|
|
@ -1491,6 +1491,11 @@ class ParserState<T> {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElementExtension(StartElement theElement, String theUrlAttr, boolean theIsModifier) {
|
||||
myDepth++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
myDepth++;
|
||||
|
|
|
@ -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.dstu.composite.ResourceReferenceDt;
|
||||
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.InstantDt;
|
||||
import ca.uhn.fhir.parser.IParser;
|
||||
|
@ -653,7 +652,7 @@ public class RestfulServer extends HttpServlet {
|
|||
}
|
||||
|
||||
BaseIssue issue = oo.addIssue();
|
||||
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.ERROR);
|
||||
issue.getSeverity().setValue("error");
|
||||
if (e instanceof InternalErrorException) {
|
||||
ourLog.error("Failure during REST processing", e);
|
||||
issue.getDetails().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e));
|
||||
|
|
|
@ -48,7 +48,6 @@ import ca.uhn.fhir.context.ConfigurationException;
|
|||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
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;
|
||||
|
||||
class SchemaBaseValidator implements IValidator {
|
||||
|
@ -156,26 +155,26 @@ class SchemaBaseValidator implements IValidator {
|
|||
myContext = theContext;
|
||||
}
|
||||
|
||||
private void addIssue(SAXParseException theException, IssueSeverityEnum severity) {
|
||||
private void addIssue(SAXParseException theException, String severity) {
|
||||
BaseIssue issue = myContext.getOperationOutcome().addIssue();
|
||||
issue.getSeverity().setValueAsEnum(severity);
|
||||
issue.getSeverity().setValue(severity);
|
||||
issue.getDetails().setValue(theException.getLocalizedMessage());
|
||||
issue.addLocation("Line[" + theException.getLineNumber() + "] Col[" + theException.getColumnNumber() + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(SAXParseException theException) throws SAXException {
|
||||
addIssue(theException, IssueSeverityEnum.ERROR);
|
||||
addIssue(theException, "error");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatalError(SAXParseException theException) throws SAXException {
|
||||
addIssue(theException, IssueSeverityEnum.FATAL);
|
||||
addIssue(theException, "fatal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warning(SAXParseException theException) throws SAXException {
|
||||
addIssue(theException, IssueSeverityEnum.WARNING);
|
||||
addIssue(theException, "warning");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,13 +68,13 @@ public class SchematronBaseValidator implements IValidator {
|
|||
BaseIssue issue = theCtx.getOperationOutcome().addIssue();
|
||||
switch (next.getErrorLevel()) {
|
||||
case ERROR:
|
||||
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.ERROR);
|
||||
issue.getSeverity().setValue("error");
|
||||
break;
|
||||
case FATAL_ERROR:
|
||||
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.FATAL);
|
||||
issue.getSeverity().setValue("fatal");
|
||||
break;
|
||||
case WARN:
|
||||
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.WARNING);
|
||||
issue.getSeverity().setValue("warning");
|
||||
break;
|
||||
case INFO:
|
||||
case SUCCESS:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -40,12 +40,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-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.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -11,6 +11,7 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
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.valueset.IssueSeverityEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
|
@ -160,7 +161,9 @@ public class JpaResourceProvider<T extends IResource> extends BaseJpaProvider im
|
|||
try {
|
||||
MethodOutcome retVal = new MethodOutcome();
|
||||
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;
|
||||
} finally {
|
||||
endRequest(theRequest);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
|
@ -127,7 +127,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>buildclient</id>
|
||||
|
@ -156,7 +156,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
<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="/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>
|
||||
</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>
|
||||
</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>
|
||||
</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&includes=**/**&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&includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
<dependency-type>consumes</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -16,12 +16,17 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<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>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<type>war</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
@ -29,7 +34,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-test</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -185,7 +190,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>buildclient</id>
|
||||
|
@ -193,6 +198,7 @@
|
|||
<goal>generate-jparest-server</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<version>dstu</version>
|
||||
<packageBase>ca.uhn.test.jpasrv</packageBase>
|
||||
<baseResourceNames>
|
||||
<baseResourceName>adversereaction</baseResourceName>
|
||||
|
@ -202,7 +208,6 @@
|
|||
<baseResourceName>appointment</baseResourceName>
|
||||
<baseResourceName>availability</baseResourceName>
|
||||
<baseResourceName>careplan</baseResourceName>
|
||||
<baseResourceName>claim</baseResourceName>
|
||||
<baseResourceName>composition</baseResourceName>
|
||||
<baseResourceName>conceptmap</baseResourceName>
|
||||
<baseResourceName>condition</baseResourceName>
|
||||
|
@ -256,7 +261,6 @@
|
|||
<baseResourceName>specimen</baseResourceName>
|
||||
<baseResourceName>substance</baseResourceName>
|
||||
<baseResourceName>supply</baseResourceName>
|
||||
<!-- <baseResourceName>test</baseResourceName> -->
|
||||
<baseResourceName>user</baseResourceName>
|
||||
<baseResourceName>valueset</baseResourceName>
|
||||
</baseResourceNames>
|
||||
|
@ -266,6 +270,13 @@
|
|||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,12 +17,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-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.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -195,7 +195,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -261,7 +261,9 @@
|
|||
<baseResourceName>organization</baseResourceName>
|
||||
<baseResourceName>other</baseResourceName>
|
||||
<baseResourceName>patient</baseResourceName>
|
||||
<!--
|
||||
<baseResourceName>person</baseResourceName>
|
||||
-->
|
||||
<baseResourceName>practitioner</baseResourceName>
|
||||
<baseResourceName>procedure</baseResourceName>
|
||||
<baseResourceName>profile</baseResourceName>
|
||||
|
|
|
@ -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>
|
|
@ -1,5 +1,5 @@
|
|||
package ca.uhn.fhir.model.dev.composite;
|
||||
|
||||
public class AgeDt {
|
||||
public class AgeDt extends QuantityDt {
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
package ca.uhn.fhir.model.dev.composite;
|
||||
|
||||
public class CountDt {
|
||||
public class CountDt extends QuantityDt {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package ca.uhn.fhir.model.dev.composite;
|
||||
|
||||
public class DistanceDt {
|
||||
public class DistanceDt extends QuantityDt {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package ca.uhn.fhir.model.dev.composite;
|
||||
|
||||
public class DurationDt {
|
||||
public class DurationDt extends QuantityDt {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package ca.uhn.fhir.model.dev.composite;
|
||||
|
||||
public class MoneyDt {
|
||||
public class MoneyDt extends QuantityDt {
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -195,7 +195,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -27,12 +27,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-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.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-test</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
|
|
|
@ -49,6 +49,12 @@ public class TinderClientMojo extends AbstractMojo {
|
|||
@Parameter(required = true, defaultValue = "false")
|
||||
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 String myPackageBase;
|
||||
private File myDirectoryBase;
|
||||
|
@ -87,7 +93,7 @@ public class TinderClientMojo extends AbstractMojo {
|
|||
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;
|
||||
for (RestResource nextResource : rest.getResource()) {
|
||||
if (StringUtils.isBlank(nextResource.getProfile().getReference().getValue())) {
|
||||
|
|
|
@ -42,6 +42,9 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
|
|||
@Parameter(required = true)
|
||||
private List<String> baseResourceNames;
|
||||
|
||||
@Parameter(required = true, defaultValue = "${project.build.directory}/..")
|
||||
private String baseDir;
|
||||
|
||||
@Component
|
||||
private MavenProject myProject;
|
||||
|
||||
|
@ -51,7 +54,7 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
|
|||
File directoryBase = new File(targetDirectory, packageBase.replace(".", File.separatorChar + ""));
|
||||
directoryBase.mkdirs();
|
||||
|
||||
ResourceGeneratorUsingSpreadsheet gen = new ResourceGeneratorUsingSpreadsheet("dstu");
|
||||
ResourceGeneratorUsingSpreadsheet gen = new ResourceGeneratorUsingSpreadsheet("dstu", baseDir);
|
||||
gen.setBaseResourceNames(baseResourceNames);
|
||||
|
||||
try {
|
||||
|
|
|
@ -52,6 +52,9 @@ public class TinderStructuresMojo extends AbstractMojo {
|
|||
@Parameter(required = true, defaultValue = "${project.build.directory}/generated-resources/tinder")
|
||||
private String targetResourceDirectory;
|
||||
|
||||
@Parameter(required = true, defaultValue = "${project.build.directory}/..")
|
||||
private String baseDir;
|
||||
|
||||
@Override
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
if (StringUtils.isBlank(packageName)) {
|
||||
|
@ -73,7 +76,7 @@ public class TinderStructuresMojo extends AbstractMojo {
|
|||
directoryBase.mkdirs();
|
||||
ourLog.info(" * Output Source Directory: " + directoryBase.getAbsolutePath());
|
||||
|
||||
ValueSetGenerator vsp = new ValueSetGenerator();
|
||||
ValueSetGenerator vsp = new ValueSetGenerator(version);
|
||||
vsp.setResourceValueSetFiles(resourceValueSetFiles);
|
||||
try {
|
||||
vsp.parse();
|
||||
|
@ -84,7 +87,7 @@ public class TinderStructuresMojo extends AbstractMojo {
|
|||
ourLog.info("Loading Datatypes...");
|
||||
|
||||
Map<String, String> datatypeLocalImports = new HashMap<String, String>();
|
||||
DatatypeGeneratorUsingSpreadsheet dtp = new DatatypeGeneratorUsingSpreadsheet(version);
|
||||
DatatypeGeneratorUsingSpreadsheet dtp = new DatatypeGeneratorUsingSpreadsheet(version, baseDir);
|
||||
if (buildDatatypes) {
|
||||
try {
|
||||
dtp.parse();
|
||||
|
@ -97,7 +100,7 @@ public class TinderStructuresMojo extends AbstractMojo {
|
|||
datatypeLocalImports = dtp.getLocalImports();
|
||||
}
|
||||
|
||||
ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet(version);
|
||||
ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet(version, baseDir);
|
||||
if (baseResourceNames != null && baseResourceNames.size() > 0) {
|
||||
ourLog.info("Loading Resources...");
|
||||
try {
|
||||
|
@ -118,7 +121,7 @@ public class TinderStructuresMojo extends AbstractMojo {
|
|||
rp.writeAll(resSubDirectoryBase, resDirectoryBase, packageName);
|
||||
}
|
||||
|
||||
ProfileParser pp = new ProfileParser();
|
||||
ProfileParser pp = new ProfileParser(version, baseDir);
|
||||
if (resourceProfileFiles != null) {
|
||||
ourLog.info("Loading profiles...");
|
||||
for (ProfileFileDefinition next : resourceProfileFiles) {
|
||||
|
@ -201,42 +204,44 @@ public class TinderStructuresMojo extends AbstractMojo {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
|
||||
// ProfileParser pp = new ProfileParser();
|
||||
// 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.parse();
|
||||
|
||||
DatatypeGeneratorUsingSpreadsheet dtp = new DatatypeGeneratorUsingSpreadsheet("dev");
|
||||
DatatypeGeneratorUsingSpreadsheet dtp = new DatatypeGeneratorUsingSpreadsheet("dev", ".");
|
||||
dtp.parse();
|
||||
dtp.bindValueSets(vsp);
|
||||
dtp.markResourcesForImports();
|
||||
dtp.bindValueSets(vsp);
|
||||
Map<String, String> datatypeLocalImports = dtp.getLocalImports();
|
||||
|
||||
String dtOutputDir = "target/generated-sources/ca/uhn/fhir/model/dstu/composite";
|
||||
|
||||
ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet("dev");
|
||||
rp.setBaseResourceNames(Arrays.asList("referralrequest", "patient","practitioner","encounter","organization"));
|
||||
ResourceGeneratorUsingSpreadsheet rp = new ResourceGeneratorUsingSpreadsheet("dev", ".");
|
||||
rp.setBaseResourceNames(Arrays.asList("referralrequest", "patient","practitioner","encounter",
|
||||
"organization","location","relatedperson","appointment","slot","order","availability","device", "valueset"));
|
||||
rp.parse();
|
||||
rp.bindValueSets(vsp);
|
||||
rp.markResourcesForImports();
|
||||
|
||||
// rp.bindValueSets(vsp);
|
||||
|
||||
String rpOutputDir = "target/generated-sources/ca/uhn/fhir/model/dstu/resource";
|
||||
String rpSOutputDir = "target/generated-resources/ca/uhn/fhir/model/dstu";
|
||||
String rpOutputDir = "target/generated-sources/ca/uhn/fhir/model/dev/resource";
|
||||
String rpSOutputDir = "target/generated-resources/ca/uhn/fhir/model/dev";
|
||||
|
||||
dtp.combineContentMaps(rp);
|
||||
rp.combineContentMaps(dtp);
|
||||
rp.getLocalImports().putAll(datatypeLocalImports);
|
||||
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");
|
||||
|
||||
String vsOutputDir = "target/generated-sources/ca/uhn/fhir/model/dstu/valueset";
|
||||
vsp.writeMarkedValueSets(new File(vsOutputDir), "ca.uhn.fhir.model.dstu");
|
||||
String vsOutputDir = "target/generated-sources/ca/uhn/fhir/model/dev/valueset";
|
||||
vsp.writeMarkedValueSets(new File(vsOutputDir), "ca.uhn.fhir.model.dev");
|
||||
}
|
||||
|
||||
public static class ProfileFileDefinition {
|
||||
|
|
|
@ -43,6 +43,11 @@ public class ValueSetGenerator {
|
|||
private Map<String, ValueSetTm> myValueSets = new HashMap<String, ValueSetTm>();
|
||||
private int myValueSetCount;
|
||||
private int myConceptCount;
|
||||
private String myVersion;
|
||||
|
||||
public ValueSetGenerator(String theVersion) {
|
||||
myVersion =theVersion;
|
||||
}
|
||||
|
||||
public String getClassForValueSetIdAndMarkAsNeeded(String theId) {
|
||||
ValueSetTm vs = myValueSets.get(theId);
|
||||
|
@ -62,7 +67,7 @@ public class ValueSetGenerator {
|
|||
IParser newXmlParser = new FhirContext(ValueSet.class).newXmlParser();
|
||||
|
||||
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);
|
||||
for (BundleEntry next : bundle.getEntries()) {
|
||||
ValueSet nextVs = (ValueSet) next.getResource();
|
||||
|
|
|
@ -77,7 +77,11 @@ public class SearchParameter {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -32,6 +32,7 @@ import ca.uhn.fhir.model.api.ExtensionDt;
|
|||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
|
||||
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.ValueSetGenerator;
|
||||
import ca.uhn.fhir.tinder.model.BaseElement;
|
||||
|
@ -47,41 +48,37 @@ import ca.uhn.fhir.tinder.model.SimpleSetter.Parameter;
|
|||
public abstract class BaseStructureParser {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseStructureParser.class);
|
||||
private String myBaseDir;
|
||||
private ArrayList<Extension> myExtensions;
|
||||
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 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> myNameToResourceClass = new TreeMap<String, String>();
|
||||
private String myPackageBase;
|
||||
private List<BaseRootType> myResources = new ArrayList<BaseRootType>();
|
||||
private String myVersion;
|
||||
|
||||
public TreeMap<String, String> getNameToDatatypeClass() {
|
||||
return myNameToDatatypeClass;
|
||||
public BaseStructureParser(String theVersion, String theBaseDir) {
|
||||
myVersion = theVersion;
|
||||
myBaseDir = theBaseDir;
|
||||
}
|
||||
|
||||
public void combineContentMaps(BaseStructureParser theStructureParser) {
|
||||
myNameToResourceClass.putAll(theStructureParser.myNameToResourceClass);
|
||||
myNameToDatatypeClass.putAll(theStructureParser.myNameToDatatypeClass);
|
||||
theStructureParser.myNameToResourceClass.putAll(myNameToResourceClass);
|
||||
theStructureParser.myNameToDatatypeClass.putAll(myNameToDatatypeClass);
|
||||
private void addImport(String bindingClass) {
|
||||
myImports.add(bindingClass);
|
||||
}
|
||||
|
||||
public void addResource(BaseRootType theResource) {
|
||||
myResources.add(theResource);
|
||||
}
|
||||
|
||||
public Map<String, String> getLocalImports() {
|
||||
return myLocallyDefinedClassNames;
|
||||
}
|
||||
|
||||
private void bindValueSets(BaseElement theResource, ValueSetGenerator theVsp) {
|
||||
if (isNotBlank(theResource.getBinding())) {
|
||||
String bindingClass = theVsp.getClassForValueSetIdAndMarkAsNeeded(theResource.getBinding());
|
||||
if (bindingClass != null) {
|
||||
ourLog.info("Adding binding ValueSet class: {}", bindingClass);
|
||||
theResource.setBindingClass(bindingClass);
|
||||
myImports.add(bindingClass);
|
||||
addImport(bindingClass);
|
||||
myLocallyDefinedClassNames.put(bindingClass, "valueset");
|
||||
} else {
|
||||
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,
|
||||
Class<ca.uhn.fhir.model.api.annotation.SimpleSetter.Parameter> theClass) {
|
||||
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");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
public Map<String, String> getLocalImports() {
|
||||
return myLocallyDefinedClassNames;
|
||||
}
|
||||
|
||||
public TreeMap<String, String> getNameToDatatypeClass() {
|
||||
return myNameToDatatypeClass;
|
||||
}
|
||||
|
||||
public List<BaseRootType> getResources() {
|
||||
return myResources;
|
||||
}
|
||||
|
@ -121,6 +168,100 @@ public abstract class BaseStructureParser {
|
|||
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 {
|
||||
for (BaseElement next : theNext.getChildren()) {
|
||||
ourLog.debug("Element Name: {}", next.getName());
|
||||
|
@ -140,63 +281,7 @@ public abstract class BaseStructureParser {
|
|||
}
|
||||
|
||||
private void scanForImportsNames(String theNextType) throws MojoFailureException {
|
||||
myImports.add(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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
addImport(scanForImportNamesAndReturnFqn(theNextType));
|
||||
}
|
||||
|
||||
protected void scanForSimpleSetters(Child theElem) {
|
||||
|
@ -205,9 +290,13 @@ public abstract class BaseStructureParser {
|
|||
try {
|
||||
childDt = Class.forName("ca.uhn.fhir.model.primitive." + theElem.getReferenceTypesForMultiple().get(0));
|
||||
} catch (ClassNotFoundException e) {
|
||||
try {
|
||||
childDt = Class.forName("ca.uhn.fhir.model.dstu.composite." + theElem.getReferenceTypesForMultiple().get(0));
|
||||
} catch (ClassNotFoundException e2) {
|
||||
if (myVersion.equals("dstu")) {
|
||||
try {
|
||||
childDt = Class.forName("ca.uhn.fhir.model.dstu.composite." + theElem.getReferenceTypesForMultiple().get(0));
|
||||
} catch (ClassNotFoundException e2) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +323,7 @@ public abstract class BaseStructureParser {
|
|||
p.setDatatype(paramTypes[i].getCanonicalName());
|
||||
} else {
|
||||
if (paramTypes[i].getCanonicalName().startsWith("ca.uhn.fhir")) {
|
||||
myImports.add(paramTypes[i].getSimpleName());
|
||||
addImport(paramTypes[i].getSimpleName());
|
||||
}
|
||||
p.setDatatype(paramTypes[i].getSimpleName());
|
||||
}
|
||||
|
@ -275,6 +364,13 @@ public abstract class BaseStructureParser {
|
|||
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 {
|
||||
FileWriter w = new FileWriter(theFile, false);
|
||||
|
||||
|
@ -300,6 +396,7 @@ public abstract class BaseStructureParser {
|
|||
ctx.put("hash", "#");
|
||||
ctx.put("imports", imports);
|
||||
ctx.put("profile", theResource.getProfile());
|
||||
ctx.put("version", myVersion);
|
||||
ctx.put("id", StringUtils.defaultString(theResource.getId()));
|
||||
if (theResource.getDeclaringClassNameComplete() != null) {
|
||||
ctx.put("className", theResource.getDeclaringClassNameComplete());
|
||||
|
@ -330,18 +427,6 @@ public abstract class BaseStructureParser {
|
|||
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 {
|
||||
myPackageBase = thePackageBase;
|
||||
|
||||
|
@ -404,6 +489,7 @@ public abstract class BaseStructureParser {
|
|||
VelocityContext ctx = new VelocityContext();
|
||||
ctx.put("nameToResourceClass", myNameToResourceClass);
|
||||
ctx.put("nameToDatatypeClass", myNameToDatatypeClass);
|
||||
ctx.put("version", myVersion);
|
||||
|
||||
VelocityEngine v = new VelocityEngine();
|
||||
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) {
|
||||
NodeList cells = ((Element) theRowXml).getElementsByTagName("Cell");
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ import ca.uhn.fhir.tinder.model.SimpleChild;
|
|||
import ca.uhn.fhir.tinder.util.XMLUtils;
|
||||
|
||||
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 int myColBinding;
|
||||
private int myColCard;
|
||||
|
|
|
@ -22,7 +22,8 @@ public class DatatypeGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP
|
|||
|
||||
private String myVersion;
|
||||
|
||||
public DatatypeGeneratorUsingSpreadsheet(String theVersion) {
|
||||
public DatatypeGeneratorUsingSpreadsheet(String theVersion, String theBaseDir) {
|
||||
super(theVersion, theBaseDir);
|
||||
myVersion = theVersion;
|
||||
}
|
||||
|
||||
|
@ -91,7 +92,7 @@ public class DatatypeGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP
|
|||
|
||||
if ("dstu".equals(myVersion)) {
|
||||
retVal.add(("/dt/" + myVersion + "/contact.xml"));
|
||||
retVal.add(("/dt/" + myVersion + "/resourcereference.xml"));
|
||||
// retVal.add(("/dt/" + myVersion + "/resourcereference.xml"));
|
||||
retVal.add(("/dt/" + myVersion + "/schedule.xml"));
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,10 @@ import ca.uhn.fhir.tinder.model.Slicing;
|
|||
|
||||
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 ExtensionDefn findExtension(Profile theProfile, String theCode) {
|
||||
|
@ -304,7 +308,7 @@ public class ProfileParser extends BaseStructureParser {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
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"));
|
||||
Profile prof = parser.parseResource(Profile.class, str);
|
||||
|
|
|
@ -18,7 +18,8 @@ public class ResourceGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP
|
|||
private String myTemplate = "/vm/resource.vm";
|
||||
private String myVersion;
|
||||
|
||||
public ResourceGeneratorUsingSpreadsheet(String theVersion) {
|
||||
public ResourceGeneratorUsingSpreadsheet(String theVersion, String theBaseDir) {
|
||||
super(theVersion, theBaseDir);
|
||||
myVersion = theVersion;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,8 @@ public class ${className}
|
|||
}
|
||||
#end
|
||||
#if ( ${className} == "QuantityDt" )
|
||||
#{if}(${version}=="dstu") #{set}($ce="QuantityCompararatorEnum") #{else} #{set}($ce="QuantityComparatorEnum") #{end}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
@ -135,7 +137,7 @@ public class ${className}
|
|||
* Constructor
|
||||
*/
|
||||
@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) {
|
||||
setValue(theValue);
|
||||
setComparator(theComparator);
|
||||
|
@ -146,7 +148,7 @@ public class ${className}
|
|||
* Constructor
|
||||
*/
|
||||
@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) {
|
||||
setValue(theValue);
|
||||
setComparator(theComparator);
|
||||
|
@ -157,7 +159,7 @@ public class ${className}
|
|||
* Constructor
|
||||
*/
|
||||
@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);
|
||||
setComparator(theComparator);
|
||||
setSystem(theSystem);
|
||||
|
@ -168,7 +170,7 @@ public class ${className}
|
|||
* Constructor
|
||||
*/
|
||||
@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);
|
||||
setComparator(theComparator);
|
||||
setSystem(theSystem);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,12 +17,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-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.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<plugin>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-tinder-plugin</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>custom-structs</id>
|
||||
|
@ -55,6 +55,7 @@
|
|||
<configuration>
|
||||
<package>ca.uhn.test.customstructs</package>
|
||||
<profileHttpBase>http://foo</profileHttpBase>
|
||||
<version>dstu</version>
|
||||
<resourceProfileFiles>
|
||||
<resourceProfileFile>
|
||||
<profileFile>${project.basedir}/src/test/resources/profile/patient.xml</profileFile>
|
||||
|
@ -82,6 +83,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<package>ca.uhn.test.realstructs</package>
|
||||
<version>dstu</version>
|
||||
<baseResourceNames>
|
||||
<baseResourceName>patient</baseResourceName>
|
||||
<baseResourceName>valueset</baseResourceName>
|
||||
|
@ -102,7 +104,7 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<name>HAPI-FHIR</name>
|
||||
<url>http://hl7api.sourceforge.net/hapi-fhir/</url>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -17,12 +17,12 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-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.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
<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="/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>
|
||||
</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&includes=**/**&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&includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
<dependency-type>consumes</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
|
||||
|
|
|
@ -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">
|
||||
<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>
|
||||
<!--
|
||||
HAPI projects use the Sonatype OSS parent project.
|
||||
You do not need to use this in your own projects
|
||||
-->
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>7</version>
|
||||
|
@ -34,21 +34,20 @@
|
|||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- At least one "structures" JAR must also be included -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<type>war</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
Loading…
Reference in New Issue