Start work on decoupling dstu1 structures
This commit is contained in:
parent
ec5f7afa5e
commit
35a2f852fe
|
@ -5,8 +5,8 @@ import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
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.IdentifierDt;
|
||||||
|
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||||
import ca.uhn.fhir.rest.annotation.RequiredParam;
|
import ca.uhn.fhir.rest.annotation.RequiredParam;
|
||||||
|
|
|
@ -84,7 +84,7 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myElementDefinition = theClassToElementDefinitions.get(getDatatype());
|
myElementDefinition = theClassToElementDefinitions.get(getDatatype());
|
||||||
assert myElementDefinition != null : "Unknown type: " + getDatatype();
|
assert myElementDefinition != null : "Unknown type: " + getDatatype();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public abstract class BaseRuntimeChildDefinition {
|
||||||
|
|
||||||
public abstract Set<String> getValidChildNames();
|
public abstract Set<String> getValidChildNames();
|
||||||
|
|
||||||
abstract void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions);
|
abstract void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions);
|
||||||
|
|
||||||
public interface IAccessor {
|
public interface IAccessor {
|
||||||
List<? extends IBase> getValues(Object theTarget);
|
List<? extends IBase> getValues(Object theTarget);
|
||||||
|
|
|
@ -76,11 +76,11 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super.sealAndInitialize(theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
for (BaseRuntimeChildDefinition next : myChildren) {
|
for (BaseRuntimeChildDefinition next : myChildren) {
|
||||||
next.sealAndInitialize(theClassToElementDefinitions);
|
next.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
myNameToChild = new HashMap<String, BaseRuntimeChildDefinition>();
|
myNameToChild = new HashMap<String, BaseRuntimeChildDefinition>();
|
||||||
|
|
|
@ -128,10 +128,11 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||||
/**
|
/**
|
||||||
* Invoked prior to use to perform any initialization and make object
|
* Invoked prior to use to perform any initialization and make object
|
||||||
* mutable
|
* mutable
|
||||||
|
* @param theContext TODO
|
||||||
*/
|
*/
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
for (BaseRuntimeChildDefinition next : myExtensions) {
|
for (BaseRuntimeChildDefinition next : myExtensions) {
|
||||||
next.sealAndInitialize(theClassToElementDefinitions);
|
next.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RuntimeChildDeclaredExtensionDefinition next : myExtensions) {
|
for (RuntimeChildDeclaredExtensionDefinition next : myExtensions) {
|
||||||
|
|
|
@ -37,7 +37,6 @@ import ca.uhn.fhir.i18n.HapiLocalizer;
|
||||||
import ca.uhn.fhir.model.api.IElement;
|
import ca.uhn.fhir.model.api.IElement;
|
||||||
import ca.uhn.fhir.model.api.IFhirVersion;
|
import ca.uhn.fhir.model.api.IFhirVersion;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
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.model.view.ViewGenerator;
|
||||||
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
@ -222,12 +221,13 @@ public class FhirContext {
|
||||||
try {
|
try {
|
||||||
String className = myNameToResourceType.get(resourceName.toLowerCase());
|
String className = myNameToResourceType.get(resourceName.toLowerCase());
|
||||||
if (className == null) {
|
if (className == null) {
|
||||||
if ("binary".equals(resourceName.toLowerCase())) {
|
// Binary is added to the fhirversion.properties file now so it's not a special case here
|
||||||
// Binary is not generated so it's not in the list of potential resources
|
// if ("binary".equals(resourceName.toLowerCase())) {
|
||||||
className = Binary.class.getName();
|
// // Binary is not generated so it's not in the list of potential resources
|
||||||
} else {
|
// className = Binary.class.getName();
|
||||||
|
// } else {
|
||||||
throw new DataFormatException("Unknown resource name[" + resourceName + "]");
|
throw new DataFormatException("Unknown resource name[" + resourceName + "]");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
Class<?> clazz = Class.forName(className);
|
Class<?> clazz = Class.forName(className);
|
||||||
if (IResource.class.isAssignableFrom(clazz)) {
|
if (IResource.class.isAssignableFrom(clazz)) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.context;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.*;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
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.Extension;
|
||||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||||
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
|
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.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.dstu.valueset.SearchParamTypeEnum;
|
||||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||||
import ca.uhn.fhir.model.primitive.ICodedDatatype;
|
import ca.uhn.fhir.model.primitive.ICodedDatatype;
|
||||||
|
@ -253,11 +253,11 @@ class ModelScanner {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BaseRuntimeElementDefinition<?> next = nextEntry.getValue();
|
BaseRuntimeElementDefinition<?> next = nextEntry.getValue();
|
||||||
next.sealAndInitialize(myClassToElementDefinitions);
|
next.sealAndInitialize(myContext, myClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
myRuntimeChildUndeclaredExtensionDefinition = new RuntimeChildUndeclaredExtensionDefinition();
|
myRuntimeChildUndeclaredExtensionDefinition = new RuntimeChildUndeclaredExtensionDefinition();
|
||||||
myRuntimeChildUndeclaredExtensionDefinition.sealAndInitialize(myClassToElementDefinitions);
|
myRuntimeChildUndeclaredExtensionDefinition.sealAndInitialize(myContext, myClassToElementDefinitions);
|
||||||
|
|
||||||
long time = System.currentTimeMillis() - start;
|
long time = System.currentTimeMillis() - start;
|
||||||
int size = myClassToElementDefinitions.size() - startSize;
|
int size = myClassToElementDefinitions.size() - startSize;
|
||||||
|
@ -493,7 +493,7 @@ class ModelScanner {
|
||||||
|
|
||||||
Class<?> nextElementType = determineElementType(next);
|
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
|
* Child is contained resources
|
||||||
*/
|
*/
|
||||||
|
@ -575,7 +575,7 @@ class ModelScanner {
|
||||||
if (IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) {
|
if (IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) {
|
||||||
IValueSetEnumBinder<Enum<?>> binder = getBoundCodeBinder(next);
|
IValueSetEnumBinder<Enum<?>> binder = getBoundCodeBinder(next);
|
||||||
def = new RuntimeChildCompositeBoundDatatypeDefinition(next, elementName, childAnnotation, descriptionAnnotation, nextDatatype, binder);
|
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);
|
def = new RuntimeChildNarrativeDefinition(next, elementName, childAnnotation, descriptionAnnotation, nextDatatype);
|
||||||
} else {
|
} else {
|
||||||
def = new RuntimeChildCompositeDatatypeDefinition(next, elementName, childAnnotation, descriptionAnnotation, nextDatatype);
|
def = new RuntimeChildCompositeDatatypeDefinition(next, elementName, childAnnotation, descriptionAnnotation, nextDatatype);
|
||||||
|
@ -644,7 +644,7 @@ class ModelScanner {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String scanPrimitiveDatatype(Class<? extends IPrimitiveType> theClass, DatatypeDef theDatatypeDefinition) {
|
private String scanPrimitiveDatatype(Class<? extends IPrimitiveType<?>> theClass, DatatypeDef theDatatypeDefinition) {
|
||||||
ourLog.debug("Scanning resource class: {}", theClass.getName());
|
ourLog.debug("Scanning resource class: {}", theClass.getName());
|
||||||
|
|
||||||
String resourceName = theDatatypeDefinition.name();
|
String resourceName = theDatatypeDefinition.name();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
List<Class<? extends IBase>> choiceTypes = new ArrayList<Class<? extends IBase>>();
|
List<Class<? extends IBase>> choiceTypes = new ArrayList<Class<? extends IBase>>();
|
||||||
|
|
||||||
for (Class<? extends IBase> next : theClassToElementDefinitions.keySet()) {
|
for (Class<? extends IBase> next : theClassToElementDefinitions.keySet()) {
|
||||||
|
@ -83,7 +83,7 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
|
||||||
|
|
||||||
setChoiceTypes(choiceTypes);
|
setChoiceTypes(choiceTypes);
|
||||||
|
|
||||||
super.sealAndInitialize(theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,9 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.instance.model.IBase;
|
import org.hl7.fhir.instance.model.IBase;
|
||||||
import org.hl7.fhir.instance.model.IBaseResource;
|
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.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
|
||||||
|
|
||||||
public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefinition {
|
public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefinition {
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myNameToChildDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>();
|
myNameToChildDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>();
|
||||||
myDatatypeToElementName = new HashMap<Class<? extends IBase>, String>();
|
myDatatypeToElementName = new HashMap<Class<? extends IBase>, String>();
|
||||||
myDatatypeToElementDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>();
|
myDatatypeToElementDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>();
|
||||||
|
@ -94,7 +94,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
||||||
types.add((Class<? extends IBaseResource>) next);
|
types.add((Class<? extends IBaseResource>) next);
|
||||||
nextDef = new RuntimeResourceReferenceDefinition(elementName, types);
|
nextDef = new RuntimeResourceReferenceDefinition(elementName, types);
|
||||||
nextDef.sealAndInitialize(theClassToElementDefinitions);
|
nextDef.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
} else {
|
} else {
|
||||||
nextDef = theClassToElementDefinitions.get(next);
|
nextDef = theClassToElementDefinitions.get(next);
|
||||||
elementName = getElementName() + StringUtils.capitalize(nextDef.getName());
|
elementName = getElementName() + StringUtils.capitalize(nextDef.getName());
|
||||||
|
@ -106,9 +106,10 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IBaseResource.class.isAssignableFrom(next)) {
|
if (IBaseResource.class.isAssignableFrom(next)) {
|
||||||
myDatatypeToElementDefinition.put(ResourceReferenceDt.class, nextDef);
|
Class<? extends IDatatype> refType = theContext.getVersion().getResourceReferenceType();
|
||||||
|
myDatatypeToElementDefinition.put(refType, nextDef);
|
||||||
alternateElementName = getElementName() + "Resource";
|
alternateElementName = getElementName() + "Resource";
|
||||||
myDatatypeToElementName.put(ResourceReferenceDt.class, alternateElementName);
|
myDatatypeToElementName.put(refType, alternateElementName);
|
||||||
}
|
}
|
||||||
|
|
||||||
myDatatypeToElementDefinition.put(next, nextDef);
|
myDatatypeToElementDefinition.put(next, nextDef);
|
||||||
|
|
|
@ -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.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
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 {
|
public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefinition {
|
||||||
|
|
||||||
|
@ -47,13 +47,13 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theType) {
|
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theType) {
|
||||||
assert theType.equals(ContainedDt.class);
|
assert BaseContainedDt.class.isAssignableFrom(theType);
|
||||||
return myElem;
|
return myElem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getChildNameByDatatype(Class<? extends IBase> theDatatype) {
|
public String getChildNameByDatatype(Class<? extends IBase> theDatatype) {
|
||||||
assert theDatatype.equals(ContainedDt.class);
|
assert BaseContainedDt.class.isAssignableFrom(theDatatype);
|
||||||
return getElementName();
|
return getElementName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myElem = new RuntimeElemContainedResources();
|
myElem = new RuntimeElemContainedResources(theContext.getVersion().getContainedType());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myUrlToChildExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>();
|
myUrlToChildExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>();
|
||||||
|
|
||||||
BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(myChildType);
|
BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(myChildType);
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class RuntimeChildResourceBlockDefinition extends BaseRuntimeDeclaredChil
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myElementDef = (RuntimeResourceBlockDefinition) theClassToElementDefinitions.get(myResourceBlockType);
|
myElementDef = (RuntimeResourceBlockDefinition) theClassToElementDefinitions.get(myResourceBlockType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,9 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myRuntimeDef = new RuntimeResourceReferenceDefinition(getElementName(), myResourceTypes);
|
myRuntimeDef = new RuntimeResourceReferenceDefinition(getElementName(), myResourceTypes);
|
||||||
myRuntimeDef.sealAndInitialize(theClassToElementDefinitions);
|
myRuntimeDef.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
myValidChildNames = new HashSet<String>();
|
myValidChildNames = new HashSet<String>();
|
||||||
myValidChildNames.add(getElementName());
|
myValidChildNames.add(getElementName());
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.hl7.fhir.instance.model.IBaseResource;
|
||||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||||
import ca.uhn.fhir.model.api.IDatatype;
|
import ca.uhn.fhir.model.api.IDatatype;
|
||||||
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
||||||
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
|
||||||
|
|
||||||
public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildDefinition {
|
public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildDefinition {
|
||||||
|
|
||||||
|
@ -112,7 +111,7 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>();
|
Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>();
|
||||||
myDatatypeToAttributeName = new HashMap<Class<? extends IBase>, String>();
|
myDatatypeToAttributeName = new HashMap<Class<? extends IBase>, String>();
|
||||||
|
|
||||||
|
@ -142,14 +141,14 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resource Reference
|
// Resource Reference
|
||||||
myDatatypeToAttributeName.put(ResourceReferenceDt.class, "valueResource");
|
myDatatypeToAttributeName.put(theContext.getVersion().getResourceReferenceType(), "valueResource");
|
||||||
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
||||||
types.add(IBaseResource.class);
|
types.add(IBaseResource.class);
|
||||||
RuntimeResourceReferenceDefinition def = new RuntimeResourceReferenceDefinition("valueResource", types);
|
RuntimeResourceReferenceDefinition def = new RuntimeResourceReferenceDefinition("valueResource", types);
|
||||||
def.sealAndInitialize(theClassToElementDefinitions);
|
def.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
myAttributeNameToDefinition.put("valueResource", def);
|
myAttributeNameToDefinition.put("valueResource", def);
|
||||||
myDatatypeToDefinition.put(BaseResourceReferenceDt.class, def);
|
myDatatypeToDefinition.put(BaseResourceReferenceDt.class, def);
|
||||||
myDatatypeToDefinition.put(ResourceReferenceDt.class, def);
|
myDatatypeToDefinition.put(theContext.getVersion().getResourceReferenceType(), def);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createExtensionChildName(BaseRuntimeElementDefinition<?> next) {
|
public static String createExtensionChildName(BaseRuntimeElementDefinition<?> next) {
|
||||||
|
|
|
@ -20,12 +20,12 @@ package ca.uhn.fhir.context;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.model.dstu.composite.ContainedDt;
|
import ca.uhn.fhir.model.api.IDatatype;
|
||||||
|
|
||||||
public class RuntimeElemContainedResources extends BaseRuntimeElementDefinition<ContainedDt> {
|
public class RuntimeElemContainedResources extends BaseRuntimeElementDefinition<IDatatype> {
|
||||||
|
|
||||||
public RuntimeElemContainedResources() {
|
public RuntimeElemContainedResources(Class<? extends IDatatype> theClass) {
|
||||||
super("contained", ContainedDt.class);
|
super("contained", theClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -44,8 +44,8 @@ public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefini
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super.sealAndInitialize(theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The "url" child is a weird child because it is not parsed and encoded in the normal way,
|
* The "url" child is a weird child because it is not parsed and encoded in the normal way,
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeEle
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
public void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
super.sealAndInitialize(theClassToElementDefinitions);
|
super.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||||
|
|
||||||
myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam);
|
myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class RuntimeResourceReferenceDefinition extends BaseRuntimeElementDefini
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void sealAndInitialize(Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||||
myResourceTypeToDefinition = new HashMap<Class<? extends IBaseResource>, RuntimeResourceDefinition>();
|
myResourceTypeToDefinition = new HashMap<Class<? extends IBaseResource>, RuntimeResourceDefinition>();
|
||||||
for (Class<? extends IBaseResource> next : myResourceTypes) {
|
for (Class<? extends IBaseResource> next : myResourceTypes) {
|
||||||
if (next.equals(IResource.class) || next.equals(Resource.class) || next.equals(IBaseResource.class)) {
|
if (next.equals(IResource.class) || next.equals(Resource.class) || next.equals(IBaseResource.class)) {
|
||||||
|
|
|
@ -44,4 +44,8 @@ public interface IFhirVersion {
|
||||||
|
|
||||||
String getPathToSchemaDefinitions();
|
String getPathToSchemaDefinitions();
|
||||||
|
|
||||||
|
Class<? extends IDatatype> getResourceReferenceType();
|
||||||
|
|
||||||
|
Class<? extends IDatatype> getContainedType();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ package ca.uhn.fhir.model.api;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
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.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.CodeDt;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public interface IResource extends ICompositeElement, org.hl7.fhir.instance.mode
|
||||||
* </p>
|
* </p>
|
||||||
* TODO: document contained resources and link there
|
* 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
|
* 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
|
* 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
|
* Sets the ID of this resource. Note that this identifier is the URL (or a portion
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ca.uhn.fhir.model.base.composite;
|
package ca.uhn.fhir.model.base.composite;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.IDatatype;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* HAPI FHIR - Core Library
|
* HAPI FHIR - Core Library
|
||||||
|
@ -20,6 +22,6 @@ package ca.uhn.fhir.model.base.composite;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class BaseContainedDt {
|
public abstract class BaseContainedDt implements IDatatype {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
|
@ -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();
|
||||||
|
|
||||||
|
}
|
|
@ -40,7 +40,7 @@ import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
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.model.valueset.BundleTypeEnum;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
import ca.uhn.fhir.parser.IParser;
|
import ca.uhn.fhir.parser.IParser;
|
||||||
|
@ -162,8 +162,8 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
|
||||||
appendExtraParamsWithQuestionMark(theExtraParams, b, b.indexOf("?") == -1);
|
appendExtraParamsWithQuestionMark(theExtraParams, b, b.indexOf("?") == -1);
|
||||||
String url = b.toString();
|
String url = b.toString();
|
||||||
|
|
||||||
if (myResource != null && Binary.class.isAssignableFrom(myResource.getClass())) {
|
if (myResource != null && BaseBinary.class.isAssignableFrom(myResource.getClass())) {
|
||||||
Binary binary = (Binary) myResource;
|
BaseBinary binary = (BaseBinary) myResource;
|
||||||
ByteArrayEntity entity = new ByteArrayEntity(binary.getContent(), ContentType.parse(binary.getContentType()));
|
ByteArrayEntity entity = new ByteArrayEntity(binary.getContent(), ContentType.parse(binary.getContentType()));
|
||||||
HttpRequestBase retVal = createRequest(url, entity);
|
HttpRequestBase retVal = createRequest(url, entity);
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
|
@ -82,8 +82,8 @@ import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||||
import ca.uhn.fhir.model.api.Tag;
|
import ca.uhn.fhir.model.api.Tag;
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
import ca.uhn.fhir.model.api.TagList;
|
||||||
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
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.dstu.valueset.SearchParamTypeEnum;
|
||||||
|
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
|
|
@ -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.BaseCodingDt;
|
||||||
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
|
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
|
||||||
import ca.uhn.fhir.model.base.composite.BaseQuantityDt;
|
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.resource.OperationOutcome;
|
||||||
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
||||||
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
|
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
|
||||||
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
|
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.IdDt;
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||||
|
|
|
@ -54,9 +54,9 @@ import ca.uhn.fhir.model.api.IQueryParameterAnd;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
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.resource.OperationOutcome;
|
||||||
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
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.IdDt;
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
import ca.uhn.fhir.model.valueset.BundleEntryTransactionOperationEnum;
|
import ca.uhn.fhir.model.valueset.BundleEntryTransactionOperationEnum;
|
||||||
|
|
|
@ -34,12 +34,12 @@ import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.Include;
|
import ca.uhn.fhir.model.api.Include;
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
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.dstu.valueset.QuantityCompararatorEnum;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
|
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
|
import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
|
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
|
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.Device;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport;
|
import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Encounter;
|
import ca.uhn.fhir.model.dstu2.resource.Encounter;
|
||||||
|
|
|
@ -22,9 +22,9 @@ import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
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.IdentifierDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
|
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.Location;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||||
import ca.uhn.fhir.model.dstu.composite.PeriodDt;
|
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.DiagnosticOrder;
|
||||||
import ca.uhn.fhir.model.dstu.resource.DocumentManifest;
|
import ca.uhn.fhir.model.dstu.resource.DocumentManifest;
|
||||||
import ca.uhn.fhir.model.dstu.resource.DocumentReference;
|
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.EncounterClassEnum;
|
||||||
import ca.uhn.fhir.model.dstu.valueset.EncounterStateEnum;
|
import ca.uhn.fhir.model.dstu.valueset.EncounterStateEnum;
|
||||||
import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum;
|
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.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||||
|
|
|
@ -24,9 +24,9 @@ import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
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.dstu.valueset.NarrativeStatusEnum;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
|
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.DiagnosticOrder;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.DocumentManifest;
|
import ca.uhn.fhir.model.dstu2.resource.DocumentManifest;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.DocumentReference;
|
import ca.uhn.fhir.model.dstu2.resource.DocumentReference;
|
||||||
|
|
|
@ -23,13 +23,13 @@ package ca.uhn.fhir.model.dstu.composite;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.IDatatype;
|
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||||
|
import ca.uhn.fhir.model.base.composite.BaseContainedDt;
|
||||||
|
|
||||||
@DatatypeDef(name = "duration")
|
@DatatypeDef(name = "contained")
|
||||||
public class ContainedDt implements IDatatype {
|
public class ContainedDt extends BaseContainedDt {
|
||||||
|
|
||||||
@Child(name = "resource", type = IResource.class, order = 0, min = 0, max = Child.MAX_UNLIMITED)
|
@Child(name = "resource", type = IResource.class, order = 0, min = 0, max = Child.MAX_UNLIMITED)
|
||||||
private List<IResource> myContainedResources;
|
private List<IResource> myContainedResources;
|
|
@ -38,11 +38,10 @@ package ca.uhn.fhir.model.dstu.composite;
|
||||||
|
|
||||||
import java.util.List;
|
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.IElement;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
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.dstu.valueset.NarrativeStatusEnum;
|
||||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||||
|
@ -63,7 +62,7 @@ import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@DatatypeDef(name="Narrative")
|
@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)
|
@Child(name="status", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
private BoundCodeDt<NarrativeStatusEnum> myStatus;
|
private BoundCodeDt<NarrativeStatusEnum> myStatus;
|
|
@ -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<IResource> myContainedResources;
|
||||||
|
|
||||||
|
public List<IResource> getContainedResources() {
|
||||||
|
if (myContainedResources == null) {
|
||||||
|
myContainedResources = new ArrayList<IResource>();
|
||||||
|
}
|
||||||
|
return myContainedResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContainedResources(List<IResource> theContainedResources) {
|
||||||
|
myContainedResources = theContainedResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return myContainedResources == null || myContainedResources.size() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 <b>Narrative</b> Datatype
|
||||||
|
* (A human-readable formatted text, including images)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* A human-readable formatted text, including images
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Requirements:</b>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@DatatypeDef(name="Narrative")
|
||||||
|
public class NarrativeDt extends BaseNarrativeDt {
|
||||||
|
|
||||||
|
@Child(name="status", type=CodeDt.class, order=0, min=1, max=1)
|
||||||
|
private BoundCodeDt<NarrativeStatusEnum> 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 <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
|
||||||
|
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements( theType, myStatus, myDiv );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value(s) for <b>status</b> (generated | extensions | additional).
|
||||||
|
* creating it if it does
|
||||||
|
* not exist. Will not return <code>null</code>.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* 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
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public BoundCodeDt<NarrativeStatusEnum> getStatus() {
|
||||||
|
if (myStatus == null) {
|
||||||
|
myStatus = new BoundCodeDt<NarrativeStatusEnum>(NarrativeStatusEnum.VALUESET_BINDER);
|
||||||
|
}
|
||||||
|
return myStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value(s) for <b>status</b> (generated | extensions | additional)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* 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
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public void setStatus(BoundCodeDt<NarrativeStatusEnum> theValue) {
|
||||||
|
myStatus = theValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value(s) for <b>status</b> (generated | extensions | additional)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* 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
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public void setStatus(NarrativeStatusEnum theValue) {
|
||||||
|
getStatus().setValueAsEnum(theValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value(s) for <b>div</b> (Limited xhtml content).
|
||||||
|
* creating it if it does
|
||||||
|
* not exist. Will not return <code>null</code>.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* The actual narrative content, a stripped down version of XHTML
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public XhtmlDt getDiv() {
|
||||||
|
if (myDiv == null) {
|
||||||
|
myDiv = new XhtmlDt();
|
||||||
|
}
|
||||||
|
return myDiv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value(s) for <b>div</b> (Limited xhtml content)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* The actual narrative content, a stripped down version of XHTML
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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 <b>ResourceReferenceDt</b> Datatype
|
||||||
|
* (A reference from one resource to another)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* A reference from one resource to another
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Requirements:</b>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@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.
|
||||||
|
* <p>
|
||||||
|
* <b> When using this in a server:</b> 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.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @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 <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
|
||||||
|
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myReference, myDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value(s) for <b>reference</b> (Relative, internal or absolute URL reference).
|
||||||
|
* creating it if it does
|
||||||
|
* not exist. Will not return <code>null</code>.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* 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
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public IdDt getReference() {
|
||||||
|
if (myReference == null) {
|
||||||
|
myReference = new IdDt();
|
||||||
|
}
|
||||||
|
return myReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value(s) for <b>reference</b> (Relative, internal or absolute URL reference)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* 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
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public ResourceReferenceDt setReference(IdDt theValue) {
|
||||||
|
myReference = theValue;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value for <b>reference</b> (Relative, internal or absolute URL reference)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* 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
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public ResourceReferenceDt setReference( String theId) {
|
||||||
|
myReference = new IdDt(theId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value(s) for <b>display</b> (Text alternative for the resource).
|
||||||
|
* creating it if it does
|
||||||
|
* not exist. Will not return <code>null</code>.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* Plain text narrative that identifies the resource in addition to the resource reference
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public StringDt getDisplay() {
|
||||||
|
if (myDisplay == null) {
|
||||||
|
myDisplay = new StringDt();
|
||||||
|
}
|
||||||
|
return myDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value(s) for <b>display</b> (Text alternative for the resource)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* Plain text narrative that identifies the resource in addition to the resource reference
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public ResourceReferenceDt setDisplay(StringDt theValue) {
|
||||||
|
myDisplay = theValue;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value for <b>display</b> (Text alternative for the resource)
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Definition:</b>
|
||||||
|
* Plain text narrative that identifies the resource in addition to the resource reference
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public ResourceReferenceDt setDisplay( String theString) {
|
||||||
|
myDisplay = new StringDt(theString);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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 <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import static org.junit.Assert.assertThat;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
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;
|
import ca.uhn.fhir.model.dstu2.resource.Practitioner;
|
||||||
|
|
||||||
public class CustomThymeleafNarrativeGeneratorTest {
|
public class CustomThymeleafNarrativeGeneratorTest {
|
||||||
|
|
|
@ -12,11 +12,11 @@ import org.junit.Test;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
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.CodeableConceptDt;
|
||||||
|
import ca.uhn.fhir.model.dstu2.composite.NarrativeDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
|
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
|
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.DiagnosticReport;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Encounter;
|
import ca.uhn.fhir.model.dstu2.resource.Encounter;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Medication;
|
import ca.uhn.fhir.model.dstu2.resource.Medication;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
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.MedicationPrescription;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers;
|
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers;
|
||||||
|
|
|
@ -14,9 +14,9 @@ import org.junit.Test;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
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.composite.DurationDt;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.AllergyIntolerance;
|
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.Composition;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Encounter;
|
import ca.uhn.fhir.model.dstu2.resource.Encounter;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription;
|
import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.junit.Test;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.dstu.resource.Binary;
|
import ca.uhn.fhir.model.dstu2.resource.Binary;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.rest.annotation.Create;
|
import ca.uhn.fhir.rest.annotation.Create;
|
||||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||||
|
|
|
@ -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.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Extension;
|
import ca.uhn.fhir.model.api.annotation.Extension;
|
||||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
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.DiagnosticReport;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
||||||
|
|
|
@ -506,6 +506,10 @@ public abstract class BaseStructureParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theResourceOutputDirectory != null) {
|
if (theResourceOutputDirectory != null) {
|
||||||
|
|
||||||
|
// Binary is manually generated but should still go in the list
|
||||||
|
myNameToResourceClass.put("Binary", thePackageBase + ".resource.Binary");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File versionFile = new File(theResourceOutputDirectory, "fhirversion.properties");
|
File versionFile = new File(theResourceOutputDirectory, "fhirversion.properties");
|
||||||
FileWriter w = new FileWriter(versionFile, false);
|
FileWriter w = new FileWriter(versionFile, false);
|
||||||
|
|
Loading…
Reference in New Issue