diff --git a/.gitignore b/.gitignore
index a717ce95fa7..0bc1caebc61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@ nohup.out
tmp.txt
*.hprof
tmp.txt
+ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString/
# Vagrant stuff.
.vagrant
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementDefinition.java
index 33df42b4d08..8bcde256ae0 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementDefinition.java
@@ -214,8 +214,8 @@ public abstract class BaseRuntimeElementDefinition {
/**
* HL7.org style.
*/
- PRIMITIVE_XHTML_HL7ORG
-
+ PRIMITIVE_XHTML_HL7ORG,
+
}
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java
index d1841005d44..e35c919b778 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java
@@ -54,6 +54,7 @@ import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
import org.hl7.fhir.instance.model.api.IBaseExtension;
+import org.hl7.fhir.instance.model.api.IBaseMetaType;
import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IBaseXhtml;
@@ -192,7 +193,7 @@ class ModelScanner {
Map> resourceTypes = myNameToResourceType;
myVersionTypes = scanVersionPropertyFile(theDatatypes, resourceTypes, myVersion);
-
+
// toScan.add(DateDt.class);
// toScan.add(CodeDt.class);
// toScan.add(DecimalDt.class);
@@ -245,58 +246,58 @@ class ModelScanner {
private T pullAnnotation(Class> theContainer, AnnotatedElement theTarget, Class theAnnotationType) {
T retVal = theTarget.getAnnotation(theAnnotationType);
- if (myContext.getVersion().getVersion() != FhirVersionEnum.DSTU2_HL7ORG) {
+// if (myContext.getVersion().getVersion() != FhirVersionEnum.DSTU2_HL7ORG) {
return retVal;
- }
-
- if (retVal == null) {
- final Class extends Annotation> altAnnotationClass;
- /*
- * Use a cache to minimize Class.forName calls, since they are slow and expensive..
- */
- if (myAnnotationForwards.containsKey(theAnnotationType) == false) {
- String sourceClassName = theAnnotationType.getName();
- String candidateAltClassName = sourceClassName.replace("ca.uhn.fhir.model.api.annotation", "org.hl7.fhir.instance.model.annotations");
- if (!sourceClassName.equals(candidateAltClassName)) {
- Class> forName;
- try {
- forName = Class.forName(candidateAltClassName);
- ourLog.debug("Forwarding annotation request for [{}] to class [{}]", theAnnotationType, forName);
- } catch (ClassNotFoundException e) {
- forName = null;
- }
- altAnnotationClass = (Class extends Annotation>) forName;
- } else {
- altAnnotationClass = null;
- }
- myAnnotationForwards.put(theAnnotationType, altAnnotationClass);
- } else {
- altAnnotationClass = myAnnotationForwards.get(theAnnotationType);
- }
-
- if (altAnnotationClass == null) {
- return null;
- }
-
- final Annotation altAnnotation;
- altAnnotation = theTarget.getAnnotation(altAnnotationClass);
- if (altAnnotation == null) {
- return null;
- }
-
- InvocationHandler h = new InvocationHandler() {
-
- @Override
- public Object invoke(Object theProxy, Method theMethod, Object[] theArgs) throws Throwable {
- Method altMethod = altAnnotationClass.getMethod(theMethod.getName(), theMethod.getParameterTypes());
- return altMethod.invoke(altAnnotation, theArgs);
- }
- };
- retVal = (T) Proxy.newProxyInstance(theAnnotationType.getClassLoader(), new Class>[] { theAnnotationType }, h);
-
- }
-
- return retVal;
+// }
+//
+// if (retVal == null) {
+// final Class extends Annotation> altAnnotationClass;
+// /*
+// * Use a cache to minimize Class.forName calls, since they are slow and expensive..
+// */
+// if (myAnnotationForwards.containsKey(theAnnotationType) == false) {
+// String sourceClassName = theAnnotationType.getName();
+// String candidateAltClassName = sourceClassName.replace("ca.uhn.fhir.model.api.annotation", "org.hl7.fhir.instance.model.annotations");
+// if (!sourceClassName.equals(candidateAltClassName)) {
+// Class> forName;
+// try {
+// forName = Class.forName(candidateAltClassName);
+// ourLog.debug("Forwarding annotation request for [{}] to class [{}]", theAnnotationType, forName);
+// } catch (ClassNotFoundException e) {
+// forName = null;
+// }
+// altAnnotationClass = (Class extends Annotation>) forName;
+// } else {
+// altAnnotationClass = null;
+// }
+// myAnnotationForwards.put(theAnnotationType, altAnnotationClass);
+// } else {
+// altAnnotationClass = myAnnotationForwards.get(theAnnotationType);
+// }
+//
+// if (altAnnotationClass == null) {
+// return null;
+// }
+//
+// final Annotation altAnnotation;
+// altAnnotation = theTarget.getAnnotation(altAnnotationClass);
+// if (altAnnotation == null) {
+// return null;
+// }
+//
+// InvocationHandler h = new InvocationHandler() {
+//
+// @Override
+// public Object invoke(Object theProxy, Method theMethod, Object[] theArgs) throws Throwable {
+// Method altMethod = altAnnotationClass.getMethod(theMethod.getName(), theMethod.getParameterTypes());
+// return altMethod.invoke(altAnnotation, theArgs);
+// }
+// };
+// retVal = (T) Proxy.newProxyInstance(theAnnotationType.getClassLoader(), new Class>[] { theAnnotationType }, h);
+//
+// }
+//
+// return retVal;
}
private void scan(Class extends IBase> theClass) throws ConfigurationException {
@@ -366,6 +367,8 @@ class ModelScanner {
RuntimeCompositeDatatypeDefinition resourceDef;
if (theClass.equals(ExtensionDt.class)) {
resourceDef = new RuntimeExtensionDtDefinition(theDatatypeDefinition, theClass, true);
+// } else if (IBaseMetaType.class.isAssignableFrom(theClass)) {
+// resourceDef = new RuntimeMetaDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
} else {
resourceDef = new RuntimeCompositeDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java
index e4fa19185aa..940e1e09027 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildChoiceDefinition.java
@@ -109,22 +109,26 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
} else {
nextDef = theClassToElementDefinitions.get(next);
BaseRuntimeElementDefinition> nextDefForChoice = nextDef;
- if (nextDef instanceof IRuntimeDatatypeDefinition) {
- IRuntimeDatatypeDefinition nextDefDatatype = (IRuntimeDatatypeDefinition) nextDef;
- if (nextDefDatatype.getProfileOf() != null) {
- /*
- * Elements which are called foo[x] and have a choice which is a profiled datatype must use the
- * unprofiled datatype as the element name. E.g. if foo[x] allows markdown as a datatype, it calls the
- * element fooString when encoded, because markdown is a profile of string. This is according to the
- * FHIR spec
- */
- nextDefForChoice = null;
- nonPreferred = true;
- Class extends IBaseDatatype> profileType = nextDefDatatype.getProfileOf();
- BaseRuntimeElementDefinition> elementDef = theClassToElementDefinitions.get(profileType);
- elementName = getElementName() + StringUtils.capitalize(elementDef.getName());
- }
- }
+ /*
+ * In HAPI 1.3 the following applied:
+ * Elements which are called foo[x] and have a choice which is a profiled datatype must use the
+ * unprofiled datatype as the element name. E.g. if foo[x] allows markdown as a datatype, it calls the
+ * element fooString when encoded, because markdown is a profile of string. This is according to the
+ * FHIR spec
+ *
+ * As of HAPI 1.4 this has been disabled after conversation with Grahame. It appears
+ * that it is not correct behaviour.
+ */
+// if (nextDef instanceof IRuntimeDatatypeDefinition) {
+// IRuntimeDatatypeDefinition nextDefDatatype = (IRuntimeDatatypeDefinition) nextDef;
+// if (nextDefDatatype.getProfileOf() != null) {
+// nextDefForChoice = null;
+// nonPreferred = true;
+// Class extends IBaseDatatype> profileType = nextDefDatatype.getProfileOf();
+// BaseRuntimeElementDefinition> elementDef = theClassToElementDefinitions.get(profileType);
+// elementName = getElementName() + StringUtils.capitalize(elementDef.getName());
+// }
+// }
if (nextDefForChoice != null) {
elementName = getElementName() + StringUtils.capitalize(nextDefForChoice.getName());
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java
index 2aa52514c92..c9da31aaf5c 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildUndeclaredExtensionDefinition.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
import org.apache.commons.lang3.text.WordUtils;
import org.hl7.fhir.instance.model.api.IBase;
@@ -34,6 +35,7 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IDatatype;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
+import ca.uhn.fhir.model.primitive.CodeDt;
public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildDefinition {
@@ -153,13 +155,8 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
myDatatypeToAttributeName = new HashMap, String>();
myDatatypeToDefinition = new HashMap, BaseRuntimeElementDefinition>>();
-// for (theContext.get)
-
for (BaseRuntimeElementDefinition> next : theClassToElementDefinitions.values()) {
if (next instanceof IRuntimeDatatypeDefinition) {
- // if (next.getName().equals("CodeableConcept")) {
- // System.out.println();
- // }
myDatatypeToDefinition.put(next.getImplementingClass(), next);
@@ -178,7 +175,7 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
* type.
*/
if (!qualifiedName.startsWith("ca.uhn.fhir.model")) {
- if (!qualifiedName.startsWith("org.hl7.fhir.instance.model")) {
+ if (!qualifiedName.startsWith("org.hl7.fhir")) {
continue;
}
}
@@ -198,12 +195,6 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
myAttributeNameToDefinition = datatypeAttributeNameToDefinition;
-// for (Entry> next : myAttributeNameToDefinition.entrySet()) {
-// @SuppressWarnings("unchecked")
-// Class extends IDatatype> type = (Class extends IDatatype>) next.getValue().getImplementingClass();
-// myDatatypeToDefinition.put(type, next.getValue());
-// }
-
/*
* Resource reference - The correct name is 'valueReference' in DSTU2 and 'valueResource' in DSTU1
*/
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java
index 619c87a16bb..ee4a3999dd2 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeDefinition.java
@@ -74,7 +74,14 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
if (myProfileOfType != null) {
myProfileOf = theClassToElementDefinitions.get(myProfileOfType);
if (myProfileOf == null) {
- throw new ConfigurationException("Unknown profileOf value: " + myProfileOfType + " in type " + getImplementingClass().getName());
+ StringBuilder b = new StringBuilder();
+ b.append("Unknown profileOf value: ");
+ b.append(myProfileOfType);
+ b.append(" in type ");
+ b.append(getImplementingClass().getName());
+ b.append(" - Valid types: ");
+ b.append(theClassToElementDefinitions.keySet());
+ throw new ConfigurationException(b.toString());
}
}
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IFhirVersion.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IFhirVersion.java
index b03cecb7ce8..eadf9a77d24 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IFhirVersion.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IFhirVersion.java
@@ -25,6 +25,7 @@ import java.util.Date;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import ca.uhn.fhir.context.FhirContext;
@@ -59,4 +60,6 @@ public interface IFhirVersion {
IPrimitiveType getLastUpdated(IBaseResource theResource);
+ IIdType newIdType();
+
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IResource.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IResource.java
index c912e957cc7..b4d3a6d7ba3 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IResource.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IResource.java
@@ -40,15 +40,6 @@ import ca.uhn.fhir.model.primitive.IdDt;
*
*/
public interface IResource extends ICompositeElement, org.hl7.fhir.instance.model.api.IBaseResource {
- /**
- * Include constant for * (return all includes)
- */
- public static final Include INCLUDE_ALL = new Include("*", false).toLocked();
-
- /**
- * Include set containing only {@link #INCLUDE_ALL}
- */
- public static final Set WILDCARD_ALL_SET = Collections.unmodifiableSet(new HashSet(Arrays.asList(INCLUDE_ALL)));
/**
* Returns the contained resource list for this resource.
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Include.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Include.java
index 3da5dd95043..a545745c658 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Include.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Include.java
@@ -1,5 +1,8 @@
package ca.uhn.fhir.model.api;
+import static org.apache.commons.lang3.StringUtils.isBlank;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+
import org.apache.commons.lang3.builder.ToStringBuilder;
/*
@@ -32,9 +35,9 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
*/
public class Include {
+ private final boolean myImmutable;
private boolean myRecurse;
private String myValue;
- private boolean myImmutable;
/**
* Constructor for non-recursive include
@@ -44,10 +47,11 @@ public class Include {
*/
public Include(String theValue) {
myValue = theValue;
+ myImmutable = false;
}
/**
- * Constructor for non-recursive include
+ * Constructor for an include
*
* @param theValue
* The _include value, e.g. "Patient:name"
@@ -57,6 +61,21 @@ public class Include {
public Include(String theValue, boolean theRecurse) {
myValue = theValue;
myRecurse = theRecurse;
+ myImmutable = false;
+ }
+
+ /**
+ * Constructor for an include
+ *
+ * @param theValue
+ * The _include value, e.g. "Patient:name"
+ * @param theRecurse
+ * Should the include recurse
+ */
+ public Include(String theValue, boolean theRecurse, boolean theImmutable) {
+ myValue = theValue;
+ myRecurse = theRecurse;
+ myImmutable = theImmutable;
}
/**
@@ -73,22 +92,6 @@ public class Include {
return new Include(myValue, true);
}
- public String getValue() {
- return myValue;
- }
-
- /**
- * See the note on equality on the {@link Include class documentation}
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (myRecurse ? 1231 : 1237);
- result = prime * result + ((myValue == null) ? 0 : myValue.hashCode());
- return result;
- }
-
/**
* See the note on equality on the {@link Include class documentation}
*/
@@ -117,6 +120,73 @@ public class Include {
return true;
}
+ /**
+ * Returns the portion of the value before the first colon
+ */
+ public String getParamType() {
+ int firstColon = myValue.indexOf(':');
+ if (firstColon == -1 || firstColon == myValue.length() - 1) {
+ return null;
+ }
+ return myValue.substring(0, firstColon);
+ }
+
+ /**
+ * Returns the portion of the value after the first colon but before the second colon
+ */
+ public String getParamName() {
+ int firstColon = myValue.indexOf(':');
+ if (firstColon == -1 || firstColon == myValue.length() - 1) {
+ return null;
+ }
+ int secondColon = myValue.indexOf(':', firstColon + 1);
+ if (secondColon != -1) {
+ return myValue.substring(firstColon + 1, secondColon);
+ } else {
+ return myValue.substring(firstColon + 1);
+ }
+ }
+
+ /**
+ * Returns the portion of the string after the second colon, or null if there are not two colons in the value.
+ */
+ public String getParamTargetType() {
+ int firstColon = myValue.indexOf(':');
+ if (firstColon == -1 || firstColon == myValue.length() - 1) {
+ return null;
+ }
+ int secondColon = myValue.indexOf(':', firstColon + 1);
+ if (secondColon != -1) {
+ return myValue.substring(secondColon + 1);
+ } else {
+ return null;
+ }
+
+ }
+
+ public String getValue() {
+ return myValue;
+ }
+
+ /**
+ * See the note on equality on the {@link Include class documentation}
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (myRecurse ? 1231 : 1237);
+ result = prime * result + ((myValue == null) ? 0 : myValue.hashCode());
+ return result;
+ }
+
+ /**
+ * Is this object {@link #toLocked() locked}?
+ */
+ public boolean isLocked() {
+ return myImmutable;
+ }
+
public boolean isRecurse() {
return myRecurse;
}
@@ -132,12 +202,14 @@ public class Include {
myValue = theValue;
}
+ /**
+ * Return a new
+ */
public Include toLocked() {
- Include retVal = new Include(myValue, myRecurse);
- retVal.myImmutable = true;
+ Include retVal = new Include(myValue, myRecurse, true);
return retVal;
}
-
+
@Override
public String toString() {
ToStringBuilder builder = new ToStringBuilder(this);
@@ -145,4 +217,56 @@ public class Include {
builder.append("recurse", myRecurse);
return builder.toString();
}
+
+ /**
+ * Creates and returns a new copy of this Include with the given type. The following table shows what will be
+ * returned:
+ *
+ *
+ *
Initial Contents
+ *
theResourceType
+ *
Output
+ *
+ *
+ *
Patient:careProvider
+ *
Organization
+ *
Patient:careProvider:Organization
+ *
+ *
+ *
Patient:careProvider:Practitioner
+ *
Organization
+ *
Patient:careProvider:Organization
+ *
+ *
+ *
Patient
+ *
(any)
+ *
{@link IllegalStateException}
+ *
+ *
+ *
+ * @param theResourceType
+ * The resource type (e.g. "Organization")
+ * @return A new copy of the include. Note that if this include is {@link #toLocked() locked}, the returned include
+ * will be too
+ */
+ public Include withType(String theResourceType) {
+ StringBuilder b = new StringBuilder();
+
+ String paramType = getParamType();
+ String paramName = getParamName();
+ if (isBlank(paramType) || isBlank(paramName)) {
+ throw new IllegalStateException("This include does not contain a value in the format [ResourceType]:[paramName]");
+ }
+ b.append(paramType);
+ b.append(":");
+ b.append(paramName);
+
+ if (isNotBlank(theResourceType)) {
+ b.append(':');
+ b.append(theResourceType);
+ }
+ Include retVal = new Include(b.toString(), myRecurse, myImmutable);
+ return retVal;
+ }
+
}
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 1d2572e03ae..7d17e214d9a 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
@@ -30,6 +30,7 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IAnyResource;
+import org.hl7.fhir.instance.model.api.IPrimitiveType;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
@@ -72,7 +73,7 @@ public abstract class ResourceMetadataKeyEnum implements Serializable {
* Values for this key are of type {@link InstantDt}
*
*/
- public static final ResourceMetadataKeyEnum DELETED_AT = new ResourceMetadataKeyEnum("DELETED_AT") {
+ public static final ResourceMetadataKeySupportingAnyResource> DELETED_AT = new ResourceMetadataKeySupportingAnyResource>("DELETED_AT") {
private static final long serialVersionUID = 1L;
@Override
@@ -84,6 +85,17 @@ public abstract class ResourceMetadataKeyEnum implements Serializable {
public void put(IResource theResource, InstantDt theObject) {
theResource.getResourceMetadata().put(DELETED_AT, theObject);
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public IPrimitiveType get(IAnyResource theResource) {
+ return (IPrimitiveType) theResource.getUserData(DELETED_AT.name());
+ }
+
+ @Override
+ public void put(IAnyResource theResource, IPrimitiveType theObject) {
+ theResource.setUserData(DELETED_AT.name(), theObject);
+ }
};
/**
@@ -121,7 +133,7 @@ public abstract class ResourceMetadataKeyEnum implements Serializable {
* Values for this key are of type {@link BundleEntrySearchModeEnum}
*
*/
- public static final ResourceMetadataKeyEnum ENTRY_SEARCH_MODE = new ResourceMetadataKeyEnum("ENTRY_SEARCH_MODE") {
+ public static final ResourceMetadataKeySupportingAnyResource ENTRY_SEARCH_MODE = new ResourceMetadataKeySupportingAnyResource("ENTRY_SEARCH_MODE") {
private static final long serialVersionUID = 1L;
@Override
public BundleEntrySearchModeEnum get(IResource theResource) {
@@ -132,6 +144,16 @@ public abstract class ResourceMetadataKeyEnum implements Serializable {
public void put(IResource theResource, BundleEntrySearchModeEnum theObject) {
theResource.getResourceMetadata().put(ENTRY_SEARCH_MODE, theObject);
}
+
+ @Override
+ public String get(IAnyResource theResource) {
+ return (String) theResource.getUserData(ENTRY_SEARCH_MODE.name());
+ }
+
+ @Override
+ public void put(IAnyResource theResource, String theObject) {
+ theResource.setUserData(ENTRY_SEARCH_MODE.name(), theObject);
+ }
};
/**
@@ -146,7 +168,7 @@ public abstract class ResourceMetadataKeyEnum implements Serializable {
* Values for this key are of type {@link BundleEntryTransactionMethodEnum}
*
*/
- public static final ResourceMetadataKeyEnum ENTRY_TRANSACTION_METHOD = new ResourceMetadataKeyEnum(
+ public static final ResourceMetadataKeySupportingAnyResource ENTRY_TRANSACTION_METHOD = new ResourceMetadataKeySupportingAnyResource(
"ENTRY_TRANSACTION_OPERATION") {
private static final long serialVersionUID = 1L;
@@ -160,6 +182,16 @@ public abstract class ResourceMetadataKeyEnum implements Serializable {
public void put(IResource theResource, BundleEntryTransactionMethodEnum theObject) {
theResource.getResourceMetadata().put(ENTRY_TRANSACTION_METHOD, theObject);
}
+
+ @Override
+ public String get(IAnyResource theResource) {
+ return (String) theResource.getUserData(ENTRY_TRANSACTION_METHOD.name());
+ }
+
+ @Override
+ public void put(IAnyResource theResource, String theObject) {
+ theResource.setUserData(ENTRY_TRANSACTION_METHOD.name(), theObject);
+ }
};
@@ -575,4 +607,19 @@ public abstract class ResourceMetadataKeyEnum implements Serializable {
+ IdDt.class.getCanonicalName());
}
+ public static abstract class ResourceMetadataKeySupportingAnyResource extends ResourceMetadataKeyEnum {
+
+ public ResourceMetadataKeySupportingAnyResource(String theValue) {
+ super(theValue);
+ }
+
+ private static final long serialVersionUID = 1L;
+
+
+ public abstract T2 get(IAnyResource theResource);
+
+ public abstract void put(IAnyResource theResource, T2 theObject);
+
+ }
+
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseCodingDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseCodingDt.java
index 6c297dbe0a6..4669e072368 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseCodingDt.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseCodingDt.java
@@ -21,6 +21,7 @@ package ca.uhn.fhir.model.base.composite;
*/
import org.apache.commons.lang3.StringUtils;
+import org.hl7.fhir.instance.model.api.IBaseCoding;
import ca.uhn.fhir.model.api.BaseIdentifiableElement;
import ca.uhn.fhir.model.api.ICompositeDatatype;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java
index a9e65b40cc0..3446cb699c7 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java
@@ -675,4 +675,25 @@ public class IdDt extends UriDt implements IPrimitiveDatatype, IIdType {
return theIdPart.toString();
}
+ @Override
+ public IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart) {
+ if (isNotBlank(theVersionIdPart)) {
+ Validate.notBlank(theResourceType, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated");
+ Validate.notBlank(theIdPart, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated");
+ }
+ if (isNotBlank(theBaseUrl) && isNotBlank(theIdPart)) {
+ Validate.notBlank(theResourceType, "If theBaseUrl is populated and theIdPart is populated, theResourceType must be populated");
+ }
+
+ setValue(null);
+
+ myBaseUrl = theBaseUrl;
+ myResourceType = theResourceType;
+ myUnqualifiedId = theIdPart;
+ myUnqualifiedVersionId = StringUtils.defaultIfBlank(theVersionIdPart, null);
+ myHaveComponentParts = true;
+
+ return this;
+ }
+
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java
index 1e0941ee599..9f6141aab8a 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java
@@ -41,6 +41,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBase;
+import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IBaseMetaType;
import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -374,6 +375,15 @@ public abstract class BaseParser implements IParser {
return stringWriter.toString();
}
+ private void filterCodingsWithNoCodeOrSystem(List extends IBaseCoding> tagList) {
+ for (int i = 0; i < tagList.size(); i++) {
+ if (isBlank(tagList.get(i).getCode()) && isBlank(tagList.get(i).getSystem())) {
+ tagList.remove(i);
+ i--;
+ }
+ }
+ }
+
protected String fixContainedResourceId(String theValue) {
if (StringUtils.isNotBlank(theValue) && theValue.charAt(0) == '#') {
return theValue.substring(1);
@@ -409,7 +419,7 @@ public abstract class BaseParser implements IParser {
TagList tags = ResourceMetadataKeyEnum.TAG_LIST.get(theIResource);
if (shouldAddSubsettedTag()) {
tags = new TagList(tags);
- tags.add(new Tag(Constants.TAG_SUBSETTED_SYSTEM, Constants.TAG_SUBSETTED_CODE, "Resource encoded in summary mode"));
+ tags.add(new Tag(Constants.TAG_SUBSETTED_SYSTEM, Constants.TAG_SUBSETTED_CODE, subsetDescription()));
}
return tags;
@@ -538,56 +548,51 @@ public abstract class BaseParser implements IParser {
}
@SuppressWarnings("cast")
- protected List extends IBase> preProcessValues(BaseRuntimeChildDefinition metaChildUncast, List extends IBase> theValues) {
- if (myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
- if (shouldAddSubsettedTag() && metaChildUncast.getValidChildNames().contains("meta")) {
- BaseRuntimeElementDefinition> childByName = metaChildUncast.getChildByName("meta");
- if (childByName instanceof BaseRuntimeElementCompositeDefinition>) {
- BaseRuntimeElementCompositeDefinition> metaChildUncast1 = (BaseRuntimeElementCompositeDefinition>) childByName;
- if (metaChildUncast1 != null) {
- if (IBaseMetaType.class.isAssignableFrom(metaChildUncast1.getImplementingClass())) {
- IBaseMetaType metaValue;
- if (theValues != null && theValues.size() >= 1) {
- metaValue = (IBaseMetaType) theValues.iterator().next();
- try {
- metaValue = (IBaseMetaType) metaValue.getClass().getMethod("copy").invoke(metaValue);
- } catch (Exception e) {
- throw new InternalErrorException("Failed to duplicate meta", e);
- }
- } else {
- metaValue = (IBaseMetaType) metaChildUncast1.newInstance();
- }
-
- ArrayList retVal = new ArrayList();
- retVal.add(metaValue);
-
- BaseRuntimeChildDefinition tagChild = metaChildUncast1.getChildByName("tag");
- BaseRuntimeElementCompositeDefinition> codingDef = (BaseRuntimeElementCompositeDefinition>) ((BaseRuntimeElementCompositeDefinition>) tagChild.getChildByName("tag"));
- IBase coding = codingDef.newInstance();
- tagChild.getMutator().addValue(metaValue, coding);
-
- BaseRuntimeChildDefinition systemChild = codingDef.getChildByName("system");
- IPrimitiveType> system = (IPrimitiveType>) myContext.getElementDefinition("uri").newInstance();
- system.setValueAsString(Constants.TAG_SUBSETTED_SYSTEM);
- systemChild.getMutator().addValue(coding, system);
-
- BaseRuntimeChildDefinition codeChild = codingDef.getChildByName("code");
- IPrimitiveType> code = (IPrimitiveType>) myContext.getElementDefinition("code").newInstance();
- code.setValueAsString(Constants.TAG_SUBSETTED_CODE);
- codeChild.getMutator().addValue(coding, code);
-
- BaseRuntimeChildDefinition displayChild = codingDef.getChildByName("display");
- IPrimitiveType> display = (IPrimitiveType>) myContext.getElementDefinition("string").newInstance();
- display.setValueAsString("Resource encoded in summary mode");
- displayChild.getMutator().addValue(coding, display);
-
- return retVal;
- }
- }
+ protected List extends IBase> preProcessValues(BaseRuntimeChildDefinition metaChildUncast, IBaseResource theResource, List extends IBase> theValues) {
+ if (myContext.getVersion().getVersion().isRi()) {
+
+ /*
+ * If we're encoding the meta tag, we do some massaging of the meta values before
+ * encoding. Buf if there is no meta element at all, we create one since we're possibly going to be
+ * adding things to it
+ */
+ if (theValues.isEmpty() && metaChildUncast.getElementName().equals("meta")) {
+ BaseRuntimeElementDefinition> metaChild = metaChildUncast.getChildByName("meta");
+ if (IBaseMetaType.class.isAssignableFrom(metaChild.getImplementingClass())) {
+ IBaseMetaType newType = (IBaseMetaType) metaChild.newInstance();
+ theValues = Collections.singletonList(newType);
}
}
+
+ if (theValues.size() == 1 && theValues.get(0) instanceof IBaseMetaType) {
+
+ IBaseMetaType metaValue = (IBaseMetaType) theValues.get(0);
+ try {
+ metaValue = (IBaseMetaType) metaValue.getClass().getMethod("copy").invoke(metaValue);
+ } catch (Exception e) {
+ throw new InternalErrorException("Failed to duplicate meta", e);
+ }
+
+ if (isBlank(metaValue.getVersionId())) {
+ if (theResource.getIdElement().hasVersionIdPart()) {
+ metaValue.setVersionId(theResource.getIdElement().getVersionIdPart());
+ }
+ }
+
+ filterCodingsWithNoCodeOrSystem(metaValue.getTag());
+ filterCodingsWithNoCodeOrSystem(metaValue.getSecurity());
+
+ if (shouldAddSubsettedTag()) {
+ IBaseCoding coding = metaValue.addTag();
+ coding.setCode(Constants.TAG_SUBSETTED_CODE);
+ coding.setSystem(Constants.TAG_SUBSETTED_SYSTEM);
+ coding.setDisplay(subsetDescription());
+ }
+
+ return Collections.singletonList(metaValue);
+ }
}
-
+
return theValues;
}
@@ -656,6 +661,10 @@ public abstract class BaseParser implements IParser {
return isSummaryMode() || isSuppressNarratives();
}
+ private String subsetDescription() {
+ return "Resource encoded in summary mode";
+ }
+
protected void throwExceptionForUnknownChildType(BaseRuntimeChildDefinition nextChild, Class extends IBase> theType) {
if (nextChild instanceof BaseRuntimeDeclaredChildDefinition) {
StringBuilder b = new StringBuilder();
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java
index c29676a95bc..d499f27fbb1 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java
@@ -531,7 +531,7 @@ public class JsonParser extends BaseParser implements IParser {
BaseRuntimeChildDefinition nextChild = nextChildElem.getDef();
if (nextChild instanceof RuntimeChildNarrativeDefinition) {
INarrativeGenerator gen = myContext.getNarrativeGenerator();
- if (gen != null) {
+ if (gen != null && theResource instanceof IResource) {
BaseNarrativeDt> narr = ((IResource) theResource).getText();
if (narr.getDiv().isEmpty()) {
gen.generateNarrative(theResDef.getResourceProfile(), theResource, narr);
@@ -552,7 +552,7 @@ public class JsonParser extends BaseParser implements IParser {
}
List extends IBase> values = nextChild.getAccessor().getValues(theNextValue);
- values = super.preProcessValues(nextChild, values);
+ values = super.preProcessValues(nextChild, theResource, values);
if (values == null || values.isEmpty()) {
continue;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java
index 1f895749867..949e44829ae 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java
@@ -28,6 +28,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java
index 5cf70ca0d32..b6e9c1f04bc 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java
@@ -600,7 +600,7 @@ public class XmlParser extends BaseParser implements IParser {
} else {
List extends IBase> values = nextChild.getAccessor().getValues(theElement);
- values = super.preProcessValues(nextChild, values);
+ values = super.preProcessValues(nextChild, theResource, values);
if (values == null || values.isEmpty()) {
continue;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/OptionalParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/OptionalParam.java
index e40a6834266..39c0c0507f2 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/OptionalParam.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/OptionalParam.java
@@ -23,8 +23,9 @@ package ca.uhn.fhir.rest.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+
import ca.uhn.fhir.model.api.IQueryParameterType;
-import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.rest.param.CompositeParam;
import ca.uhn.fhir.rest.param.ReferenceParam;
//import ca.uhn.fhir.testmodel.Patient; // TODO: qualify this correctly
@@ -116,5 +117,5 @@ public @interface OptionalParam {
* this value must not be populated.
*
*/
- Class extends IResource>[] targetTypes() default {};
+ Class extends IBaseResource>[] targetTypes() default {};
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/RequiredParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/RequiredParam.java
index 110148f8f72..84b93d23171 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/RequiredParam.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/RequiredParam.java
@@ -23,8 +23,9 @@ package ca.uhn.fhir.rest.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+
import ca.uhn.fhir.model.api.IQueryParameterType;
-import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.rest.param.CompositeParam;
import ca.uhn.fhir.rest.param.ReferenceParam;
//import ca.uhn.fhir.testmodel.Patient; // TODO: qualify this correctly
@@ -97,6 +98,6 @@ public @interface RequiredParam {
* If the parameter annotated with this annotation is not a {@link ReferenceParam}, this value must not be populated.
*
*/
- Class extends IResource>[] targetTypes() default {};
+ Class extends IBaseResource>[] targetTypes() default {};
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/MethodOutcome.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/MethodOutcome.java
index 68962458dfc..d148828dfa7 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/MethodOutcome.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/MethodOutcome.java
@@ -50,7 +50,7 @@ public class MethodOutcome {
* If not null, indicates whether the resource was created (as opposed to being updated). This is generally not needed, since the server can assume based on the method being called
* whether the result was a creation or an update. However, it can be useful if you are implementing an update method that does a create if the ID doesn't already exist.
*/
- public MethodOutcome(IdDt theId, Boolean theCreated) {
+ public MethodOutcome(IIdType theId, Boolean theCreated) {
myId = theId;
myCreated = theCreated;
}
@@ -64,7 +64,7 @@ public class MethodOutcome {
* @param theBaseOperationOutcome
* The operation outcome to return with the response (or null for none)
*/
- public MethodOutcome(IdDt theId, IBaseOperationOutcome theBaseOperationOutcome) {
+ public MethodOutcome(IIdType theId, IBaseOperationOutcome theBaseOperationOutcome) {
myId = theId;
myOperationOutcome = theBaseOperationOutcome;
}
@@ -82,17 +82,17 @@ public class MethodOutcome {
* If not null, indicates whether the resource was created (as opposed to being updated). This is generally not needed, since the server can assume based on the method being called
* whether the result was a creation or an update. However, it can be useful if you are implementing an update method that does a create if the ID doesn't already exist.
*/
- public MethodOutcome(IdDt theId, IBaseOperationOutcome theBaseOperationOutcome, Boolean theCreated) {
+ public MethodOutcome(IIdType theId, IBaseOperationOutcome theBaseOperationOutcome, Boolean theCreated) {
myId = theId;
myOperationOutcome = theBaseOperationOutcome;
myCreated = theCreated;
}
/**
- * @deprecated Use the constructor which accepts a single IdDt parameter, and include the logical ID and version ID in that IdDt instance
+ * @deprecated Use the constructor which accepts a single IIdType parameter, and include the logical ID and version ID in that IIdType instance
*/
@Deprecated
- public MethodOutcome(IdDt theId, IdDt theVersionId) {
+ public MethodOutcome(IIdType theId, IdDt theVersionId) {
myId = theId;
myVersionId = theVersionId;
}
@@ -101,7 +101,7 @@ public class MethodOutcome {
* @deprecated Use the constructor which accepts a single IdDt parameter, and include the logical ID and version ID in that IdDt instance
*/
@Deprecated
- public MethodOutcome(IdDt theId, IdDt theVersionId, IBaseOperationOutcome theBaseOperationOutcome) {
+ public MethodOutcome(IIdType theId, IdDt theVersionId, IBaseOperationOutcome theBaseOperationOutcome) {
myId = theId;
myVersionId = theVersionId;
myOperationOutcome = theBaseOperationOutcome;
@@ -175,7 +175,7 @@ public class MethodOutcome {
* @param theId
* The ID of the created/updated resource
*/
- public void setId(IdDt theId) {
+ public void setId(IIdType theId) {
myId = theId;
}
@@ -200,7 +200,7 @@ public class MethodOutcome {
}
/**
- * @deprecated Put the ID and version ID into the same IdDt instance and pass it to {@link #setId(IdDt)}
+ * @deprecated Put the ID and version ID into the same IdDt instance and pass it to {@link #setId(IIdType)}
*/
@Deprecated
public void setVersionId(IdDt theVersionId) {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java
index 6b568af7fde..9383bdc93b2 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java
@@ -853,10 +853,10 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
@Override
- public IDeleteTyped resource(IResource theResource) {
+ public IDeleteTyped resource(IBaseResource theResource) {
Validate.notNull(theResource, "theResource can not be null");
- IdDt id = theResource.getId();
- Validate.notNull(id, "theResource.getId() can not be null");
+ IIdType id = theResource.getIdElement();
+ Validate.notNull(id, "theResource.getIdElement() can not be null");
if (id.hasResourceType() == false || id.hasIdPart() == false) {
throw new IllegalArgumentException("theResource.getId() must contain a resource type and logical ID at a minimum (e.g. Patient/1234), found: " + id.getValue());
}
@@ -1798,7 +1798,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
}
- if (myReturnBundleType == null && myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
+ if (myReturnBundleType == null && myContext.getVersion().getVersion().isRi()) {
throw new IllegalArgumentException("When using the client with HL7.org structures, you must specify "
+ "the bundle return type for the client by adding \".returnBundle(org.hl7.fhir.instance.model.Bundle.class)\" to your search method call before the \".execute()\" method");
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/interceptor/GZipContentInterceptor.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/interceptor/GZipContentInterceptor.java
index c4d73341395..c5b7803c647 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/interceptor/GZipContentInterceptor.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/interceptor/GZipContentInterceptor.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.client.interceptor;
+/*
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPOutputStream;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IDelete.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IDelete.java
index 6c0441897b3..a8f24b7bcc3 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IDelete.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IDelete.java
@@ -3,8 +3,6 @@ package ca.uhn.fhir.rest.gclient;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
-import ca.uhn.fhir.model.api.IResource;
-
/*
* #%L
* HAPI FHIR - Core Library
@@ -27,7 +25,7 @@ import ca.uhn.fhir.model.api.IResource;
public interface IDelete {
- IDeleteTyped resource(IResource theResource);
+ IDeleteTyped resource(IBaseResource theResource);
IDeleteTyped resourceById(IIdType theId);
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseOutcomeReturningMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseOutcomeReturningMethodBinding.java
index 37316520fa4..ee5e66dba83 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseOutcomeReturningMethodBinding.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseOutcomeReturningMethodBinding.java
@@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.instance.model.api.IIdType;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
@@ -267,12 +268,14 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding 0) {
String locationHeader = locationHeaders.get(0);
- BaseOutcomeReturningMethodBinding.parseContentLocation(retVal, theResourceName, locationHeader);
+ BaseOutcomeReturningMethodBinding.parseContentLocation(theContext, retVal, theResourceName, locationHeader);
}
if (theResponseStatusCode != Constants.STATUS_HTTP_204_NO_CONTENT) {
EncodingEnum ct = EncodingEnum.forContentType(theResponseMimeType);
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationParameter.java
index cf9bf56e18a..53b3b562a61 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationParameter.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/OperationParameter.java
@@ -43,6 +43,7 @@ import ca.uhn.fhir.context.RuntimeChildPrimitiveDatatypeDefinition;
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.HapiLocalizer;
+import ca.uhn.fhir.model.api.IDatatype;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.RequestTypeEnum;
import ca.uhn.fhir.rest.api.ValidationModeEnum;
@@ -66,7 +67,7 @@ public class OperationParameter implements IParameter {
private final String myOperationName;
private Class> myParameterType;
private String myParamType;
- private FhirContext myContext;
+ private final FhirContext myContext;
private boolean myAllowGet;
public OperationParameter(FhirContext theCtx, String theOperationName, OperationParam theOperationParam) {
@@ -83,6 +84,10 @@ public class OperationParameter implements IParameter {
+ protected FhirContext getContext() {
+ return myContext;
+ }
+
public int getMax() {
return myMax;
}
@@ -102,6 +107,12 @@ public class OperationParameter implements IParameter {
@SuppressWarnings("unchecked")
@Override
public void initializeTypes(Method theMethod, Class extends Collection>> theOuterCollectionType, Class extends Collection>> theInnerCollectionType, Class> theParameterType) {
+ if (getContext().getVersion().getVersion().isRi()) {
+ if (IDatatype.class.isAssignableFrom(theParameterType)) {
+ throw new ConfigurationException("Incorrect use of type " + theParameterType.getSimpleName() + " as parameter type for method when context is for version " + getContext().getVersion().getVersion().name() + " in method: " + theMethod.toString());
+ }
+ }
+
myParameterType = theParameterType;
if (theInnerCollectionType != null) {
myInnerCollectionType = CollectionBinder.getInstantiableCollectionType(theInnerCollectionType, myName);
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RequestDetails.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RequestDetails.java
index ff60bbe59f4..5d074f8fbe5 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RequestDetails.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/RequestDetails.java
@@ -31,6 +31,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.hl7.fhir.instance.model.api.IIdType;
+
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.RequestTypeEnum;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
@@ -43,7 +45,7 @@ public abstract class RequestDetails {
private String myCompartmentName;
private String myCompleteUrl;
private String myFhirServerBase;
- private IdDt myId;
+ private IIdType myId;
private String myOperation;
private Map myParameters;
private String myRequestPath;
@@ -72,7 +74,7 @@ public abstract class RequestDetails {
return myFhirServerBase;
}
- public IdDt getId() {
+ public IIdType getId() {
return myId;
}
@@ -132,7 +134,7 @@ public abstract class RequestDetails {
myFhirServerBase = theFhirServerBase;
}
- public void setId(IdDt theId) {
+ public void setId(IIdType theId) {
myId = theId;
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchParameter.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchParameter.java
index 17d7710c23d..2a9e2198544 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchParameter.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/SearchParameter.java
@@ -30,13 +30,13 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IQueryParameterAnd;
import ca.uhn.fhir.model.api.IQueryParameterOr;
import ca.uhn.fhir.model.api.IQueryParameterType;
-import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.model.base.composite.BaseQuantityDt;
import ca.uhn.fhir.model.primitive.StringDt;
@@ -133,7 +133,7 @@ public class SearchParameter extends BaseQueryParameter {
}
private List> myCompositeTypes;
- private List> myDeclaredTypes;
+ private List> myDeclaredTypes;
private String myDescription;
private String myName;
private IParamBinder> myParamBinder;
@@ -168,7 +168,7 @@ public class SearchParameter extends BaseQueryParameter {
return retVal;
}
- public List> getDeclaredTypes() {
+ public List> getDeclaredTypes() {
return Collections.unmodifiableList(myDeclaredTypes);
}
@@ -255,7 +255,7 @@ public class SearchParameter extends BaseQueryParameter {
myCompositeTypes = Arrays.asList(theCompositeTypes);
}
- public void setDeclaredTypes(Class extends IResource>[] theTypes) {
+ public void setDeclaredTypes(Class extends IBaseResource>[] theTypes) {
myDeclaredTypes = Arrays.asList(theTypes);
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/UpdateMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/UpdateMethodBinding.java
index d463e9c7dc6..1e8578cfef8 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/UpdateMethodBinding.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/UpdateMethodBinding.java
@@ -1,6 +1,5 @@
package ca.uhn.fhir.rest.method;
-import static org.apache.commons.lang3.StringUtils.isBlank;
/*
* #%L
* HAPI FHIR - Core Library
@@ -26,6 +25,8 @@ import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Set;
+import org.hl7.fhir.instance.model.api.IIdType;
+
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.primitive.IdDt;
@@ -59,9 +60,9 @@ public class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithRe
* Content-Location header, but we allow it in the PUT URL as well..
*/
String locationHeader = theRequest.getHeader(Constants.HEADER_CONTENT_LOCATION);
- IdDt id = theRequest.getId();
+ IIdType id = theRequest.getId();
if (isNotBlank(locationHeader)) {
- id = new IdDt(locationHeader);
+ id.setValue(locationHeader);
if (isNotBlank(id.getResourceType())) {
if (!getResourceName().equals(id.getResourceType())) {
throw new InvalidRequestException("Attempting to update '" + getResourceName() + "' but content-location header specifies different resource type '" + id.getResourceType() + "' - header value: " + locationHeader);
@@ -85,7 +86,7 @@ public class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithRe
if (isNotBlank(locationHeader)) {
MethodOutcome mo = new MethodOutcome();
- parseContentLocation(mo, getResourceName(), locationHeader);
+ parseContentLocation(getContext(), mo, getResourceName(), locationHeader);
if (mo.getId() == null || mo.getId().isEmpty()) {
throw new InvalidRequestException("Invalid Content-Location header for resource " + getResourceName() + ": " + locationHeader);
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateParam.java
index a05cb5b41e9..75dc9aed720 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateParam.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateParam.java
@@ -25,6 +25,7 @@ import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.Validate;
+import org.hl7.fhir.instance.model.api.IPrimitiveType;
import ca.uhn.fhir.model.api.IQueryParameterOr;
import ca.uhn.fhir.model.api.IQueryParameterType;
@@ -63,6 +64,14 @@ public class DateParam extends DateTimeDt implements IQueryParameterType, IQuery
setValueAsString(theDate != null ? theDate.getValueAsString() : null);
}
+ /**
+ * Constructor
+ */
+ public DateParam(QuantityCompararatorEnum theComparator, IPrimitiveType theDate) {
+ myComparator = theComparator;
+ setValueAsString(theDate != null ? theDate.getValueAsString() : null);
+ }
+
/**
* Constructor
*/
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java
index 187be2eb313..f48b3cfadc2 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java
@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import org.hl7.fhir.instance.model.api.IPrimitiveType;
+
import ca.uhn.fhir.model.api.IQueryParameterAnd;
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
import ca.uhn.fhir.model.primitive.DateTimeDt;
@@ -106,6 +108,20 @@ public class DateRangeParam implements IQueryParameterAnd {
setRangeFromDatesInclusive(theLowerBound, theUpperBound);
}
+ /**
+ * Constructor which takes two Dates representing the lower and upper bounds of the range (inclusive on both ends)
+ *
+ * @param theLowerBound
+ * A qualified date param representing the lower date bound (optionally may include time), e.g.
+ * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or theUpperBound may both be populated, or one may be null, but it is not valid for both to be null.
+ * @param theUpperBound
+ * A qualified date param representing the upper date bound (optionally may include time), e.g.
+ * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or theUpperBound may both be populated, or one may be null, but it is not valid for both to be null.
+ */
+ public DateRangeParam(IPrimitiveType theLowerBound, IPrimitiveType theUpperBound) {
+ setRangeFromDatesInclusive(theLowerBound, theUpperBound);
+ }
+
/**
* Constructor which takes two strings representing the lower and upper bounds of the range (inclusive on both ends)
*
@@ -272,6 +288,21 @@ public class DateRangeParam implements IQueryParameterAnd {
validateAndThrowDataFormatExceptionIfInvalid();
}
+ /**
+ * Sets the range from a pair of dates, inclusive on both ends
+ *
+ * @param theLowerBound
+ * A qualified date param representing the lower date bound (optionally may include time), e.g.
+ * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or theUpperBound may both be populated, or one may be null, but it is not valid for both to be null.
+ * @param theUpperBound
+ * A qualified date param representing the upper date bound (optionally may include time), e.g.
+ * "2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or theUpperBound may both be populated, or one may be null, but it is not valid for both to be null.
+ */
+ public void setRangeFromDatesInclusive(IPrimitiveType theLowerBound, IPrimitiveType theUpperBound) {
+ myLowerBound = theLowerBound != null ? new DateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, theLowerBound) : null;
+ myUpperBound = theUpperBound != null ? new DateParam(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS, theUpperBound) : null;
+ validateAndThrowDataFormatExceptionIfInvalid();
+ }
/**
* Sets the range from a pair of dates, inclusive on both ends
*
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/QuantityParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/QuantityParam.java
index cf9af94e4bc..30dd986fdb8 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/QuantityParam.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/QuantityParam.java
@@ -116,6 +116,16 @@ public class QuantityParam extends BaseParam implements IQueryParameterType {
setValueAsQueryToken(null, theQuantity);
}
+ /**
+ * Constructor
+ *
+ * @param theQuantity
+ * A quantity value (with no system or units), such as 100
+ */
+ public QuantityParam(long theQuantity) {
+ setValueAsQueryToken(null, Long.toString(theQuantity));
+ }
+
/**
* Constructor
*
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
index 3e2fd30ac04..8bb2dccee1f 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
@@ -50,12 +50,12 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.instance.model.api.IIdType;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.ProvidedResourceScanner;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
-import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.annotation.Destroy;
import ca.uhn.fhir.rest.annotation.IdParam;
@@ -64,7 +64,6 @@ import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.RequestTypeEnum;
import ca.uhn.fhir.rest.method.BaseMethodBinding;
import ca.uhn.fhir.rest.method.ConformanceMethodBinding;
-import ca.uhn.fhir.rest.method.PageMethodBinding;
import ca.uhn.fhir.rest.method.ParseAction;
import ca.uhn.fhir.rest.method.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
@@ -565,13 +564,14 @@ public class RestfulServer extends HttpServlet implements IRestfulServer params = new HashMap(theRequest.getParameterMap());
requestDetails.setParameters(params);
- IdDt id;
+ IIdType id;
populateRequestDetailsFromRequestPath(requestDetails, requestPath);
if (theRequestType == RequestTypeEnum.PUT) {
String contentLocation = theRequest.getHeader(Constants.HEADER_CONTENT_LOCATION);
if (contentLocation != null) {
- id = new IdDt(contentLocation);
+ id = myFhirContext.getVersion().newIdType();
+ id.setValue(contentLocation);
requestDetails.setId(id);
}
}
@@ -876,7 +876,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer theStrings) {
+ public static String joinStringsSpaceSeparated(List extends IPrimitiveType> theStrings) {
StringBuilder b = new StringBuilder();
- for (StringDt next : theStrings) {
+ for (IPrimitiveType next : theStrings) {
if (next.isEmpty()) {
continue;
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/FhirTerser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/FhirTerser.java
index e4459467e61..2664349e882 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/FhirTerser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/FhirTerser.java
@@ -30,8 +30,12 @@ import java.util.TreeSet;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBase;
+import org.hl7.fhir.instance.model.api.IBaseExtension;
+import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
+import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.instance.model.api.IDomainResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
@@ -68,6 +72,21 @@ public class FhirTerser {
addUndeclaredExtensions(nextExt, theDefinition, theChildDefinition, theCallback);
}
}
+
+ if (theElement instanceof IBaseHasExtensions) {
+ for (IBaseExtension, ?> nextExt : ((IBaseHasExtensions)theElement).getExtension()) {
+ theCallback.acceptElement(nextExt.getValue(), null, theChildDefinition, theDefinition);
+ addUndeclaredExtensions(nextExt, theDefinition, theChildDefinition, theCallback);
+ }
+ }
+
+ if (theElement instanceof IBaseHasModifierExtensions) {
+ for (IBaseExtension, ?> nextExt : ((IBaseHasModifierExtensions)theElement).getModifierExtension()) {
+ theCallback.acceptElement(nextExt.getValue(), null, theChildDefinition, theDefinition);
+ addUndeclaredExtensions(nextExt, theDefinition, theChildDefinition, theCallback);
+ }
+ }
+
}
/**
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/IModelVisitor.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/IModelVisitor.java
index c894b4e9302..3deb1aa1b9a 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/IModelVisitor.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/IModelVisitor.java
@@ -23,6 +23,7 @@ package ca.uhn.fhir.util;
import java.util.List;
import org.hl7.fhir.instance.model.api.IBase;
+import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
@@ -52,6 +53,4 @@ public interface IModelVisitor {
*/
void acceptUndeclaredExtension(ISupportsUndeclaredExtensions theContainingElement, List thePathToElement, BaseRuntimeChildDefinition theChildDefinition, BaseRuntimeElementDefinition> theDefinition, ExtensionDt theNextExt);
-
-
}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java
index 263359775b0..6e5ef105ff4 100644
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java
+++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java
@@ -1,6 +1,7 @@
package org.hl7.fhir.instance.model.api;
-import java.util.HashMap;
+import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
+import ca.uhn.fhir.rest.gclient.StringClientParam;
/*
* #%L
@@ -24,14 +25,41 @@ import java.util.HashMap;
public interface IAnyResource extends IBaseResource {
+ /**
+ * Search parameter constant for _language
+ */
+ @SearchParamDefinition(name="_language", path="", description="The language of the resource", type="string" )
+ public static final String SP_RES_LANGUAGE = "_language";
+
+
+ /**
+ * Search parameter constant for _id
+ */
+ @SearchParamDefinition(name="_id", path="", description="The ID of the resource", type="string" )
+ public static final String SP_RES_ID = "_id";
+
+ /**
+ * Fluent Client search parameter constant for _id
+ *
+ * Description: the _id of a resource
+ * Type: string
+ * Path: Resource._id
+ *
+ */
+ public static final StringClientParam RES_ID = new StringClientParam(IAnyResource.SP_RES_ID);
+
String getId();
+ @Override
IIdType getIdElement();
+ IPrimitiveType getLanguageElement();
+
IBaseMetaType getMeta();
public Object getUserData(String name);
+ @Override
IAnyResource setId(String theId);
public void setUserData(String name, Object value);
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseBackboneElement.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseBackboneElement.java
index 2e9a014dc93..871db2deadf 100644
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseBackboneElement.java
+++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseBackboneElement.java
@@ -1,5 +1,7 @@
package org.hl7.fhir.instance.model.api;
+import ca.uhn.fhir.model.api.IElement;
+
/*
* #%L
* HAPI FHIR - Core Library
@@ -21,6 +23,6 @@ package org.hl7.fhir.instance.model.api;
*/
-public interface IBaseBackboneElement extends IBase, IBaseHasExtensions, IBaseHasModifierExtensions {
+public interface IBaseBackboneElement extends IElement, IBaseHasExtensions, IBaseHasModifierExtensions {
}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseDatatype.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseDatatype.java
index 1507c3fd6f9..444de8086fd 100644
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseDatatype.java
+++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseDatatype.java
@@ -1,5 +1,7 @@
package org.hl7.fhir.instance.model.api;
+import ca.uhn.fhir.model.api.IElement;
+
/*
* #%L
* HAPI FHIR - Core Library
@@ -21,6 +23,6 @@ package org.hl7.fhir.instance.model.api;
*/
-public interface IBaseDatatype extends IBase {
+public interface IBaseDatatype extends IElement {
}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseMetaType.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseMetaType.java
index 6c40da79484..368145a0db7 100644
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseMetaType.java
+++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseMetaType.java
@@ -45,4 +45,16 @@ public interface IBaseMetaType extends ICompositeType {
IBaseMetaType setVersionId(String theVersionId);
+ /**
+ * Returns the first tag (if any) that has the given system and code, or returns
+ * null if none
+ */
+ IBaseCoding getTag(String theSystem, String theCode);
+
+ /**
+ * Returns the first security label (if any) that has the given system and code, or returns
+ * null if none
+ */
+ IBaseCoding getSecurity(String theSystem, String theCode);
+
}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseResource.java
index e774a67a73f..e9483ebd948 100644
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseResource.java
+++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseResource.java
@@ -1,7 +1,13 @@
package org.hl7.fhir.instance.model.api;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.model.api.IElement;
+import ca.uhn.fhir.model.api.Include;
/*
* #%L
@@ -33,6 +39,16 @@ import ca.uhn.fhir.model.api.IElement;
*/
public interface IBaseResource extends IBase, IElement {
+ /**
+ * Include constant for * (return all includes)
+ */
+ public static final Include INCLUDE_ALL = new Include("*", false).toLocked();
+
+ /**
+ * Include set containing only {@link #INCLUDE_ALL}
+ */
+ public static final Set WILDCARD_ALL_SET = Collections.unmodifiableSet(new HashSet(Arrays.asList(INCLUDE_ALL)));
+
IIdType getIdElement();
IBaseResource setId(String theId);
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IDomainResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IDomainResource.java
index 24ab6d8e11a..a60790348af 100644
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IDomainResource.java
+++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IDomainResource.java
@@ -22,7 +22,7 @@ package org.hl7.fhir.instance.model.api;
import java.util.List;
-public interface IDomainResource extends IAnyResource {
+public interface IDomainResource extends IAnyResource, IBaseHasExtensions, IBaseHasModifierExtensions {
List extends IAnyResource> getContained();
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java
index 91b5a7d456f..7f47927a887 100644
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java
+++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java
@@ -135,4 +135,20 @@ public interface IIdType {
IIdType withVersion(String theVersion);
+ /**
+ * Sets the value of this ID by combining all of the individual parts.
+ *
+ * Required parameters: The following rules apply to the parameters of this method (in this case, populated means
+ * a non-empty string and not populated means null or an empty string)
+ *
+ *
+ *
All values may be not populated
+ *
If theVersionIdPart is populated, theResourceType and theIdPart must be populated
+ *
If theBaseUrl is populated and theIdPart is populated, theResourceType must be populated
+ *
+ *
+ * @return Returns a reference to this for easy method chaining
+ */
+ IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart);
+
}
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java
index bbef3d408a4..8e5ee0eb7e5 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsPageProvider.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsPageProvider.java
index b37fa58a482..0ff71ac2b38 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsPageProvider.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsPageProvider.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.io.IOException;
import java.util.Collections;
import java.util.List;
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsProvider.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsProvider.java
index 40613f02104..bba5f03b374 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsProvider.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsProvider.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.util.HashMap;
import java.util.List;
import java.util.Map;
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java
index 0a13cfb697a..b0b21b2c105 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.io.IOException;
import java.net.URL;
import java.util.Collections;
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptor.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptor.java
index f4665f8d0b1..fa2e1af41f6 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptor.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsExceptionInterceptor.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server.interceptor;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.io.IOException;
import javax.interceptor.AroundInvoke;
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsResponseException.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsResponseException.java
index 893fd23c1f1..ebc57bcd467 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsResponseException.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/interceptor/JaxRsResponseException.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server.interceptor;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 javax.ejb.ApplicationException;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java
index 1113ddb5fa6..f7e41277be6 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server.util;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.lang.reflect.Method;
import java.util.concurrent.ConcurrentHashMap;
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequest.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequest.java
index 296a5f2faa7..15176703bc6 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequest.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsRequest.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server.util;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsResponse.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsResponse.java
index 7239427e5ba..3fa1825f8f5 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsResponse.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsResponse.java
@@ -1,5 +1,25 @@
package ca.uhn.fhir.jaxrs.server.util;
+/*
+ * #%L
+ * HAPI FHIR JAX-RS Server
+ * %%
+ * Copyright (C) 2014 - 2015 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 java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index a1f03e72b3c..5f8a3fc5806 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -404,6 +404,11 @@
hapi-fhir-structures-dstu2.11.4-SNAPSHOT
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation-resources-dstu2.1
+ 1.4-SNAPSHOT
+
@@ -436,6 +441,7 @@
true
+
- org.hibernatehibernate-core
- ${hibernate_version}
+
+
+ org.hibernate
+ hibernate-core
+ ${hibernate_version}
+
+ o10g
@@ -501,6 +511,7 @@
+ -->
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu21Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu21Config.java
index c3c0ec76cc1..a42e53a923a 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu21Config.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu21Config.java
@@ -42,7 +42,7 @@ public class BaseDstu21Config extends BaseConfig {
}
@Bean(name = "mySystemDaoDstu21", autowire = Autowire.BY_NAME)
- public IFhirSystemDao systemDaoDstu21() {
+ public IFhirSystemDao systemDaoDstu21() {
ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu21 retVal = new ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu21();
return retVal;
}
@@ -55,7 +55,7 @@ public class BaseDstu21Config extends BaseConfig {
}
@Bean(name = "myJpaValidationSupportDstu21", autowire = Autowire.BY_NAME)
- public ca.uhn.fhir.jpa.dao.IJpaValidationSupport jpaValidationSupportDstu2() {
+ public ca.uhn.fhir.jpa.dao.IJpaValidationSupportDstu21 jpaValidationSupportDstu2() {
ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu21 retVal = new ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu21();
return retVal;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu2Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu2Config.java
index 1b53b39389a..c7a490a09bd 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu2Config.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu2Config.java
@@ -56,7 +56,7 @@ public class BaseDstu2Config extends BaseConfig {
}
@Bean(name = "myJpaValidationSupportDstu2", autowire = Autowire.BY_NAME)
- public ca.uhn.fhir.jpa.dao.IJpaValidationSupport jpaValidationSupportDstu2() {
+ public ca.uhn.fhir.jpa.dao.IJpaValidationSupportDstu2 jpaValidationSupportDstu2() {
ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu2 retVal = new ca.uhn.fhir.jpa.dao.JpaValidationSupportDstu2();
return retVal;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
index 18fa1b5623f..b10c70af069 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
@@ -53,8 +53,15 @@ import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
+import org.hl7.fhir.dstu21.model.IdType;
+import org.hl7.fhir.dstu21.model.StringType;
+import org.hl7.fhir.dstu21.model.Bundle.HTTPVerb;
+import org.hl7.fhir.instance.model.api.IAnyResource;
+import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
+import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.instance.model.api.IDomainResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.springframework.beans.factory.annotation.Autowired;
@@ -108,6 +115,7 @@ import ca.uhn.fhir.model.dstu.resource.BaseResource;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.StringDt;
+import ca.uhn.fhir.model.primitive.XhtmlDt;
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.parser.IParser;
@@ -167,7 +175,6 @@ public abstract class BaseHapiFhirDao implements IDao {
RESOURCE_META_AND_PARAMS = Collections.unmodifiableMap(resourceMetaAndParams);
}
-
public static final long INDEX_STATUS_INDEXED = Long.valueOf(1L);
public static final long INDEX_STATUS_INDEXING_FAILED = Long.valueOf(2L);
public static final String NS_JPA_PROFILE = "https://github.com/jamesagnew/hapi-fhir/ns/jpa/profile";
@@ -225,13 +232,12 @@ public abstract class BaseHapiFhirDao implements IDao {
myPlatformTransactionManager = thePlatformTransactionManager;
}
-// @Override
-// public void setResourceDaos(List> theResourceDaos) {
-// myResourceDaos = theResourceDaos;
-// }
+ // @Override
+ // public void setResourceDaos(List> theResourceDaos) {
+ // myResourceDaos = theResourceDaos;
+ // }
-
- protected Set extractResourceLinks(ResourceTable theEntity, IResource theResource) {
+ protected Set extractResourceLinks(ResourceTable theEntity, IBaseResource theResource) {
Set retVal = new HashSet();
RuntimeResourceDefinition def = getContext().getResourceDefinition(theResource);
@@ -262,31 +268,31 @@ public abstract class BaseHapiFhirDao implements IDao {
}
ResourceLink nextEntity;
- if (nextObject instanceof BaseResourceReferenceDt) {
- BaseResourceReferenceDt nextValue = (BaseResourceReferenceDt) nextObject;
+ if (nextObject instanceof IBaseReference) {
+ IBaseReference nextValue = (IBaseReference) nextObject;
if (nextValue.isEmpty()) {
continue;
}
- if (nextValue.getReference().isEmpty() || nextValue.getReference().getValue().startsWith("#")) {
+ if (nextValue.getReferenceElement().isEmpty() || nextValue.getReferenceElement().getValue().startsWith("#")) {
// This is a blank or contained resource reference
continue;
}
- String typeString = nextValue.getReference().getResourceType();
+ String typeString = nextValue.getReferenceElement().getResourceType();
if (isBlank(typeString)) {
- throw new InvalidRequestException("Invalid resource reference found at path[" + nextPathsUnsplit + "] - Does not contain resource type - " + nextValue.getReference().getValue());
+ throw new InvalidRequestException("Invalid resource reference found at path[" + nextPathsUnsplit + "] - Does not contain resource type - " + nextValue.getReferenceElement().getValue());
}
RuntimeResourceDefinition resourceDefinition;
try {
resourceDefinition = getContext().getResourceDefinition(typeString);
} catch (DataFormatException e) {
- throw new InvalidRequestException("Invalid resource reference found at path[" + nextPathsUnsplit + "] - Resource type is unknown or not supported on this server - " + nextValue.getReference().getValue());
+ throw new InvalidRequestException("Invalid resource reference found at path[" + nextPathsUnsplit + "] - Resource type is unknown or not supported on this server - " + nextValue.getReferenceElement().getValue());
}
Class extends IBaseResource> type = resourceDefinition.getImplementingClass();
- String id = nextValue.getReference().getIdPart();
+ String id = nextValue.getReferenceElement().getIdPart();
if (StringUtils.isBlank(id)) {
- throw new InvalidRequestException("Invalid resource reference found at path[" + nextPathsUnsplit + "] - Does not contain resource ID - " + nextValue.getReference().getValue());
+ throw new InvalidRequestException("Invalid resource reference found at path[" + nextPathsUnsplit + "] - Does not contain resource ID - " + nextValue.getReferenceElement().getValue());
}
IFhirResourceDao> dao = getDao(type);
@@ -295,7 +301,7 @@ public abstract class BaseHapiFhirDao implements IDao {
b.append("This server (version ");
b.append(myContext.getVersion().getVersion());
b.append(") is not able to handle resources of type[");
- b.append(nextValue.getReference().getResourceType());
+ b.append(nextValue.getReferenceElement().getResourceType());
b.append("] - Valid resource types for this server: ");
b.append(myResourceTypeToDao.keySet().toString());
@@ -303,7 +309,7 @@ public abstract class BaseHapiFhirDao implements IDao {
}
Long valueOf;
try {
- valueOf = translateForcedIdToPid(nextValue.getReference());
+ valueOf = translateForcedIdToPid(nextValue.getReferenceElement());
} catch (ResourceNotFoundException e) {
String resName = getContext().getResourceDefinition(type).getName();
throw new InvalidRequestException("Resource " + resName + "/" + id + " not found, specified in path: " + nextPathsUnsplit);
@@ -316,7 +322,7 @@ public abstract class BaseHapiFhirDao implements IDao {
}
if (!typeString.equals(target.getResourceType())) {
- throw new UnprocessableEntityException("Resource contains reference to " + nextValue.getReference().getValue() + " but resource with ID " + nextValue.getReference().getIdPart() + " is actually of type " + target.getResourceType());
+ throw new UnprocessableEntityException("Resource contains reference to " + nextValue.getReferenceElement().getValue() + " but resource with ID " + nextValue.getReferenceElement().getIdPart() + " is actually of type " + target.getResourceType());
}
/*
@@ -366,35 +372,35 @@ public abstract class BaseHapiFhirDao implements IDao {
return retVal;
}
- protected Set extractSearchParamDates(ResourceTable theEntity, IResource theResource) {
+ protected Set extractSearchParamDates(ResourceTable theEntity, IBaseResource theResource) {
return mySearchParamExtractor.extractSearchParamDates(theEntity, theResource);
}
- protected Set extractSearchParamNumber(ResourceTable theEntity, IResource theResource) {
+ protected Set extractSearchParamNumber(ResourceTable theEntity, IBaseResource theResource) {
return mySearchParamExtractor.extractSearchParamNumber(theEntity, theResource);
}
- protected Set extractSearchParamUri(ResourceTable theEntity, IResource theResource) {
+ protected Set extractSearchParamUri(ResourceTable theEntity, IBaseResource theResource) {
return mySearchParamExtractor.extractSearchParamUri(theEntity, theResource);
}
- protected Set extractSearchParamCoords(ResourceTable theEntity, IResource theResource) {
+ protected Set extractSearchParamCoords(ResourceTable theEntity, IBaseResource theResource) {
return mySearchParamExtractor.extractSearchParamCoords(theEntity, theResource);
}
- protected Set extractSearchParamQuantity(ResourceTable theEntity, IResource theResource) {
+ protected Set extractSearchParamQuantity(ResourceTable theEntity, IBaseResource theResource) {
return mySearchParamExtractor.extractSearchParamQuantity(theEntity, theResource);
}
- protected Set extractSearchParamStrings(ResourceTable theEntity, IResource theResource) {
+ protected Set extractSearchParamStrings(ResourceTable theEntity, IBaseResource theResource) {
return mySearchParamExtractor.extractSearchParamStrings(theEntity, theResource);
}
- protected Set extractSearchParamTokens(ResourceTable theEntity, IResource theResource) {
+ protected Set extractSearchParamTokens(ResourceTable theEntity, IBaseResource theResource) {
return mySearchParamExtractor.extractSearchParamTokens(theEntity, theResource);
}
- private List