diff --git a/examples/src/main/java/example/CompleteExampleClient.java b/examples/src/main/java/example/CompleteExampleClient.java index 1208d90b984..9ac8526c13b 100644 --- a/examples/src/main/java/example/CompleteExampleClient.java +++ b/examples/src/main/java/example/CompleteExampleClient.java @@ -5,8 +5,8 @@ import java.io.IOException; import java.util.List; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.resource.Organization; import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.rest.annotation.RequiredParam; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java index cb50444416e..d77f12992c9 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDatatypeDefinition.java @@ -84,7 +84,7 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { myElementDefinition = theClassToElementDefinitions.get(getDatatype()); assert myElementDefinition != null : "Unknown type: " + getDatatype(); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDefinition.java index c65076bb497..c228e23e100 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeChildDefinition.java @@ -45,7 +45,7 @@ public abstract class BaseRuntimeChildDefinition { public abstract Set getValidChildNames(); - abstract void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions); + abstract void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions); public interface IAccessor { List getValues(Object theTarget); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementCompositeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementCompositeDefinition.java index 16fbdfe571f..68ed38095bb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementCompositeDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/BaseRuntimeElementCompositeDefinition.java @@ -76,11 +76,11 @@ public abstract class BaseRuntimeElementCompositeDefinition ext } @Override - public void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { - super.sealAndInitialize(theClassToElementDefinitions); + public void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + super.sealAndInitialize(theContext, theClassToElementDefinitions); for (BaseRuntimeChildDefinition next : myChildren) { - next.sealAndInitialize(theClassToElementDefinitions); + next.sealAndInitialize(theContext, theClassToElementDefinitions); } myNameToChild = new HashMap(); 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 6b524e5d14f..7d60fca0199 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 @@ -128,10 +128,11 @@ public abstract class BaseRuntimeElementDefinition { /** * Invoked prior to use to perform any initialization and make object * mutable + * @param theContext TODO */ - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { for (BaseRuntimeChildDefinition next : myExtensions) { - next.sealAndInitialize(theClassToElementDefinitions); + next.sealAndInitialize(theContext, theClassToElementDefinitions); } for (RuntimeChildDeclaredExtensionDefinition next : myExtensions) { 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 bbeb548f86d..8e5cf80464b 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 @@ -37,7 +37,6 @@ import ca.uhn.fhir.i18n.HapiLocalizer; import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IFhirVersion; import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.dstu.resource.Binary; import ca.uhn.fhir.model.view.ViewGenerator; import ca.uhn.fhir.narrative.INarrativeGenerator; import ca.uhn.fhir.parser.DataFormatException; @@ -222,12 +221,13 @@ public class FhirContext { try { String className = myNameToResourceType.get(resourceName.toLowerCase()); if (className == null) { - if ("binary".equals(resourceName.toLowerCase())) { - // Binary is not generated so it's not in the list of potential resources - className = Binary.class.getName(); - } else { + // Binary is added to the fhirversion.properties file now so it's not a special case here +// if ("binary".equals(resourceName.toLowerCase())) { +// // Binary is not generated so it's not in the list of potential resources +// className = Binary.class.getName(); +// } else { throw new DataFormatException("Unknown resource name[" + resourceName + "]"); - } +// } } Class clazz = Class.forName(className); if (IResource.class.isAssignableFrom(clazz)) { 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 071f3f52dfb..ebdcd726ed1 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 @@ -20,7 +20,7 @@ package ca.uhn.fhir.context; * #L% */ -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isBlank; import java.io.IOException; import java.io.InputStream; @@ -75,9 +75,9 @@ import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.Extension; import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; +import ca.uhn.fhir.model.base.composite.BaseContainedDt; +import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; -import ca.uhn.fhir.model.dstu.composite.ContainedDt; -import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.ICodedDatatype; @@ -253,11 +253,11 @@ class ModelScanner { continue; } BaseRuntimeElementDefinition next = nextEntry.getValue(); - next.sealAndInitialize(myClassToElementDefinitions); + next.sealAndInitialize(myContext, myClassToElementDefinitions); } myRuntimeChildUndeclaredExtensionDefinition = new RuntimeChildUndeclaredExtensionDefinition(); - myRuntimeChildUndeclaredExtensionDefinition.sealAndInitialize(myClassToElementDefinitions); + myRuntimeChildUndeclaredExtensionDefinition.sealAndInitialize(myContext, myClassToElementDefinitions); long time = System.currentTimeMillis() - start; int size = myClassToElementDefinitions.size() - startSize; @@ -493,7 +493,7 @@ class ModelScanner { Class nextElementType = determineElementType(next); - if (nextElementType.equals(ContainedDt.class) || (childAnnotation.name().equals("contained") && DomainResource.class.isAssignableFrom(theClass))) { + if (BaseContainedDt.class.isAssignableFrom(nextElementType) || (childAnnotation.name().equals("contained") && DomainResource.class.isAssignableFrom(theClass))) { /* * Child is contained resources */ @@ -575,7 +575,7 @@ class ModelScanner { if (IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) { IValueSetEnumBinder> binder = getBoundCodeBinder(next); def = new RuntimeChildCompositeBoundDatatypeDefinition(next, elementName, childAnnotation, descriptionAnnotation, nextDatatype, binder); - } else if (NarrativeDt.class.getSimpleName().equals(nextElementType.getSimpleName()) || Narrative.class.getName().equals(nextElementType.getClass().getName())) { + } else if (BaseNarrativeDt.class.isAssignableFrom(nextElementType) || Narrative.class.getName().equals(nextElementType.getClass().getName())) { def = new RuntimeChildNarrativeDefinition(next, elementName, childAnnotation, descriptionAnnotation, nextDatatype); } else { def = new RuntimeChildCompositeDatatypeDefinition(next, elementName, childAnnotation, descriptionAnnotation, nextDatatype); @@ -644,7 +644,7 @@ class ModelScanner { return retVal; } - private String scanPrimitiveDatatype(Class theClass, DatatypeDef theDatatypeDefinition) { + private String scanPrimitiveDatatype(Class> theClass, DatatypeDef theDatatypeDefinition) { ourLog.debug("Scanning resource class: {}", theClass.getName()); String resourceName = theDatatypeDefinition.name(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildAny.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildAny.java index af1caac0ac2..8985bf27f8e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildAny.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildAny.java @@ -42,7 +42,7 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition { } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { List> choiceTypes = new ArrayList>(); for (Class next : theClassToElementDefinitions.keySet()) { @@ -83,7 +83,7 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition { setChoiceTypes(choiceTypes); - super.sealAndInitialize(theClassToElementDefinitions); + super.sealAndInitialize(theContext, theClassToElementDefinitions); } 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 bdadc648e7b..61107c57251 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 @@ -32,9 +32,9 @@ import org.apache.commons.lang3.StringUtils; import org.hl7.fhir.instance.model.IBase; import org.hl7.fhir.instance.model.IBaseResource; +import ca.uhn.fhir.model.api.IDatatype; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefinition { @@ -78,7 +78,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini @SuppressWarnings("unchecked") @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { myNameToChildDefinition = new HashMap>(); myDatatypeToElementName = new HashMap, String>(); myDatatypeToElementDefinition = new HashMap, BaseRuntimeElementDefinition>(); @@ -94,7 +94,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini List> types = new ArrayList>(); types.add((Class) next); nextDef = new RuntimeResourceReferenceDefinition(elementName, types); - nextDef.sealAndInitialize(theClassToElementDefinitions); + nextDef.sealAndInitialize(theContext, theClassToElementDefinitions); } else { nextDef = theClassToElementDefinitions.get(next); elementName = getElementName() + StringUtils.capitalize(nextDef.getName()); @@ -106,9 +106,10 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini } if (IBaseResource.class.isAssignableFrom(next)) { - myDatatypeToElementDefinition.put(ResourceReferenceDt.class, nextDef); + Class refType = theContext.getVersion().getResourceReferenceType(); + myDatatypeToElementDefinition.put(refType, nextDef); alternateElementName = getElementName() + "Resource"; - myDatatypeToElementName.put(ResourceReferenceDt.class, alternateElementName); + myDatatypeToElementName.put(refType, alternateElementName); } myDatatypeToElementDefinition.put(next, nextDef); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java index de3347f704c..2abaaa9919c 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildContainedResources.java @@ -29,7 +29,7 @@ import org.hl7.fhir.instance.model.IBase; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.model.dstu.composite.ContainedDt; +import ca.uhn.fhir.model.base.composite.BaseContainedDt; public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefinition { @@ -47,13 +47,13 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi @Override public BaseRuntimeElementDefinition getChildElementDefinitionByDatatype(Class theType) { - assert theType.equals(ContainedDt.class); + assert BaseContainedDt.class.isAssignableFrom(theType); return myElem; } @Override public String getChildNameByDatatype(Class theDatatype) { - assert theDatatype.equals(ContainedDt.class); + assert BaseContainedDt.class.isAssignableFrom(theDatatype); return getElementName(); } @@ -63,8 +63,8 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { - myElem = new RuntimeElemContainedResources(); + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + myElem = new RuntimeElemContainedResources(theContext.getVersion().getContainedType()); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java index fafe3d4a587..ea6c24b089f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildDeclaredExtensionDefinition.java @@ -132,7 +132,7 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { myUrlToChildExtension = new HashMap(); BaseRuntimeElementDefinition elementDef = theClassToElementDefinitions.get(myChildType); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceBlockDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceBlockDefinition.java index 3c26f8918a5..c6d89faa3fe 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceBlockDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceBlockDefinition.java @@ -71,7 +71,7 @@ public class RuntimeChildResourceBlockDefinition extends BaseRuntimeDeclaredChil } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { myElementDef = (RuntimeResourceBlockDefinition) theClassToElementDefinitions.get(myResourceBlockType); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceDefinition.java index eb2ba768d35..6bb3728c2ca 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeChildResourceDefinition.java @@ -78,9 +78,9 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { myRuntimeDef = new RuntimeResourceReferenceDefinition(getElementName(), myResourceTypes); - myRuntimeDef.sealAndInitialize(theClassToElementDefinitions); + myRuntimeDef.sealAndInitialize(theContext, theClassToElementDefinitions); myValidChildNames = new HashSet(); myValidChildNames.add(getElementName()); 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 3335236878f..8c009a0f6d5 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 @@ -35,7 +35,6 @@ import org.hl7.fhir.instance.model.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.dstu.composite.ResourceReferenceDt; public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildDefinition { @@ -112,7 +111,7 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { Map> datatypeAttributeNameToDefinition = new HashMap>(); myDatatypeToAttributeName = new HashMap, String>(); @@ -142,14 +141,14 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD } // Resource Reference - myDatatypeToAttributeName.put(ResourceReferenceDt.class, "valueResource"); + myDatatypeToAttributeName.put(theContext.getVersion().getResourceReferenceType(), "valueResource"); List> types = new ArrayList>(); types.add(IBaseResource.class); RuntimeResourceReferenceDefinition def = new RuntimeResourceReferenceDefinition("valueResource", types); - def.sealAndInitialize(theClassToElementDefinitions); + def.sealAndInitialize(theContext, theClassToElementDefinitions); myAttributeNameToDefinition.put("valueResource", def); myDatatypeToDefinition.put(BaseResourceReferenceDt.class, def); - myDatatypeToDefinition.put(ResourceReferenceDt.class, def); + myDatatypeToDefinition.put(theContext.getVersion().getResourceReferenceType(), def); } public static String createExtensionChildName(BaseRuntimeElementDefinition next) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResources.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResources.java index ce43941f138..267d72f5072 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResources.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeElemContainedResources.java @@ -20,12 +20,12 @@ package ca.uhn.fhir.context; * #L% */ -import ca.uhn.fhir.model.dstu.composite.ContainedDt; +import ca.uhn.fhir.model.api.IDatatype; -public class RuntimeElemContainedResources extends BaseRuntimeElementDefinition { +public class RuntimeElemContainedResources extends BaseRuntimeElementDefinition { - public RuntimeElemContainedResources() { - super("contained", ContainedDt.class); + public RuntimeElemContainedResources(Class theClass) { + super("contained", theClass); } @Override diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeExtensionDtDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeExtensionDtDefinition.java index 3d19d80a0c7..696b5c30ae3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeExtensionDtDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeExtensionDtDefinition.java @@ -44,8 +44,8 @@ public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefini } @Override - public void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { - super.sealAndInitialize(theClassToElementDefinitions); + public void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + super.sealAndInitialize(theContext, theClassToElementDefinitions); /* * The "url" child is a weird child because it is not parsed and encoded in the normal way, 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 b95bc5ee8fe..9f4b7959713 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 @@ -51,7 +51,7 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { // nothing } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeNarrativeDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeNarrativeDefinition.java index 42a5768e67d..2b1f9f57bab 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeNarrativeDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimePrimitiveDatatypeNarrativeDefinition.java @@ -38,7 +38,7 @@ public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeEle } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { // nothing } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java index 455c147d1b6..ace36d4ddc4 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java @@ -127,8 +127,8 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini } @Override - public void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { - super.sealAndInitialize(theClassToElementDefinitions); + public void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + super.sealAndInitialize(theContext, theClassToElementDefinitions); myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceReferenceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceReferenceDefinition.java index d87763339dd..81008db767a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceReferenceDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceReferenceDefinition.java @@ -49,7 +49,7 @@ public class RuntimeResourceReferenceDefinition extends BaseRuntimeElementDefini } @Override - void sealAndInitialize(Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { + void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { myResourceTypeToDefinition = new HashMap, RuntimeResourceDefinition>(); for (Class next : myResourceTypes) { if (next.equals(IResource.class) || next.equals(Resource.class) || next.equals(IBaseResource.class)) { 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 08fc391479a..77843c21384 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 @@ -44,4 +44,8 @@ public interface IFhirVersion { String getPathToSchemaDefinitions(); + Class getResourceReferenceType(); + + Class getContainedType(); + } 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 85249ee5f3c..291cbd0b9da 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 @@ -21,9 +21,9 @@ package ca.uhn.fhir.model.api; */ import ca.uhn.fhir.model.api.annotation.ResourceDef; +import ca.uhn.fhir.model.base.composite.BaseContainedDt; +import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; import ca.uhn.fhir.model.base.resource.ResourceMetadataMap; -import ca.uhn.fhir.model.dstu.composite.ContainedDt; -import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.IdDt; @@ -54,7 +54,7 @@ public interface IResource extends ICompositeElement, org.hl7.fhir.instance.mode *

* TODO: document contained resources and link there */ - ContainedDt getContained(); + BaseContainedDt getContained(); /** * Returns the ID of this resource. Note that this identifier is the URL (or a portion @@ -92,7 +92,7 @@ public interface IResource extends ICompositeElement, org.hl7.fhir.instance.mode /** * Returns the narrative block for this resource */ - NarrativeDt getText(); + BaseNarrativeDt getText(); /** * Sets the ID of this resource. Note that this identifier is the URL (or a portion diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseContainedDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseContainedDt.java index eba86d2824e..438b1952812 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseContainedDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseContainedDt.java @@ -1,5 +1,7 @@ package ca.uhn.fhir.model.base.composite; +import ca.uhn.fhir.model.api.IDatatype; + /* * #%L * HAPI FHIR - Core Library @@ -20,6 +22,6 @@ package ca.uhn.fhir.model.base.composite; * #L% */ -public class BaseContainedDt { +public abstract class BaseContainedDt implements IDatatype { } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseNarrativeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseNarrativeDt.java new file mode 100644 index 00000000000..8e2e5af6d35 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/composite/BaseNarrativeDt.java @@ -0,0 +1,29 @@ +package ca.uhn.fhir.model.base.composite; + +import ca.uhn.fhir.model.api.BaseIdentifiableElement; +import ca.uhn.fhir.model.api.ICompositeDatatype; +import ca.uhn.fhir.model.api.IDatatype; + +/* + * #%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% + */ + +public abstract class BaseNarrativeDt extends BaseIdentifiableElement implements ICompositeDatatype { + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseBinary.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseBinary.java new file mode 100644 index 00000000000..24b4b8e0405 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseBinary.java @@ -0,0 +1,12 @@ +package ca.uhn.fhir.model.base.resource; + +import ca.uhn.fhir.model.api.BaseResource; +import ca.uhn.fhir.model.api.IResource; + +public abstract class BaseBinary extends BaseResource implements IResource { + + public abstract byte[] getContent(); + + public abstract String getContentType(); + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java index fc3d1eef5dc..1b3c0de5393 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseHttpClientInvocationWithContents.java @@ -40,7 +40,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.dstu.resource.Binary; +import ca.uhn.fhir.model.base.resource.BaseBinary; import ca.uhn.fhir.model.valueset.BundleTypeEnum; import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.parser.IParser; @@ -162,8 +162,8 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca appendExtraParamsWithQuestionMark(theExtraParams, b, b.indexOf("?") == -1); String url = b.toString(); - if (myResource != null && Binary.class.isAssignableFrom(myResource.getClass())) { - Binary binary = (Binary) myResource; + if (myResource != null && BaseBinary.class.isAssignableFrom(myResource.getClass())) { + BaseBinary binary = (BaseBinary) myResource; ByteArrayEntity entity = new ByteArrayEntity(binary.getContent(), ContentType.parse(binary.getContentType())); HttpRequestBase retVal = createRequest(url, entity); return retVal; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java index 9e895c52b45..ad0801b31d3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseFhirDao.java @@ -82,8 +82,8 @@ import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.parser.DataFormatException; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDao.java index 0867bbe42eb..2f31f2f4c5b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDao.java @@ -88,11 +88,11 @@ import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.base.composite.BaseIdentifierDt; import ca.uhn.fhir.model.base.composite.BaseQuantityDt; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.resource.OperationOutcome; import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum; import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDao.java index 45eb430740d..909a483b4a6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDao.java @@ -54,9 +54,9 @@ import ca.uhn.fhir.model.api.IQueryParameterAnd; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.resource.OperationOutcome; import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.valueset.BundleEntryTransactionOperationEnum; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoTest.java index cb3f267ee86..b0017177264 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoTest.java @@ -34,12 +34,12 @@ import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; import ca.uhn.fhir.model.dstu2.composite.PeriodDt; import ca.uhn.fhir.model.dstu2.composite.QuantityDt; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.resource.Device; import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport; import ca.uhn.fhir.model.dstu2.resource.Encounter; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoTest.java index 877ae3cf750..ed19c594264 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoTest.java @@ -22,9 +22,9 @@ import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; import ca.uhn.fhir.model.dstu2.composite.QuantityDt; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.resource.Location; import ca.uhn.fhir.model.dstu2.resource.Observation; import ca.uhn.fhir.model.dstu2.resource.Patient; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu1Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu1Test.java index 92963319c02..fdb8bd507e5 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu1Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu1Test.java @@ -25,7 +25,6 @@ import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.dstu.composite.PeriodDt; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.resource.DiagnosticOrder; import ca.uhn.fhir.model.dstu.resource.DocumentManifest; import ca.uhn.fhir.model.dstu.resource.DocumentReference; @@ -37,6 +36,7 @@ import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.dstu.valueset.EncounterClassEnum; import ca.uhn.fhir.model.dstu.valueset.EncounterStateEnum; import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.rest.api.MethodOutcome; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java index 9f5a409bd38..60cabd33d19 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java @@ -24,9 +24,9 @@ import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; import ca.uhn.fhir.model.dstu2.composite.PeriodDt; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.resource.DiagnosticOrder; import ca.uhn.fhir.model.dstu2.resource.DocumentManifest; import ca.uhn.fhir.model.dstu2.resource.DocumentReference; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContainedDt.java b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/composite/ContainedDt.java similarity index 91% rename from hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContainedDt.java rename to hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/composite/ContainedDt.java index d203187efa1..e969d03184a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContainedDt.java +++ b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/composite/ContainedDt.java @@ -23,13 +23,13 @@ package ca.uhn.fhir.model.dstu.composite; import java.util.ArrayList; import java.util.List; -import ca.uhn.fhir.model.api.IDatatype; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.base.composite.BaseContainedDt; -@DatatypeDef(name = "duration") -public class ContainedDt implements IDatatype { +@DatatypeDef(name = "contained") +public class ContainedDt extends BaseContainedDt { @Child(name = "resource", type = IResource.class, order = 0, min = 0, max = Child.MAX_UNLIMITED) private List myContainedResources; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java similarity index 95% rename from hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java rename to hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java index 7572742254b..0d6b957c794 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java +++ b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java @@ -38,11 +38,10 @@ package ca.uhn.fhir.model.dstu.composite; import java.util.List; -import ca.uhn.fhir.model.api.BaseIdentifiableElement; -import ca.uhn.fhir.model.api.ICompositeDatatype; import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.CodeDt; @@ -63,7 +62,7 @@ import ca.uhn.fhir.model.primitive.XhtmlDt; *

*/ @DatatypeDef(name="Narrative") -public class NarrativeDt extends BaseIdentifiableElement implements ICompositeDatatype { +public class NarrativeDt extends BaseNarrativeDt { @Child(name="status", type=CodeDt.class, order=0, min=1, max=1) private BoundCodeDt myStatus; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java similarity index 100% rename from hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java rename to hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Binary.java b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/resource/Binary.java similarity index 100% rename from hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Binary.java rename to hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/resource/Binary.java diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/ContainedDt.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/ContainedDt.java new file mode 100644 index 00000000000..fd3def9868d --- /dev/null +++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/ContainedDt.java @@ -0,0 +1,54 @@ +package ca.uhn.fhir.model.dstu2.composite; + +/* + * #%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.util.ArrayList; +import java.util.List; + +import ca.uhn.fhir.model.api.IDatatype; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.base.composite.BaseContainedDt; + +@DatatypeDef(name = "contained") +public class ContainedDt extends BaseContainedDt { + + @Child(name = "resource", type = IResource.class, order = 0, min = 0, max = Child.MAX_UNLIMITED) + private List myContainedResources; + + public List getContainedResources() { + if (myContainedResources == null) { + myContainedResources = new ArrayList(); + } + return myContainedResources; + } + + public void setContainedResources(List theContainedResources) { + myContainedResources = theContainedResources; + } + + @Override + public boolean isEmpty() { + return myContainedResources == null || myContainedResources.size() == 0; + } + +} diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/NarrativeDt.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/NarrativeDt.java new file mode 100644 index 00000000000..49388639a59 --- /dev/null +++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/NarrativeDt.java @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + +package ca.uhn.fhir.model.dstu2.composite; + +/* + * #%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.util.List; + +import ca.uhn.fhir.model.api.IElement; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; +import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; +import ca.uhn.fhir.model.primitive.BoundCodeDt; +import ca.uhn.fhir.model.primitive.CodeDt; +import ca.uhn.fhir.model.primitive.XhtmlDt; + +/** + * HAPI/FHIR Narrative Datatype + * (A human-readable formatted text, including images) + * + *

+ * Definition: + * A human-readable formatted text, including images + *

+ * + *

+ * Requirements: + * + *

+ */ +@DatatypeDef(name="Narrative") +public class NarrativeDt extends BaseNarrativeDt { + + @Child(name="status", type=CodeDt.class, order=0, min=1, max=1) + private BoundCodeDt myStatus; + + @Child(name="div", type=XhtmlDt.class, order=1, min=1, max=1) + private XhtmlDt myDiv; + + public NarrativeDt() { + // nothing + } + + public NarrativeDt(XhtmlDt theDiv, NarrativeStatusEnum theStatus) { + setDiv(theDiv); + setStatus(theStatus); + } + + @Override + public boolean isEmpty() { + return ca.uhn.fhir.util.ElementUtil.isEmpty( myStatus, myDiv ); + } + + + @Override + public List getAllPopulatedChildElementsOfType(Class theType) { + return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements( theType, myStatus, myDiv ); + } + + /** + * Gets the value(s) for status (generated | extensions | additional). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data + *

+ */ + public BoundCodeDt getStatus() { + if (myStatus == null) { + myStatus = new BoundCodeDt(NarrativeStatusEnum.VALUESET_BINDER); + } + return myStatus; + } + + /** + * Sets the value(s) for status (generated | extensions | additional) + * + *

+ * Definition: + * The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data + *

+ */ + public void setStatus(BoundCodeDt theValue) { + myStatus = theValue; + } + + /** + * Sets the value(s) for status (generated | extensions | additional) + * + *

+ * Definition: + * The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data + *

+ */ + public void setStatus(NarrativeStatusEnum theValue) { + getStatus().setValueAsEnum(theValue); + } + + + /** + * Gets the value(s) for div (Limited xhtml content). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * The actual narrative content, a stripped down version of XHTML + *

+ */ + public XhtmlDt getDiv() { + if (myDiv == null) { + myDiv = new XhtmlDt(); + } + return myDiv; + } + + /** + * Sets the value(s) for div (Limited xhtml content) + * + *

+ * Definition: + * The actual narrative content, a stripped down version of XHTML + *

+ */ + public void setDiv(XhtmlDt theValue) { + myDiv = theValue; + } + + /** + * Sets the value using a textual DIV (or simple text block which will be + * converted to XHTML) + */ + public void setDiv(String theTextDiv) { + myDiv = new XhtmlDt(theTextDiv); + } + + + + +} diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/ResourceReferenceDt.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/ResourceReferenceDt.java new file mode 100644 index 00000000000..910f676ea1b --- /dev/null +++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/composite/ResourceReferenceDt.java @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + +package ca.uhn.fhir.model.dstu2.composite; + +/* + * #%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.util.List; + +import ca.uhn.fhir.model.api.ICompositeDatatype; +import ca.uhn.fhir.model.api.IElement; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; +import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; +import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.model.primitive.StringDt; + +/** + * HAPI/FHIR ResourceReferenceDt Datatype + * (A reference from one resource to another) + * + *

+ * Definition: + * A reference from one resource to another + *

+ * + *

+ * Requirements: + * + *

+ */ +@DatatypeDef(name="ResourceReferenceDt") +public class ResourceReferenceDt + extends BaseResourceReferenceDt implements ICompositeDatatype +{ + + /** + * Constructor + */ + public ResourceReferenceDt() { + // nothing + } + + /** + * Constructor which creates a resource reference containing the actual resource in question. + *

+ * When using this in a server: Generally if this is serialized, it will be serialized as a contained + * resource, so this should not be used if the intent is not to actually supply the referenced resource. This is not + * a hard-and-fast rule however, as the server can be configured to not serialized this resource, or to load an ID + * and contain even if this constructor is not used. + *

+ * + * @param theResource + * The resource instance + */ + @SimpleSetter() + public ResourceReferenceDt(IResource theResource) { + super(theResource); + } + + /** + * Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute + * URL) + * + * @param theId + * The reference itself + */ + public ResourceReferenceDt(String theId) { + setReference(new IdDt(theId)); + } + + /** + * Constructor which accepts a reference directly (this can be an ID, a partial/relative URL or a complete/absolute + * URL) + * + * @param theResourceId + * The reference itself + */ + public ResourceReferenceDt(IdDt theResourceId) { + setReference(theResourceId); + } + + @Child(name="reference", type=IdDt.class, order=0, min=0, max=1) + @Description( + shortDefinition="Relative, internal or absolute URL reference", + formalDefinition="A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources" + ) + private IdDt myReference; + + @Child(name="display", type=StringDt.class, order=1, min=0, max=1) + @Description( + shortDefinition="Text alternative for the resource", + formalDefinition="Plain text narrative that identifies the resource in addition to the resource reference" + ) + private StringDt myDisplay; + + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myReference, myDisplay); + } + + @Override + public List getAllPopulatedChildElementsOfType(Class theType) { + return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myReference, myDisplay); + } + + /** + * Gets the value(s) for reference (Relative, internal or absolute URL reference). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources + *

+ */ + public IdDt getReference() { + if (myReference == null) { + myReference = new IdDt(); + } + return myReference; + } + + /** + * Sets the value(s) for reference (Relative, internal or absolute URL reference) + * + *

+ * Definition: + * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources + *

+ */ + public ResourceReferenceDt setReference(IdDt theValue) { + myReference = theValue; + return this; + } + + /** + * Sets the value for reference (Relative, internal or absolute URL reference) + * + *

+ * Definition: + * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources + *

+ */ + public ResourceReferenceDt setReference( String theId) { + myReference = new IdDt(theId); + return this; + } + + + /** + * Gets the value(s) for display (Text alternative for the resource). + * creating it if it does + * not exist. Will not return null. + * + *

+ * Definition: + * Plain text narrative that identifies the resource in addition to the resource reference + *

+ */ + public StringDt getDisplay() { + if (myDisplay == null) { + myDisplay = new StringDt(); + } + return myDisplay; + } + + /** + * Sets the value(s) for display (Text alternative for the resource) + * + *

+ * Definition: + * Plain text narrative that identifies the resource in addition to the resource reference + *

+ */ + public ResourceReferenceDt setDisplay(StringDt theValue) { + myDisplay = theValue; + return this; + } + + /** + * Sets the value for display (Text alternative for the resource) + * + *

+ * Definition: + * Plain text narrative that identifies the resource in addition to the resource reference + *

+ */ + public ResourceReferenceDt setDisplay( String theString) { + myDisplay = new StringDt(theString); + return this; + } + + + + +} diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/resource/Binary.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/resource/Binary.java new file mode 100644 index 00000000000..2bd99b20d2d --- /dev/null +++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/resource/Binary.java @@ -0,0 +1,112 @@ +package ca.uhn.fhir.model.dstu2.resource; + +/* + * #%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.util.Collections; +import java.util.List; + +import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.model.api.BaseResource; +import ca.uhn.fhir.model.api.IElement; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.ResourceDef; +import ca.uhn.fhir.model.primitive.Base64BinaryDt; +import ca.uhn.fhir.model.primitive.StringDt; +import ca.uhn.fhir.util.ElementUtil; + +@ResourceDef(name = "Binary", profile = "http://hl7.org/fhir/profiles/Binary", id = "binary") +public class Binary extends BaseResource implements IResource { + + @Child(name = "content", order = 1) + private Base64BinaryDt myContent = new Base64BinaryDt(); + + @Child(name = "contentType", order = 0) + private StringDt myContentType; + + /** + * Constructor + */ + public Binary() { + // nothing + } + + /** + * Constructor + * + * @param theContentType + * The content type + * @param theContent + * The binary contents + */ + public Binary(String theContentType, byte[] theContent) { + setContentType(theContentType); + setContent(theContent); + } + + @Override + public List getAllPopulatedChildElementsOfType(Class theType) { + return Collections.emptyList(); + } + + public byte[] getContent() { + return myContent.getValue(); + } + + public String getContentAsBase64() { + return myContent.getValueAsString(); + } + + public String getContentType() { + if (myContentType == null) { + return null; + } + return myContentType.getValue(); + } + + @Override + public boolean isEmpty() { + return (myContent.isEmpty()) && ElementUtil.isEmpty(myContentType); + } + + public void setContent(byte[] theContent) { + myContent.setValue(theContent); + } + + public void setContentAsBase64(String theContent) { + myContent.setValueAsString(theContent); + } + + public void setContentType(String theContentType) { + myContentType = new StringDt(theContentType); + } + + @Override + public String getResourceName() { + return Binary.class.getName(); + } + + @Override + public FhirVersionEnum getStructureFhirVersionEnum() { + return FhirVersionEnum.DSTU1; + } + +} diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/CustomThymeleafNarrativeGeneratorTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/CustomThymeleafNarrativeGeneratorTest.java index b8f1d1b39b2..a3a278d88b0 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/CustomThymeleafNarrativeGeneratorTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/CustomThymeleafNarrativeGeneratorTest.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertThat; import org.junit.Test; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.dstu.composite.NarrativeDt; +import ca.uhn.fhir.model.dstu2.composite.NarrativeDt; import ca.uhn.fhir.model.dstu2.resource.Practitioner; public class CustomThymeleafNarrativeGeneratorTest { diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java index 56479b38b18..f27402ac35c 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTest.java @@ -12,11 +12,11 @@ import org.junit.Test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.TemporalPrecisionEnum; -import ca.uhn.fhir.model.dstu.composite.NarrativeDt; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; +import ca.uhn.fhir.model.dstu2.composite.NarrativeDt; import ca.uhn.fhir.model.dstu2.composite.PeriodDt; import ca.uhn.fhir.model.dstu2.composite.QuantityDt; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport; import ca.uhn.fhir.model.dstu2.resource.Encounter; import ca.uhn.fhir.model.dstu2.resource.Medication; diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java index 4030fae2d7c..87660ced776 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java @@ -20,7 +20,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; -import ca.uhn.fhir.model.dstu.resource.Binary; +import ca.uhn.fhir.model.dstu2.resource.Binary; import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription; import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers; diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java index fe7ce72810f..7c39f58a0ea 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java @@ -14,9 +14,9 @@ import org.junit.Test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; -import ca.uhn.fhir.model.dstu.resource.Binary; import ca.uhn.fhir.model.dstu2.composite.DurationDt; import ca.uhn.fhir.model.dstu2.resource.AllergyIntolerance; +import ca.uhn.fhir.model.dstu2.resource.Binary; import ca.uhn.fhir.model.dstu2.resource.Composition; import ca.uhn.fhir.model.dstu2.resource.Encounter; import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription; diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryTest.java index a1ba2c14626..e485833d684 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/BinaryTest.java @@ -28,7 +28,7 @@ import org.junit.Test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.dstu.resource.Binary; +import ca.uhn.fhir.model.dstu2.resource.Binary; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.annotation.Create; import ca.uhn.fhir.rest.annotation.IdParam; diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java index 4f2f32d1d8c..ac37009394b 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/IncludeTest.java @@ -31,7 +31,7 @@ import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Extension; import ca.uhn.fhir.model.api.annotation.ResourceDef; -import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport; import ca.uhn.fhir.model.dstu2.resource.Observation; import ca.uhn.fhir.model.dstu2.resource.Organization; diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java index e4979a0b427..515e1ce1cbc 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java @@ -506,6 +506,10 @@ public abstract class BaseStructureParser { } if (theResourceOutputDirectory != null) { + + // Binary is manually generated but should still go in the list + myNameToResourceClass.put("Binary", thePackageBase + ".resource.Binary"); + try { File versionFile = new File(theResourceOutputDirectory, "fhirversion.properties"); FileWriter w = new FileWriter(versionFile, false);