diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java index 4079fcce7ad..7cc6ca36ca0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java @@ -109,7 +109,7 @@ public class FhirContext { private FhirContext(FhirVersionEnum theVersion, Collection> theResourceTypes) { if (theVersion != null) { if (!theVersion.isPresentOnClasspath()) { - throw new IllegalStateException(getLocalizer().getMessage(FhirContext.class, "noStructuresForSpecifiedVersion")); + throw new IllegalStateException(getLocalizer().getMessage(FhirContext.class, "noStructuresForSpecifiedVersion", theVersion.name())); } myVersion = theVersion.getVersionImplementation(); } else if (FhirVersionEnum.DSTU1.isPresentOnClasspath()) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java index 556a61d4bfb..f04170599c3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java @@ -36,7 +36,7 @@ public enum FhirVersionEnum { DSTU1("ca.uhn.fhir.model.dstu.FhirDstu1", null), - DSTU2("ca.uhn.fhir.model.dstu.FhirDev", null), + DSTU2("ca.uhn.fhir.model.dev.FhirDev", null), DEV("ca.uhn.fhir.model.dev.FhirDev", DSTU2); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceMetadataKeyEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceMetadataKeyEnum.java index a88a2f4fccc..5c791c7b114 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceMetadataKeyEnum.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceMetadataKeyEnum.java @@ -22,7 +22,10 @@ package ca.uhn.fhir.model.api; import static org.apache.commons.lang3.StringUtils.*; +import java.util.ArrayList; +import java.util.Collections; import java.util.Date; +import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; @@ -78,6 +81,28 @@ public abstract class ResourceMetadataKeyEnum { } }; + /** + * The value for this key represents a {@link List} of profile IDs that this + * resource claims to conform to. + * + *

+ * Values for this key are of type List<IdDt>. Note that the returned list is + * unmodifiable, so you need to create a new list and call put to + * change its value. + *

+ */ + public static final ResourceMetadataKeyEnum> PROFILES = new ResourceMetadataKeyEnum>("PROFILES") { + @Override + public List get(IResource theResource) { + return getIdListFromMetadataOrNullIfNone(theResource.getResourceMetadata(), PROFILES); + } + + @Override + public void put(IResource theResource, List theObject) { + theResource.getResourceMetadata().put(PROFILES, theObject); + } + }; + /** * The value for this key represents a previous ID used to identify this resource. This key is currently only used internally during transaction method processing. *

@@ -361,7 +386,31 @@ public abstract class ResourceMetadataKeyEnum { } private static IdDt getIdFromMetadataOrNullIfNone(Map, Object> theResourceMetadata, ResourceMetadataKeyEnum theKey) { + return toId(theKey, theResourceMetadata.get(theKey)); + } + + private static List getIdListFromMetadataOrNullIfNone(Map, Object> theResourceMetadata, ResourceMetadataKeyEnum theKey) { Object retValObj = theResourceMetadata.get(theKey); + if (retValObj instanceof List) { + List retValList = (List)retValObj; + for (Object next : retValList) { + if (!(next instanceof IdDt)) { + List retVal = new ArrayList(); + for (Object nextVal : retValList) { + retVal.add(toId(theKey, nextVal)); + } + return Collections.unmodifiableList(retVal); + } + } + @SuppressWarnings("unchecked") + List retVal = (List) retValList; + return Collections.unmodifiableList(retVal); + } else { + return Collections.singletonList(toId(theKey, retValObj)); + } + } + + private static IdDt toId(ResourceMetadataKeyEnum theKey, Object retValObj) { if (retValObj == null) { return null; } else if (retValObj instanceof String) { diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 389c97f9851..672f2cda246 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -4,9 +4,9 @@ ca.uhn.hapi.fhir - hapi-fhir + hapi-deployable-pom 0.9-SNAPSHOT - ../pom.xml + ../hapi-deployable-pom/pom.xml @@ -20,10 +20,6 @@ https://maven.java.net/service/local/repositories/snapshots/content/ - hapi-fhir-jpaserver-base @@ -253,7 +249,6 @@ org.apache.maven.plugins maven-site-plugin - true true @@ -391,6 +386,16 @@ + + + + org.apache.maven.plugins + maven-jxr-plugin + ${maven_jxr_plugin_version} + + + + JENKINS diff --git a/hapi-fhir-jpaserver-example/.classpath b/hapi-fhir-jpaserver-example/.classpath index 5a2be24c88a..d4174742df1 100644 --- a/hapi-fhir-jpaserver-example/.classpath +++ b/hapi-fhir-jpaserver-example/.classpath @@ -12,7 +12,7 @@ - + diff --git a/hapi-fhir-jpaserver-example/.project b/hapi-fhir-jpaserver-example/.project index 05f2d036140..3151455a48d 100644 --- a/hapi-fhir-jpaserver-example/.project +++ b/hapi-fhir-jpaserver-example/.project @@ -21,12 +21,12 @@ - org.eclipse.m2e.core.maven2Builder + org.eclipse.wst.validation.validationbuilder - org.eclipse.wst.validation.validationbuilder + org.eclipse.m2e.core.maven2Builder diff --git a/hapi-fhir-jpaserver-example/pom.xml b/hapi-fhir-jpaserver-example/pom.xml index 83de01e02da..2c520730fed 100644 --- a/hapi-fhir-jpaserver-example/pom.xml +++ b/hapi-fhir-jpaserver-example/pom.xml @@ -165,7 +165,7 @@ hapi-fhir-jpaserver-example @@ -180,6 +180,11 @@ org.eclipse.jetty jetty-maven-plugin 9.1.1.v20140108 + + + /hapi-fhir-jpaserver-example + + diff --git a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java index 89e02852fe7..d071b569fd2 100644 --- a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java +++ b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java @@ -61,9 +61,11 @@ public class JpaServerDemo extends RestfulServer { /* - * This tells the server to use "incorrect" MIME types if it detects that the request is coming from a browser - * in the hopes that the browser won't just treat the content as a binary payload and try to download it (which - * is what generally happens if you load a FHIR URL in a browser) + * This tells the server to use "incorrect" MIME types if it detects + * that the request is coming from a browser in the hopes that the + * browser won't just treat the content as a binary payload and try + * to download it (which is what generally happens if you load a + * FHIR URL in a browser) */ setUseBrowserFriendlyContentTypes(true); diff --git a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java index 7c4bc32c58d..279715db4c0 100644 --- a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java +++ b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java @@ -340,6 +340,7 @@ public class Controller { switch (theRequest.getFhirVersion(myConfig)) { case DEV: + case DSTU2: haveSearchParams = extractSearchParamsDev(conformance, resourceName, includes, sortParams, queries, haveSearchParams, queryIncludes); break; case DSTU1: diff --git a/pom.xml b/pom.xml index e8d05192e48..a9647c22140 100644 --- a/pom.xml +++ b/pom.xml @@ -164,6 +164,7 @@ 1.1.2 2.4.1 2.10.1 + 2.5 1.7 2.18.1 3.4 @@ -357,6 +358,12 @@ + + + + + + @@ -672,6 +679,7 @@ hapi-fhir-base hapi-fhir-structures-dstu hapi-fhir-structures-dev + hapi-fhir-jpaserver-base examples