Merge branch 'hl7org_structs' of github.com:jamesagnew/hapi-fhir into hl7org_structs
This commit is contained in:
commit
aa2f2cee96
|
@ -27,14 +27,12 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum;
|
||||
import ca.uhn.fhir.i18n.HapiLocalizer;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IFhirVersion;
|
||||
|
@ -518,4 +516,11 @@ public class FhirContext {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all element definitions (resources, datatypes, etc.)
|
||||
*/
|
||||
public Collection<BaseRuntimeElementDefinition<?>> getElementDefinitions() {
|
||||
return Collections.unmodifiableCollection(myClassToElementDefinition.values());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -536,12 +536,17 @@ class ModelScanner {
|
|||
*/
|
||||
Class<? extends IBase> et = (Class<? extends IBase>) nextElementType;
|
||||
|
||||
IValueSetEnumBinder<Enum<?>> binder = null;
|
||||
Object binder = null;
|
||||
if (BoundCodeDt.class.isAssignableFrom(nextElementType) || IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) {
|
||||
binder = getBoundCodeBinder(next);
|
||||
}
|
||||
|
||||
RuntimeChildDeclaredExtensionDefinition def = new RuntimeChildDeclaredExtensionDefinition(next, childAnnotation, descriptionAnnotation, extensionAttr, elementName, extensionAttr.url(), et, binder);
|
||||
|
||||
if (IBaseEnumeration.class.isAssignableFrom(nextElementType)) {
|
||||
def.setEnumerationType(ReflectionUtil.getGenericCollectionTypeOfField(next));
|
||||
}
|
||||
|
||||
orderMap.put(order, def);
|
||||
if (IBase.class.isAssignableFrom(nextElementType)) {
|
||||
addScanAlso((Class<? extends IBase>) nextElementType);
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Map;
|
|||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
|
||||
import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -62,7 +63,7 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
|
|||
}
|
||||
}
|
||||
|
||||
if (IResource.class.isAssignableFrom(next) || IDatatype.class.isAssignableFrom(next) || IBaseDatatype.class.isAssignableFrom(next)) {
|
||||
if (IResource.class.isAssignableFrom(next) || IDatatype.class.isAssignableFrom(next) || IBaseDatatype.class.isAssignableFrom(next) || IBaseReference.class.isAssignableFrom(next)) {
|
||||
choiceTypes.add(next);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,34 +82,37 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
|||
myDatatypeToElementName = new HashMap<Class<? extends IBase>, String>();
|
||||
myDatatypeToElementDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>();
|
||||
|
||||
String referenceChildName = theContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU1) ? "Resource" : "Reference";
|
||||
|
||||
for (Class<? extends IBase> next : myChoiceTypes) {
|
||||
|
||||
String elementName;
|
||||
String alternateElementName = null;
|
||||
BaseRuntimeElementDefinition<?> nextDef;
|
||||
if (IBaseResource.class.isAssignableFrom(next)) {
|
||||
elementName = getElementName() + StringUtils.capitalize(next.getSimpleName());
|
||||
alternateElementName = getElementName() + referenceChildName;
|
||||
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
||||
types.add((Class<? extends IBaseResource>) next);
|
||||
nextDef = new RuntimeResourceReferenceDefinition(elementName, types);
|
||||
nextDef.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||
|
||||
myNameToChildDefinition.put(getElementName() + "Reference", nextDef);
|
||||
myNameToChildDefinition.put(getElementName() + "Resource", nextDef);
|
||||
|
||||
} else {
|
||||
nextDef = theClassToElementDefinitions.get(next);
|
||||
elementName = getElementName() + StringUtils.capitalize(nextDef.getName());
|
||||
}
|
||||
|
||||
myNameToChildDefinition.put(elementName, nextDef);
|
||||
if (alternateElementName != null) {
|
||||
myNameToChildDefinition.put(alternateElementName, nextDef);
|
||||
}
|
||||
|
||||
if (IBaseResource.class.isAssignableFrom(next)) {
|
||||
Class<? extends IBase> refType = theContext.getVersion().getResourceReferenceType();
|
||||
myDatatypeToElementDefinition.put(refType, nextDef);
|
||||
alternateElementName = getElementName() + referenceChildName;
|
||||
|
||||
String alternateElementName;
|
||||
if (theContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU1)) {
|
||||
alternateElementName = getElementName() + "Resource";
|
||||
} else {
|
||||
alternateElementName = getElementName() + "Reference";
|
||||
}
|
||||
myDatatypeToElementName.put(refType, alternateElementName);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ import java.util.Set;
|
|||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.api.annotation.Extension;
|
||||
|
@ -48,7 +48,8 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
|
|||
private String myExtensionUrl;
|
||||
private boolean myModifier;
|
||||
private Map<String, RuntimeChildDeclaredExtensionDefinition> myUrlToChildExtension;
|
||||
private Object myInstanceConstructorArguments;
|
||||
private volatile Object myInstanceConstructorArguments;
|
||||
private Class<?> myEnumerationType;
|
||||
|
||||
/**
|
||||
* @param theBoundTypeBinder
|
||||
|
@ -57,7 +58,7 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
|
|||
* @param theDefinedLocally
|
||||
* See {@link Extension#definedLocally()}
|
||||
*/
|
||||
RuntimeChildDeclaredExtensionDefinition(Field theField, Child theChild, Description theDescriptionAnnotation, Extension theExtension, String theElementName, String theExtensionUrl, Class<? extends IBase> theChildType, IValueSetEnumBinder<Enum<?>> theBoundTypeBinder)
|
||||
RuntimeChildDeclaredExtensionDefinition(Field theField, Child theChild, Description theDescriptionAnnotation, Extension theExtension, String theElementName, String theExtensionUrl, Class<? extends IBase> theChildType, Object theBoundTypeBinder)
|
||||
throws ConfigurationException {
|
||||
super(theField, theChild, theDescriptionAnnotation, theElementName);
|
||||
assert isNotBlank(theExtensionUrl);
|
||||
|
@ -70,7 +71,16 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
|
|||
|
||||
@Override
|
||||
public Object getInstanceConstructorArguments() {
|
||||
return myInstanceConstructorArguments;
|
||||
Object retVal = myInstanceConstructorArguments;
|
||||
if (retVal == null && myEnumerationType != null) {
|
||||
retVal = RuntimeChildPrimitiveEnumerationDatatypeDefinition.toEnumFactory(myEnumerationType);
|
||||
myInstanceConstructorArguments = retVal;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public void setEnumerationType(Class<?> theEnumerationType) {
|
||||
myEnumerationType = theEnumerationType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,16 +42,22 @@ public class RuntimeChildPrimitiveEnumerationDatatypeDefinition extends RuntimeC
|
|||
public Object getInstanceConstructorArguments() {
|
||||
Object retVal = myBinder;
|
||||
if (retVal == null) {
|
||||
retVal = toEnumFactory(myEnumerationType);
|
||||
myBinder = retVal;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static Object toEnumFactory(Class<?> theEnumerationType) {
|
||||
Class<?> clazz;
|
||||
String className = myEnumerationType.getName() + "EnumFactory";
|
||||
String className = theEnumerationType.getName() + "EnumFactory";
|
||||
Object retVal;
|
||||
try {
|
||||
clazz = Class.forName(className);
|
||||
retVal = clazz.newInstance();
|
||||
myBinder = retVal;
|
||||
} catch (Exception e) {
|
||||
throw new ConfigurationException("Failed to instantiate " + className, e);
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
@ -38,6 +37,8 @@ import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
|||
|
||||
public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildDefinition {
|
||||
|
||||
private static final String VALUE_REFERENCE = "valueReference";
|
||||
private static final String VALUE_RESOURCE = "valueResource";
|
||||
private Map<String, BaseRuntimeElementDefinition<?>> myAttributeNameToDefinition;
|
||||
private Map<Class<? extends IBase>, String> myDatatypeToAttributeName;
|
||||
private Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> myDatatypeToDefinition;
|
||||
|
@ -53,7 +54,7 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
|||
public List<IBase> getValues(Object theTarget) {
|
||||
ExtensionDt target = (ExtensionDt) theTarget;
|
||||
if (target.getValue() != null) {
|
||||
return Collections.singletonList((IBase)target.getValue());
|
||||
return Collections.singletonList((IBase) target.getValue());
|
||||
}
|
||||
ArrayList<IBase> retVal = new ArrayList<IBase>(target.getUndeclaredExtensions());
|
||||
return retVal;
|
||||
|
@ -115,15 +116,36 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
|||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||
Map<String, BaseRuntimeElementDefinition<?>> datatypeAttributeNameToDefinition = new HashMap<String, BaseRuntimeElementDefinition<?>>();
|
||||
myDatatypeToAttributeName = new HashMap<Class<? extends IBase>, String>();
|
||||
myDatatypeToDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>();
|
||||
|
||||
for (BaseRuntimeElementDefinition<?> next : theClassToElementDefinitions.values()) {
|
||||
if (next instanceof IRuntimeDatatypeDefinition) {
|
||||
// if (next.getName().equals("CodeableConcept")) {
|
||||
// System.out.println();
|
||||
// }
|
||||
// if (next.getName().equals("CodeableConcept")) {
|
||||
// System.out.println();
|
||||
// }
|
||||
|
||||
myDatatypeToDefinition.put(next.getImplementingClass(), next);
|
||||
|
||||
if (!((IRuntimeDatatypeDefinition) next).isSpecialization()) {
|
||||
String qualifiedName = next.getImplementingClass().getName();
|
||||
|
||||
/*
|
||||
* We don't want user-defined custom datatypes ending up overriding the built in
|
||||
* types here. It would probably be better for there to be a way for
|
||||
* a datatype to indicate via its annotation that it's a built in
|
||||
* type.
|
||||
*/
|
||||
if (!qualifiedName.startsWith("ca.uhn.fhir.model")) {
|
||||
if (!qualifiedName.startsWith("org.hl7.fhir.instance.model")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String attrName = createExtensionChildName(next);
|
||||
if (datatypeAttributeNameToDefinition.containsKey(attrName)) {
|
||||
BaseRuntimeElementDefinition<?> existing = datatypeAttributeNameToDefinition.get(attrName);
|
||||
throw new ConfigurationException("More than one child of " + getElementName() + " matches attribute name " + attrName + ". Found [" + existing.getImplementingClass().getName() + "] and [" + next.getImplementingClass().getName() + "]");
|
||||
}
|
||||
datatypeAttributeNameToDefinition.put(attrName, next);
|
||||
datatypeAttributeNameToDefinition.put(attrName.toLowerCase(), next);
|
||||
myDatatypeToAttributeName.put(next.getImplementingClass(), attrName);
|
||||
|
@ -133,42 +155,37 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
|||
|
||||
myAttributeNameToDefinition = datatypeAttributeNameToDefinition;
|
||||
|
||||
myDatatypeToDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>();
|
||||
|
||||
for (Entry<String, BaseRuntimeElementDefinition<?>> next : myAttributeNameToDefinition.entrySet()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IDatatype> type = (Class<? extends IDatatype>) next.getValue().getImplementingClass();
|
||||
myDatatypeToDefinition.put(type, next.getValue());
|
||||
}
|
||||
// for (Entry<String, BaseRuntimeElementDefinition<?>> next : myAttributeNameToDefinition.entrySet()) {
|
||||
// @SuppressWarnings("unchecked")
|
||||
// Class<? extends IDatatype> type = (Class<? extends IDatatype>) next.getValue().getImplementingClass();
|
||||
// myDatatypeToDefinition.put(type, next.getValue());
|
||||
// }
|
||||
|
||||
/*
|
||||
* Resource reference - The correct name is 'valueReference', but
|
||||
* we allow for valueResource because some incorrect parsers may use this.
|
||||
* valueResource was the correct name in DSTU1. We put the correct name
|
||||
* second so that it gets stored as the appropriate name for the
|
||||
* reference datatype.
|
||||
* Resource reference - The correct name is 'valueReference' in DSTU2 and 'valueResource' in DSTU1
|
||||
*/
|
||||
addReferenceBinding(theContext, theClassToElementDefinitions, "valueResource");
|
||||
addReferenceBinding(theContext, theClassToElementDefinitions, "valueReference");
|
||||
addReferenceBinding(theContext, theClassToElementDefinitions, VALUE_RESOURCE);
|
||||
addReferenceBinding(theContext, theClassToElementDefinitions, VALUE_REFERENCE);
|
||||
}
|
||||
|
||||
private void addReferenceBinding(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions, String value) {
|
||||
if (theContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU1) && "valueReference".equals(value)) {
|
||||
// This changed between DSTU1 and DSTU2 so don't store the DSTU2 name here
|
||||
} else {
|
||||
myDatatypeToAttributeName.put(theContext.getVersion().getResourceReferenceType(), value);
|
||||
}
|
||||
|
||||
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
||||
types.add(IBaseResource.class);
|
||||
RuntimeResourceReferenceDefinition def = new RuntimeResourceReferenceDefinition(value, types);
|
||||
def.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||
|
||||
myAttributeNameToDefinition.put(value, def);
|
||||
|
||||
/*
|
||||
* Resource reference - The correct name is 'valueReference' in DSTU2 and 'valueResource' in DSTU1
|
||||
*/
|
||||
boolean dstu1 = (theContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU1));
|
||||
if ((dstu1 && (value != VALUE_REFERENCE)) || (!dstu1 && (value != VALUE_RESOURCE))) {
|
||||
myDatatypeToAttributeName.put(theContext.getVersion().getResourceReferenceType(), value);
|
||||
myDatatypeToDefinition.put(BaseResourceReferenceDt.class, def);
|
||||
myDatatypeToDefinition.put(theContext.getVersion().getResourceReferenceType(), def);
|
||||
}
|
||||
|
||||
Class<? extends IBase> versionReferenceType = theContext.getVersion().getResourceReferenceType();
|
||||
myDatatypeToDefinition.put(versionReferenceType, def);
|
||||
}
|
||||
|
||||
public static String createExtensionChildName(BaseRuntimeElementDefinition<?> next) {
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.model.api;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -553,7 +553,7 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
}
|
||||
boolean primitive = childDef.getChildType() == ChildTypeEnum.PRIMITIVE_DATATYPE;
|
||||
|
||||
if (childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCES && theContainedResource) {
|
||||
if ((childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCES||childDef.getChildType()==ChildTypeEnum.CONTAINED_RESOURCE_LIST) && theContainedResource) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1181,31 +1181,30 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
}
|
||||
}
|
||||
|
||||
private void parseExtensionInDstu2Style(boolean theModifier, ParserState<?> theState, String theParentExtensionUrl, String theExtensionUrl, JsonArray theValues) {
|
||||
String extUrl = UrlUtil.constructAbsoluteUrl(theParentExtensionUrl, theExtensionUrl);
|
||||
theState.enteringNewElementExtension(null, extUrl, theModifier);
|
||||
|
||||
for (int extIdx = 0; extIdx < theValues.size(); extIdx++) {
|
||||
JsonObject nextExt = theValues.getJsonObject(extIdx);
|
||||
for (String nextKey : nextExt.keySet()) {
|
||||
// if (nextKey.startsWith("value") && nextKey.length() > 5 &&
|
||||
// myContext.getRuntimeChildUndeclaredExtensionDefinition().getChildByName(nextKey) != null) {
|
||||
JsonValue jsonVal = nextExt.get(nextKey);
|
||||
if (jsonVal.getValueType() == ValueType.ARRAY) {
|
||||
/*
|
||||
* Extension children which are arrays are sub-extensions. Any other value type should be treated as
|
||||
* a value.
|
||||
*/
|
||||
JsonArray arrayValue = (JsonArray) jsonVal;
|
||||
parseExtensionInDstu2Style(theModifier, theState, extUrl, nextKey, arrayValue);
|
||||
} else {
|
||||
parseChildren(theState, nextKey, jsonVal, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
theState.endingElement();
|
||||
}
|
||||
// private void parseExtensionInDstu2Style(boolean theModifier, ParserState<?> theState, String theParentExtensionUrl, String theExtensionUrl, JsonArray theValues) {
|
||||
// String extUrl = UrlUtil.constructAbsoluteUrl(theParentExtensionUrl, theExtensionUrl);
|
||||
// theState.enteringNewElementExtension(null, extUrl, theModifier);
|
||||
//
|
||||
// for (int extIdx = 0; extIdx < theValues.size(); extIdx++) {
|
||||
// JsonObject nextExt = theValues.getJsonObject(extIdx);
|
||||
// for (String nextKey : nextExt.keySet()) {
|
||||
// // if (nextKey.startsWith("value") && nextKey.length() > 5 &&
|
||||
// // myContext.getRuntimeChildUndeclaredExtensionDefinition().getChildByName(nextKey) != null) {
|
||||
// JsonValue jsonVal = nextExt.get(nextKey);
|
||||
// if (jsonVal.getValueType() == ValueType.ARRAY) {
|
||||
// /*
|
||||
// * Extension children which are arrays are sub-extensions. Any other value type should be treated as a value.
|
||||
// */
|
||||
// JsonArray arrayValue = (JsonArray) jsonVal;
|
||||
// parseExtensionInDstu2Style(theModifier, theState, extUrl, nextKey, arrayValue);
|
||||
// } else {
|
||||
// parseChildren(theState, nextKey, jsonVal, null, null);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// theState.endingElement();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public <T extends IBaseResource> T doParseResource(Class<T> theResourceType, Reader theReader) {
|
||||
|
|
|
@ -898,7 +898,7 @@ class ParserState<T> {
|
|||
if (myInstance instanceof IIdentifiableElement) {
|
||||
((IIdentifiableElement) myInstance).setElementSpecificId((theValue));
|
||||
} else {
|
||||
((IResource)myInstance).setId(new IdDt(theValue));
|
||||
((IResource) myInstance).setId(new IdDt(theValue));
|
||||
}
|
||||
} else if ("contentType".equals(theName)) {
|
||||
myInstance.setContentType(theValue);
|
||||
|
@ -1494,6 +1494,7 @@ class ParserState<T> {
|
|||
private class ElementCompositeState extends BaseState {
|
||||
|
||||
private BaseRuntimeElementCompositeDefinition<?> myDefinition;
|
||||
|
||||
public BaseRuntimeElementCompositeDefinition<?> getDefinition() {
|
||||
return myDefinition;
|
||||
}
|
||||
|
@ -1727,7 +1728,6 @@ class ParserState<T> {
|
|||
|
||||
}
|
||||
|
||||
|
||||
private class SecurityLabelElementStateHapi extends ElementCompositeState {
|
||||
|
||||
public SecurityLabelElementStateHapi(ParserState<T>.PreResourceState thePreResourceState, BaseRuntimeElementCompositeDefinition<?> theDef, BaseCodingDt codingDt) {
|
||||
|
@ -1739,7 +1739,6 @@ class ParserState<T> {
|
|||
pop();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class MetaElementState extends BaseState {
|
||||
|
@ -1759,8 +1758,8 @@ class ParserState<T> {
|
|||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
if (theLocalPart.equals("versionId")) {
|
||||
push(new MetaVersionElementState(getPreResourceState(), myMap));
|
||||
// } else if (theLocalPart.equals("profile")) {
|
||||
//
|
||||
// } else if (theLocalPart.equals("profile")) {
|
||||
//
|
||||
} else if (theLocalPart.equals("lastUpdated")) {
|
||||
InstantDt updated = new InstantDt();
|
||||
push(new PrimitiveState(getPreResourceState(), updated));
|
||||
|
@ -1907,18 +1906,15 @@ class ParserState<T> {
|
|||
String resourceName = myContext.getResourceDefinition(nextResource).getName();
|
||||
String bundleIdPart = nextResource.getId().getIdPart();
|
||||
if (isNotBlank(bundleIdPart)) {
|
||||
// if (isNotBlank(entryBaseUrl)) {
|
||||
// nextResource.setId(new IdDt(entryBaseUrl, resourceName, bundleIdPart, version));
|
||||
// } else {
|
||||
// if (isNotBlank(entryBaseUrl)) {
|
||||
// nextResource.setId(new IdDt(entryBaseUrl, resourceName, bundleIdPart, version));
|
||||
// } else {
|
||||
nextResource.setId(new IdDt(null, resourceName, bundleIdPart, version));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||
super.enteringNewElement(theNamespaceURI, theLocalPart);
|
||||
|
@ -1960,7 +1956,7 @@ class ParserState<T> {
|
|||
String resourceName = myContext.getResourceDefinition(elem).getName();
|
||||
String versionId = elem.getMeta().getVersionId();
|
||||
if (StringUtils.isBlank(elem.getId().getIdPart())) {
|
||||
// nothing
|
||||
// Resource has no ID
|
||||
} else if (StringUtils.isNotBlank(versionId)) {
|
||||
elem.getIdElement().setValue(resourceName + "/" + elem.getId().getIdPart() + "/_history/" + versionId);
|
||||
} else {
|
||||
|
@ -2551,7 +2547,6 @@ class ParserState<T> {
|
|||
super.doPop();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class XhtmlState extends BaseState {
|
||||
|
|
|
@ -915,6 +915,9 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
}
|
||||
} else {
|
||||
childDef = extDef.getChildElementDefinitionByDatatype(value.getClass());
|
||||
if (childDef == null) {
|
||||
throw new ConfigurationException("Unable to encode extension, unrecognized child element type: " + value.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
encodeChildElementToStreamWriter(theResource, theWriter, value, childName, childDef, null, theIncludedResource);
|
||||
}
|
||||
|
|
|
@ -20,8 +20,7 @@ package ca.uhn.fhir.rest.client;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
|
|
@ -314,7 +314,7 @@ public class FhirTerser {
|
|||
case CONTAINED_RESOURCE_LIST:
|
||||
if (theElement != null) {
|
||||
BaseRuntimeElementDefinition<?> def = myContext.getElementDefinition(theElement.getClass());
|
||||
visit(theElement, null, theChildDefinition, def, theCallback);
|
||||
visit(theElement, pathToElement, null, def, theCallback);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,7 @@ package ca.uhn.fhir.jpa.dao;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
|
@ -529,6 +528,10 @@ public abstract class BaseFhirDao implements IDao {
|
|||
}
|
||||
}
|
||||
|
||||
if (pids.isEmpty()) {
|
||||
return new ArrayList<IBaseResource>();
|
||||
}
|
||||
|
||||
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
|
||||
CriteriaQuery<ResourceTable> cq = builder.createQuery(ResourceTable.class);
|
||||
Root<ResourceTable> from = cq.from(ResourceTable.class);
|
||||
|
|
|
@ -20,8 +20,7 @@ package ca.uhn.fhir.jpa.dao;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
|
@ -1076,7 +1075,7 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
|||
|
||||
@Override
|
||||
public List<IBaseResource> getResources(int theFromIndex, int theToIndex) {
|
||||
ArrayList<IBaseResource> retVal = new ArrayList<IBaseResource>();
|
||||
List<IBaseResource> retVal = new ArrayList<IBaseResource>();
|
||||
if (theFromIndex == 0 && current != null) {
|
||||
retVal.add(current);
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@ 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.base.composite.BaseCodingDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
||||
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
|||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -126,12 +127,7 @@ public class ResourceProviderDstu2Test {
|
|||
|
||||
CloseableHttpResponse response = ourHttpClient.execute(post);
|
||||
try {
|
||||
|
||||
assertEquals(201, response.getStatusLine().getStatusCode());
|
||||
assertThat(response.getFirstHeader(Constants.HEADER_LOCATION_LC).getValue(), startsWith(ourServerBase + "/Patient/"));
|
||||
assertThat(response.getFirstHeader(Constants.HEADER_LOCATION_LC).getValue(), endsWith("/_history/1"));
|
||||
assertThat(response.getFirstHeader(Constants.HEADER_LOCATION_LC).getValue(), not(containsString("1777")));
|
||||
|
||||
assertEquals(400, response.getStatusLine().getStatusCode());
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
|
@ -466,7 +462,7 @@ public class ResourceProviderDstu2Test {
|
|||
// NB this does not get used- The paging provider has its own limits built in
|
||||
ourDaoConfig.setHardSearchLimit(100);
|
||||
|
||||
List<IResource> resources = new ArrayList<IResource>();
|
||||
List<IBaseResource> resources = new ArrayList<IBaseResource>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
Organization org = new Organization();
|
||||
org.setName("rpdstu2_testCountParam_01");
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.apache.commons.io.IOUtils;
|
|||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package ca.uhn.fhirtest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
|
|
@ -785,13 +785,13 @@ public class JsonParserTest {
|
|||
|
||||
private void parseAndEncode(String name) throws IOException {
|
||||
String msg = IOUtils.toString(XmlParser.class.getResourceAsStream(name));
|
||||
ourLog.info(msg);
|
||||
// ourLog.info(msg);
|
||||
|
||||
IParser p = ourCtx.newJsonParser();
|
||||
Profile res = p.parseResource(Profile.class, msg);
|
||||
|
||||
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(res);
|
||||
ourLog.info(encoded);
|
||||
// ourLog.info(encoded);
|
||||
|
||||
JSON expected = JSONSerializer.toJSON(msg.trim());
|
||||
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
||||
|
|
|
@ -76,6 +76,7 @@ public class XmlParserTest {
|
|||
private static FhirContext ourCtx;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserTest.class);
|
||||
|
||||
|
||||
/**
|
||||
* see #144 and #146
|
||||
*/
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
package ca.uhn.fhir.parser;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
|
@ -21,6 +12,7 @@ import java.util.UUID;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.custommonkey.xmlunit.Diff;
|
||||
import org.custommonkey.xmlunit.XMLUnit;
|
||||
import org.hamcrest.core.StringContains;
|
||||
import org.hamcrest.text.StringContainsInOrder;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -53,6 +45,7 @@ import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription;
|
|||
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.DocumentReferenceStatusEnum;
|
||||
|
@ -74,6 +67,27 @@ public class XmlParserDstu2Test {
|
|||
XMLUnit.setIgnoreWhitespace(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeExtensionWithResourceContent() {
|
||||
IParser parser = ourCtx.newXmlParser();
|
||||
|
||||
Patient patient = new Patient();
|
||||
patient.addAddress().setUse(AddressUseEnum.HOME);
|
||||
patient.addUndeclaredExtension(false, "urn:foo", new ResourceReferenceDt("Organization/123"));
|
||||
|
||||
String val = parser.encodeResourceToString(patient);
|
||||
ourLog.info(val);
|
||||
assertThat(val, StringContains.containsString("<extension url=\"urn:foo\"><valueReference><reference value=\"Organization/123\"/></valueReference></extension>"));
|
||||
|
||||
Patient actual = parser.parseResource(Patient.class, val);
|
||||
assertEquals(AddressUseEnum.HOME.getCode(), patient.getAddress().get(0).getUse());
|
||||
List<ExtensionDt> ext = actual.getUndeclaredExtensions();
|
||||
assertEquals(1, ext.size());
|
||||
ResourceReferenceDt ref = (ResourceReferenceDt) ext.get(0).getValue();
|
||||
assertEquals("Organization/123", ref.getReference().getValue());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContainedResourceInExtensionUndeclared() {
|
||||
Patient p = new Patient();
|
||||
|
@ -474,35 +488,7 @@ public class XmlParserDstu2Test {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* See #163
|
||||
*/
|
||||
@Test
|
||||
public void testParseResourceType() {
|
||||
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
|
||||
// Patient
|
||||
Patient patient = new Patient();
|
||||
String patientId = UUID.randomUUID().toString();
|
||||
patient.setId(new IdDt("Patient", patientId));
|
||||
patient.addName().addGiven("John").addFamily("Smith");
|
||||
patient.setGender(AdministrativeGenderEnum.MALE);
|
||||
patient.setBirthDate(new DateDt("1987-04-16"));
|
||||
|
||||
// Bundle
|
||||
ca.uhn.fhir.model.dstu2.resource.Bundle bundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
||||
bundle.setType(BundleTypeEnum.COLLECTION);
|
||||
bundle.addEntry().setResource(patient);
|
||||
|
||||
String bundleText = xmlParser.encodeResourceToString(bundle);
|
||||
ourLog.info(bundleText);
|
||||
|
||||
ca.uhn.fhir.model.dstu2.resource.Bundle reincarnatedBundle = xmlParser.parseResource (ca.uhn.fhir.model.dstu2.resource.Bundle.class, bundleText);
|
||||
Patient reincarnatedPatient = (Patient) reincarnatedBundle.getEntry().get(0).getResource();
|
||||
|
||||
assertEquals("Patient", patient.getId().getResourceType());
|
||||
assertEquals("Patient", reincarnatedPatient.getId().getResourceType());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -633,6 +619,35 @@ public class XmlParserDstu2Test {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* See #163
|
||||
*/
|
||||
@Test
|
||||
public void testParseResourceType() {
|
||||
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
|
||||
// Patient
|
||||
Patient patient = new Patient();
|
||||
String patientId = UUID.randomUUID().toString();
|
||||
patient.setId(new IdDt("Patient", patientId));
|
||||
patient.addName().addGiven("John").addFamily("Smith");
|
||||
patient.setGender(AdministrativeGenderEnum.MALE);
|
||||
patient.setBirthDate(new DateDt("1987-04-16"));
|
||||
|
||||
// Bundle
|
||||
ca.uhn.fhir.model.dstu2.resource.Bundle bundle = new ca.uhn.fhir.model.dstu2.resource.Bundle();
|
||||
bundle.setType(BundleTypeEnum.COLLECTION);
|
||||
bundle.addEntry().setResource(patient);
|
||||
|
||||
String bundleText = xmlParser.encodeResourceToString(bundle);
|
||||
ourLog.info(bundleText);
|
||||
|
||||
ca.uhn.fhir.model.dstu2.resource.Bundle reincarnatedBundle = xmlParser.parseResource (ca.uhn.fhir.model.dstu2.resource.Bundle.class, bundleText);
|
||||
Patient reincarnatedPatient = reincarnatedBundle.getAllPopulatedChildElementsOfType(Patient.class).get(0);
|
||||
|
||||
assertEquals("Patient", patient.getId().getResourceType());
|
||||
assertEquals("Patient", reincarnatedPatient.getId().getResourceType());
|
||||
}
|
||||
|
||||
/**
|
||||
* see #144 and #146
|
||||
|
|
|
@ -28,8 +28,14 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> <groupId>net.sf.saxon</groupId> <artifactId>saxon</artifactId>
|
||||
<version>8.7</version> </dependency> -->
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
<artifactId>saxon</artifactId>
|
||||
<version>8.7</version>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<dependency>
|
||||
<groupId>xpp3</groupId>
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
|||
* There is a variety of postal address formats defined around the world. This format defines a superset that is the basis for all addresses around the world.
|
||||
*/
|
||||
@DatatypeDef(name="Address")
|
||||
public class Address extends Type implements ICompositeType {
|
||||
public class AddressType extends Type implements ICompositeType {
|
||||
|
||||
public enum AddressUse {
|
||||
/**
|
||||
|
@ -202,7 +202,7 @@ P.O. Box number, delivery hints, and similar address information.
|
|||
|
||||
private static final long serialVersionUID = -470351694L;
|
||||
|
||||
public Address() {
|
||||
public AddressType() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ P.O. Box number, delivery hints, and similar address information.
|
|||
/**
|
||||
* @param value {@link #use} (The purpose of this address.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
|
||||
*/
|
||||
public Address setUseElement(Enumeration<AddressUse> value) {
|
||||
public AddressType setUseElement(Enumeration<AddressUse> value) {
|
||||
this.use = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ P.O. Box number, delivery hints, and similar address information.
|
|||
/**
|
||||
* @param value The purpose of this address.
|
||||
*/
|
||||
public Address setUse(AddressUse value) {
|
||||
public AddressType setUse(AddressUse value) {
|
||||
if (value == null)
|
||||
this.use = null;
|
||||
else {
|
||||
|
@ -278,7 +278,7 @@ P.O. Box number, delivery hints, and similar address information.
|
|||
/**
|
||||
* @param value {@link #text} (A full text representation of the address.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
|
||||
*/
|
||||
public Address setTextElement(StringType value) {
|
||||
public AddressType setTextElement(StringType value) {
|
||||
this.text = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ P.O. Box number, delivery hints, and similar address information.
|
|||
/**
|
||||
* @param value A full text representation of the address.
|
||||
*/
|
||||
public Address setText(String value) {
|
||||
public AddressType setText(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.text = null;
|
||||
else {
|
||||
|
@ -340,7 +340,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
* @param value {@link #line} (This component contains the house number, apartment number, street name, street direction,
|
||||
P.O. Box number, delivery hints, and similar address information.)
|
||||
*/
|
||||
public Address addLine(String value) { //1
|
||||
public AddressType addLine(String value) { //1
|
||||
StringType t = new StringType();
|
||||
t.setValue(value);
|
||||
if (this.line == null)
|
||||
|
@ -385,7 +385,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value {@link #city} (The name of the city, town, village or other community or delivery center.). This is the underlying object with id, value and extensions. The accessor "getCity" gives direct access to the value
|
||||
*/
|
||||
public Address setCityElement(StringType value) {
|
||||
public AddressType setCityElement(StringType value) {
|
||||
this.city = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value The name of the city, town, village or other community or delivery center.
|
||||
*/
|
||||
public Address setCity(String value) {
|
||||
public AddressType setCity(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.city = null;
|
||||
else {
|
||||
|
@ -434,7 +434,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value {@link #state} (Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value
|
||||
*/
|
||||
public Address setStateElement(StringType value) {
|
||||
public AddressType setStateElement(StringType value) {
|
||||
this.state = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).
|
||||
*/
|
||||
public Address setState(String value) {
|
||||
public AddressType setState(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.state = null;
|
||||
else {
|
||||
|
@ -483,7 +483,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value {@link #postalCode} (A postal code designating a region defined by the postal service.). This is the underlying object with id, value and extensions. The accessor "getPostalCode" gives direct access to the value
|
||||
*/
|
||||
public Address setPostalCodeElement(StringType value) {
|
||||
public AddressType setPostalCodeElement(StringType value) {
|
||||
this.postalCode = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value A postal code designating a region defined by the postal service.
|
||||
*/
|
||||
public Address setPostalCode(String value) {
|
||||
public AddressType setPostalCode(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.postalCode = null;
|
||||
else {
|
||||
|
@ -532,7 +532,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value {@link #country} (Country - a nation as commonly understood or generally accepted.). This is the underlying object with id, value and extensions. The accessor "getCountry" gives direct access to the value
|
||||
*/
|
||||
public Address setCountryElement(StringType value) {
|
||||
public AddressType setCountryElement(StringType value) {
|
||||
this.country = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value Country - a nation as commonly understood or generally accepted.
|
||||
*/
|
||||
public Address setCountry(String value) {
|
||||
public AddressType setCountry(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.country = null;
|
||||
else {
|
||||
|
@ -577,7 +577,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
/**
|
||||
* @param value {@link #period} (Time period when address was/is in use.)
|
||||
*/
|
||||
public Address setPeriod(Period value) {
|
||||
public AddressType setPeriod(Period value) {
|
||||
this.period = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -594,8 +594,8 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
childrenList.add(new Property("period", "Period", "Time period when address was/is in use.", 0, java.lang.Integer.MAX_VALUE, period));
|
||||
}
|
||||
|
||||
public Address copy() {
|
||||
Address dst = new Address();
|
||||
public AddressType copy() {
|
||||
AddressType dst = new AddressType();
|
||||
copyValues(dst);
|
||||
dst.use = use == null ? null : use.copy();
|
||||
dst.text = text == null ? null : text.copy();
|
||||
|
@ -612,7 +612,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
return dst;
|
||||
}
|
||||
|
||||
protected Address typedCopy() {
|
||||
protected AddressType typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
|
@ -620,9 +620,9 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Address))
|
||||
if (!(other instanceof AddressType))
|
||||
return false;
|
||||
Address o = (Address) other;
|
||||
AddressType o = (AddressType) other;
|
||||
return compareDeep(use, o.use, true) && compareDeep(text, o.text, true) && compareDeep(line, o.line, true)
|
||||
&& compareDeep(city, o.city, true) && compareDeep(state, o.state, true) && compareDeep(postalCode, o.postalCode, true)
|
||||
&& compareDeep(country, o.country, true) && compareDeep(period, o.period, true);
|
||||
|
@ -632,9 +632,9 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
if (!(other instanceof Address))
|
||||
if (!(other instanceof AddressType))
|
||||
return false;
|
||||
Address o = (Address) other;
|
||||
AddressType o = (AddressType) other;
|
||||
return compareValues(use, o.use, true) && compareValues(text, o.text, true) && compareValues(line, o.line, true)
|
||||
&& compareValues(city, o.city, true) && compareValues(state, o.state, true) && compareValues(postalCode, o.postalCode, true)
|
||||
&& compareValues(country, o.country, true);
|
|
@ -41,7 +41,7 @@ import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
|||
* For referring to data content defined in other formats.
|
||||
*/
|
||||
@DatatypeDef(name="Attachment")
|
||||
public class Attachment extends Type implements ICompositeType {
|
||||
public class AttachmentType extends Type implements ICompositeType {
|
||||
|
||||
/**
|
||||
* Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.
|
||||
|
@ -94,7 +94,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
|
||||
private static final long serialVersionUID = 483430116L;
|
||||
|
||||
public Attachment() {
|
||||
public AttachmentType() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value {@link #contentType} (Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
|
||||
*/
|
||||
public Attachment setContentTypeElement(CodeType value) {
|
||||
public AttachmentType setContentTypeElement(CodeType value) {
|
||||
this.contentType = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.
|
||||
*/
|
||||
public Attachment setContentType(String value) {
|
||||
public AttachmentType setContentType(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.contentType = null;
|
||||
else {
|
||||
|
@ -170,7 +170,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value {@link #language} (The human language of the content. The value can be any valid value according to BCP 47.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
|
||||
*/
|
||||
public Attachment setLanguageElement(CodeType value) {
|
||||
public AttachmentType setLanguageElement(CodeType value) {
|
||||
this.language = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value The human language of the content. The value can be any valid value according to BCP 47.
|
||||
*/
|
||||
public Attachment setLanguage(String value) {
|
||||
public AttachmentType setLanguage(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.language = null;
|
||||
else {
|
||||
|
@ -219,7 +219,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value {@link #data} (The actual data of the attachment - a sequence of bytes. In XML, represented using base64.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value
|
||||
*/
|
||||
public Attachment setDataElement(Base64BinaryType value) {
|
||||
public AttachmentType setDataElement(Base64BinaryType value) {
|
||||
this.data = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value The actual data of the attachment - a sequence of bytes. In XML, represented using base64.
|
||||
*/
|
||||
public Attachment setData(byte[] value) {
|
||||
public AttachmentType setData(byte[] value) {
|
||||
if (value == null)
|
||||
this.data = null;
|
||||
else {
|
||||
|
@ -268,7 +268,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value {@link #url} (An alternative location where the data can be accessed.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
*/
|
||||
public Attachment setUrlElement(UriType value) {
|
||||
public AttachmentType setUrlElement(UriType value) {
|
||||
this.url = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value An alternative location where the data can be accessed.
|
||||
*/
|
||||
public Attachment setUrl(String value) {
|
||||
public AttachmentType setUrl(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.url = null;
|
||||
else {
|
||||
|
@ -317,7 +317,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value {@link #size} (The number of bytes of data that make up this attachment.). This is the underlying object with id, value and extensions. The accessor "getSize" gives direct access to the value
|
||||
*/
|
||||
public Attachment setSizeElement(IntegerType value) {
|
||||
public AttachmentType setSizeElement(IntegerType value) {
|
||||
this.size = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value The number of bytes of data that make up this attachment.
|
||||
*/
|
||||
public Attachment setSize(int value) {
|
||||
public AttachmentType setSize(int value) {
|
||||
if (this.size == null)
|
||||
this.size = new IntegerType();
|
||||
this.size.setValue(value);
|
||||
|
@ -362,7 +362,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value {@link #hash} (The calculated hash of the data using SHA-1. Represented using base64.). This is the underlying object with id, value and extensions. The accessor "getHash" gives direct access to the value
|
||||
*/
|
||||
public Attachment setHashElement(Base64BinaryType value) {
|
||||
public AttachmentType setHashElement(Base64BinaryType value) {
|
||||
this.hash = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value The calculated hash of the data using SHA-1. Represented using base64.
|
||||
*/
|
||||
public Attachment setHash(byte[] value) {
|
||||
public AttachmentType setHash(byte[] value) {
|
||||
if (value == null)
|
||||
this.hash = null;
|
||||
else {
|
||||
|
@ -411,7 +411,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value {@link #title} (A label or set of text to display in place of the data.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
|
||||
*/
|
||||
public Attachment setTitleElement(StringType value) {
|
||||
public AttachmentType setTitleElement(StringType value) {
|
||||
this.title = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
/**
|
||||
* @param value A label or set of text to display in place of the data.
|
||||
*/
|
||||
public Attachment setTitle(String value) {
|
||||
public AttachmentType setTitle(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.title = null;
|
||||
else {
|
||||
|
@ -448,8 +448,8 @@ public class Attachment extends Type implements ICompositeType {
|
|||
childrenList.add(new Property("title", "string", "A label or set of text to display in place of the data.", 0, java.lang.Integer.MAX_VALUE, title));
|
||||
}
|
||||
|
||||
public Attachment copy() {
|
||||
Attachment dst = new Attachment();
|
||||
public AttachmentType copy() {
|
||||
AttachmentType dst = new AttachmentType();
|
||||
copyValues(dst);
|
||||
dst.contentType = contentType == null ? null : contentType.copy();
|
||||
dst.language = language == null ? null : language.copy();
|
||||
|
@ -461,7 +461,7 @@ public class Attachment extends Type implements ICompositeType {
|
|||
return dst;
|
||||
}
|
||||
|
||||
protected Attachment typedCopy() {
|
||||
protected AttachmentType typedCopy() {
|
||||
return copy();
|
||||
}
|
||||
|
||||
|
@ -469,9 +469,9 @@ public class Attachment extends Type implements ICompositeType {
|
|||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Attachment))
|
||||
if (!(other instanceof AttachmentType))
|
||||
return false;
|
||||
Attachment o = (Attachment) other;
|
||||
AttachmentType o = (AttachmentType) other;
|
||||
return compareDeep(contentType, o.contentType, true) && compareDeep(language, o.language, true)
|
||||
&& compareDeep(data, o.data, true) && compareDeep(url, o.url, true) && compareDeep(size, o.size, true)
|
||||
&& compareDeep(hash, o.hash, true) && compareDeep(title, o.title, true);
|
||||
|
@ -481,9 +481,9 @@ public class Attachment extends Type implements ICompositeType {
|
|||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
if (!(other instanceof Attachment))
|
||||
if (!(other instanceof AttachmentType))
|
||||
return false;
|
||||
Attachment o = (Attachment) other;
|
||||
AttachmentType o = (AttachmentType) other;
|
||||
return compareValues(contentType, o.contentType, true) && compareValues(language, o.language, true)
|
||||
&& compareValues(data, o.data, true) && compareValues(url, o.url, true) && compareValues(size, o.size, true)
|
||||
&& compareValues(hash, o.hash, true) && compareValues(title, o.title, true);
|
|
@ -421,9 +421,9 @@ public class BodySite extends DomainResource {
|
|||
/**
|
||||
* Image or images used to identify a location.
|
||||
*/
|
||||
@Child(name = "image", type = {Attachment.class}, order = 4, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "image", type = {AttachmentType.class}, order = 4, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Attached images", formalDefinition="Image or images used to identify a location." )
|
||||
protected List<Attachment> image;
|
||||
protected List<AttachmentType> image;
|
||||
|
||||
private static final long serialVersionUID = -11708151L;
|
||||
|
||||
|
@ -567,16 +567,16 @@ public class BodySite extends DomainResource {
|
|||
/**
|
||||
* @return {@link #image} (Image or images used to identify a location.)
|
||||
*/
|
||||
public List<Attachment> getImage() {
|
||||
public List<AttachmentType> getImage() {
|
||||
if (this.image == null)
|
||||
this.image = new ArrayList<Attachment>();
|
||||
this.image = new ArrayList<AttachmentType>();
|
||||
return this.image;
|
||||
}
|
||||
|
||||
public boolean hasImage() {
|
||||
if (this.image == null)
|
||||
return false;
|
||||
for (Attachment item : this.image)
|
||||
for (AttachmentType item : this.image)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -586,10 +586,10 @@ public class BodySite extends DomainResource {
|
|||
* @return {@link #image} (Image or images used to identify a location.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addImage() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addImage() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.image == null)
|
||||
this.image = new ArrayList<Attachment>();
|
||||
this.image = new ArrayList<AttachmentType>();
|
||||
this.image.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -619,8 +619,8 @@ public class BodySite extends DomainResource {
|
|||
};
|
||||
dst.description = description == null ? null : description.copy();
|
||||
if (image != null) {
|
||||
dst.image = new ArrayList<Attachment>();
|
||||
for (Attachment i : image)
|
||||
dst.image = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : image)
|
||||
dst.image.add(i.copy());
|
||||
};
|
||||
return dst;
|
||||
|
|
|
@ -164,7 +164,7 @@ public class Communication extends DomainResource {
|
|||
/**
|
||||
* An individual message part for multi-part messages.
|
||||
*/
|
||||
@Child(name="content", type={StringType.class, Attachment.class}, order=1, min=1, max=1)
|
||||
@Child(name="content", type={StringType.class, AttachmentType.class}, order=1, min=1, max=1)
|
||||
@Description(shortDefinition="Message part content", formalDefinition="An individual message part for multi-part messages." )
|
||||
protected Type content;
|
||||
|
||||
|
@ -198,10 +198,10 @@ public class Communication extends DomainResource {
|
|||
/**
|
||||
* @return {@link #content} (An individual message part for multi-part messages.)
|
||||
*/
|
||||
public Attachment getContentAttachment() throws Exception {
|
||||
if (!(this.content instanceof Attachment))
|
||||
public AttachmentType getContentAttachment() throws Exception {
|
||||
if (!(this.content instanceof AttachmentType))
|
||||
throw new Exception("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
|
||||
return (Attachment) this.content;
|
||||
return (AttachmentType) this.content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -234,7 +234,7 @@ public class CommunicationRequest extends DomainResource {
|
|||
/**
|
||||
* An individual message part for multi-part messages.
|
||||
*/
|
||||
@Child(name="content", type={StringType.class, Attachment.class}, order=1, min=1, max=1)
|
||||
@Child(name="content", type={StringType.class, AttachmentType.class}, order=1, min=1, max=1)
|
||||
@Description(shortDefinition="Message part content", formalDefinition="An individual message part for multi-part messages." )
|
||||
protected Type content;
|
||||
|
||||
|
@ -268,10 +268,10 @@ public class CommunicationRequest extends DomainResource {
|
|||
/**
|
||||
* @return {@link #content} (An individual message part for multi-part messages.)
|
||||
*/
|
||||
public Attachment getContentAttachment() throws Exception {
|
||||
if (!(this.content instanceof Attachment))
|
||||
public AttachmentType getContentAttachment() throws Exception {
|
||||
if (!(this.content instanceof AttachmentType))
|
||||
throw new Exception("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered");
|
||||
return (Attachment) this.content;
|
||||
return (AttachmentType) this.content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -957,9 +957,9 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* Legally binding contract.
|
||||
*/
|
||||
@Child(name = "binding", type = {Attachment.class}, order = 21, min = 0, max = 1)
|
||||
@Child(name = "binding", type = {AttachmentType.class}, order = 21, min = 0, max = 1)
|
||||
@Description(shortDefinition="Binding Contract", formalDefinition="Legally binding contract." )
|
||||
protected Attachment binding;
|
||||
protected AttachmentType binding;
|
||||
|
||||
/**
|
||||
* Relevant time/time-period when applicable.
|
||||
|
@ -971,9 +971,9 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* Friendly Human readable form (might be a reference to the UI used to capture the contract).
|
||||
*/
|
||||
@Child(name = "friendly", type = {Attachment.class}, order = 23, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "friendly", type = {AttachmentType.class}, order = 23, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Human readable contract text", formalDefinition="Friendly Human readable form (might be a reference to the UI used to capture the contract)." )
|
||||
protected List<Attachment> friendly;
|
||||
protected List<AttachmentType> friendly;
|
||||
|
||||
/**
|
||||
* Relevant time/time-period when applicable.
|
||||
|
@ -985,9 +985,9 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* Legal text in Human readable form.
|
||||
*/
|
||||
@Child(name = "legal", type = {Attachment.class}, order = 25, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "legal", type = {AttachmentType.class}, order = 25, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Legal contract text", formalDefinition="Legal text in Human readable form." )
|
||||
protected List<Attachment> legal;
|
||||
protected List<AttachmentType> legal;
|
||||
|
||||
/**
|
||||
* Relevant time/time-period when applicable.
|
||||
|
@ -999,9 +999,9 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* Computable Policy rules (e.g. XACML, DKAL, SecPal).
|
||||
*/
|
||||
@Child(name = "rule", type = {Attachment.class}, order = 27, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "rule", type = {AttachmentType.class}, order = 27, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Computable contract text", formalDefinition="Computable Policy rules (e.g. XACML, DKAL, SecPal)." )
|
||||
protected List<Attachment> rule;
|
||||
protected List<AttachmentType> rule;
|
||||
|
||||
/**
|
||||
* Relevant time/time-period when applicable.
|
||||
|
@ -1781,12 +1781,12 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* @return {@link #binding} (Legally binding contract.)
|
||||
*/
|
||||
public Attachment getBinding() {
|
||||
public AttachmentType getBinding() {
|
||||
if (this.binding == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Contract.binding");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.binding = new Attachment(); // cc
|
||||
this.binding = new AttachmentType(); // cc
|
||||
return this.binding;
|
||||
}
|
||||
|
||||
|
@ -1797,7 +1797,7 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* @param value {@link #binding} (Legally binding contract.)
|
||||
*/
|
||||
public Contract setBinding(Attachment value) {
|
||||
public Contract setBinding(AttachmentType value) {
|
||||
this.binding = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -1854,16 +1854,16 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* @return {@link #friendly} (Friendly Human readable form (might be a reference to the UI used to capture the contract).)
|
||||
*/
|
||||
public List<Attachment> getFriendly() {
|
||||
public List<AttachmentType> getFriendly() {
|
||||
if (this.friendly == null)
|
||||
this.friendly = new ArrayList<Attachment>();
|
||||
this.friendly = new ArrayList<AttachmentType>();
|
||||
return this.friendly;
|
||||
}
|
||||
|
||||
public boolean hasFriendly() {
|
||||
if (this.friendly == null)
|
||||
return false;
|
||||
for (Attachment item : this.friendly)
|
||||
for (AttachmentType item : this.friendly)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -1873,10 +1873,10 @@ public class Contract extends DomainResource {
|
|||
* @return {@link #friendly} (Friendly Human readable form (might be a reference to the UI used to capture the contract).)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addFriendly() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addFriendly() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.friendly == null)
|
||||
this.friendly = new ArrayList<Attachment>();
|
||||
this.friendly = new ArrayList<AttachmentType>();
|
||||
this.friendly.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -1933,16 +1933,16 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* @return {@link #legal} (Legal text in Human readable form.)
|
||||
*/
|
||||
public List<Attachment> getLegal() {
|
||||
public List<AttachmentType> getLegal() {
|
||||
if (this.legal == null)
|
||||
this.legal = new ArrayList<Attachment>();
|
||||
this.legal = new ArrayList<AttachmentType>();
|
||||
return this.legal;
|
||||
}
|
||||
|
||||
public boolean hasLegal() {
|
||||
if (this.legal == null)
|
||||
return false;
|
||||
for (Attachment item : this.legal)
|
||||
for (AttachmentType item : this.legal)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -1952,10 +1952,10 @@ public class Contract extends DomainResource {
|
|||
* @return {@link #legal} (Legal text in Human readable form.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addLegal() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addLegal() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.legal == null)
|
||||
this.legal = new ArrayList<Attachment>();
|
||||
this.legal = new ArrayList<AttachmentType>();
|
||||
this.legal.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -2012,16 +2012,16 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* @return {@link #rule} (Computable Policy rules (e.g. XACML, DKAL, SecPal).)
|
||||
*/
|
||||
public List<Attachment> getRule() {
|
||||
public List<AttachmentType> getRule() {
|
||||
if (this.rule == null)
|
||||
this.rule = new ArrayList<Attachment>();
|
||||
this.rule = new ArrayList<AttachmentType>();
|
||||
return this.rule;
|
||||
}
|
||||
|
||||
public boolean hasRule() {
|
||||
if (this.rule == null)
|
||||
return false;
|
||||
for (Attachment item : this.rule)
|
||||
for (AttachmentType item : this.rule)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -2031,10 +2031,10 @@ public class Contract extends DomainResource {
|
|||
* @return {@link #rule} (Computable Policy rules (e.g. XACML, DKAL, SecPal).)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addRule() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addRule() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.rule == null)
|
||||
this.rule = new ArrayList<Attachment>();
|
||||
this.rule = new ArrayList<AttachmentType>();
|
||||
this.rule.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -2200,20 +2200,20 @@ public class Contract extends DomainResource {
|
|||
dst.binding = binding == null ? null : binding.copy();
|
||||
dst.bindingDateTime = bindingDateTime == null ? null : bindingDateTime.copy();
|
||||
if (friendly != null) {
|
||||
dst.friendly = new ArrayList<Attachment>();
|
||||
for (Attachment i : friendly)
|
||||
dst.friendly = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : friendly)
|
||||
dst.friendly.add(i.copy());
|
||||
};
|
||||
dst.friendlyDateTime = friendlyDateTime == null ? null : friendlyDateTime.copy();
|
||||
if (legal != null) {
|
||||
dst.legal = new ArrayList<Attachment>();
|
||||
for (Attachment i : legal)
|
||||
dst.legal = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : legal)
|
||||
dst.legal.add(i.copy());
|
||||
};
|
||||
dst.legalDateTime = legalDateTime == null ? null : legalDateTime.copy();
|
||||
if (rule != null) {
|
||||
dst.rule = new ArrayList<Attachment>();
|
||||
for (Attachment i : rule)
|
||||
dst.rule = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : rule)
|
||||
dst.rule.add(i.copy());
|
||||
};
|
||||
dst.ruleDateTime = ruleDateTime == null ? null : ruleDateTime.copy();
|
||||
|
|
|
@ -517,9 +517,9 @@ public class DiagnosticReport extends DomainResource {
|
|||
/**
|
||||
* Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.
|
||||
*/
|
||||
@Child(name = "presentedForm", type = {Attachment.class}, order = 16, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "presentedForm", type = {AttachmentType.class}, order = 16, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Entire Report as issued", formalDefinition="Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent." )
|
||||
protected List<Attachment> presentedForm;
|
||||
protected List<AttachmentType> presentedForm;
|
||||
|
||||
private static final long serialVersionUID = -1237974006L;
|
||||
|
||||
|
@ -1174,16 +1174,16 @@ public class DiagnosticReport extends DomainResource {
|
|||
/**
|
||||
* @return {@link #presentedForm} (Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.)
|
||||
*/
|
||||
public List<Attachment> getPresentedForm() {
|
||||
public List<AttachmentType> getPresentedForm() {
|
||||
if (this.presentedForm == null)
|
||||
this.presentedForm = new ArrayList<Attachment>();
|
||||
this.presentedForm = new ArrayList<AttachmentType>();
|
||||
return this.presentedForm;
|
||||
}
|
||||
|
||||
public boolean hasPresentedForm() {
|
||||
if (this.presentedForm == null)
|
||||
return false;
|
||||
for (Attachment item : this.presentedForm)
|
||||
for (AttachmentType item : this.presentedForm)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -1193,10 +1193,10 @@ public class DiagnosticReport extends DomainResource {
|
|||
* @return {@link #presentedForm} (Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addPresentedForm() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addPresentedForm() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.presentedForm == null)
|
||||
this.presentedForm = new ArrayList<Attachment>();
|
||||
this.presentedForm = new ArrayList<AttachmentType>();
|
||||
this.presentedForm.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -1266,8 +1266,8 @@ public class DiagnosticReport extends DomainResource {
|
|||
dst.codedDiagnosis.add(i.copy());
|
||||
};
|
||||
if (presentedForm != null) {
|
||||
dst.presentedForm = new ArrayList<Attachment>();
|
||||
for (Attachment i : presentedForm)
|
||||
dst.presentedForm = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : presentedForm)
|
||||
dst.presentedForm.add(i.copy());
|
||||
};
|
||||
return dst;
|
||||
|
|
|
@ -691,9 +691,9 @@ public class DocumentReference extends DomainResource {
|
|||
/**
|
||||
* The document or url to the document along with critical metadata to prove content has integrity.
|
||||
*/
|
||||
@Child(name = "content", type = {Attachment.class}, order = 17, min = 1, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "content", type = {AttachmentType.class}, order = 17, min = 1, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Where to access the document", formalDefinition="The document or url to the document along with critical metadata to prove content has integrity." )
|
||||
protected List<Attachment> content;
|
||||
protected List<AttachmentType> content;
|
||||
|
||||
/**
|
||||
* The clinical context in which the document was prepared.
|
||||
|
@ -1356,16 +1356,16 @@ public class DocumentReference extends DomainResource {
|
|||
/**
|
||||
* @return {@link #content} (The document or url to the document along with critical metadata to prove content has integrity.)
|
||||
*/
|
||||
public List<Attachment> getContent() {
|
||||
public List<AttachmentType> getContent() {
|
||||
if (this.content == null)
|
||||
this.content = new ArrayList<Attachment>();
|
||||
this.content = new ArrayList<AttachmentType>();
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public boolean hasContent() {
|
||||
if (this.content == null)
|
||||
return false;
|
||||
for (Attachment item : this.content)
|
||||
for (AttachmentType item : this.content)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -1375,10 +1375,10 @@ public class DocumentReference extends DomainResource {
|
|||
* @return {@link #content} (The document or url to the document along with critical metadata to prove content has integrity.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addContent() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addContent() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.content == null)
|
||||
this.content = new ArrayList<Attachment>();
|
||||
this.content = new ArrayList<AttachmentType>();
|
||||
this.content.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -1471,8 +1471,8 @@ public class DocumentReference extends DomainResource {
|
|||
dst.confidentiality.add(i.copy());
|
||||
};
|
||||
if (content != null) {
|
||||
dst.content = new ArrayList<Attachment>();
|
||||
for (Attachment i : content)
|
||||
dst.content = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : content)
|
||||
dst.content.add(i.copy());
|
||||
};
|
||||
dst.context = context == null ? null : context.copy();
|
||||
|
|
|
@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
* Primitive type "code" in FHIR, where the code is tied to an enumerated list of possible values
|
||||
*
|
||||
*/
|
||||
@DatatypeDef(name="enumeration")
|
||||
@DatatypeDef(name="code", isSpecialization=true)
|
||||
public class Enumeration<T extends Enum<?>> extends PrimitiveType<T> implements IBaseEnumeration<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -461,9 +461,9 @@ public class Location extends DomainResource {
|
|||
/**
|
||||
* Physical location.
|
||||
*/
|
||||
@Child(name = "address", type = {Address.class}, order = 5, min = 0, max = 1)
|
||||
@Child(name = "address", type = {AddressType.class}, order = 5, min = 0, max = 1)
|
||||
@Description(shortDefinition="Physical location", formalDefinition="Physical location." )
|
||||
protected Address address;
|
||||
protected AddressType address;
|
||||
|
||||
/**
|
||||
* Physical form of the location, e.g. building, room, vehicle, road.
|
||||
|
@ -708,12 +708,12 @@ public class Location extends DomainResource {
|
|||
/**
|
||||
* @return {@link #address} (Physical location.)
|
||||
*/
|
||||
public Address getAddress() {
|
||||
public AddressType getAddress() {
|
||||
if (this.address == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Location.address");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.address = new Address(); // cc
|
||||
this.address = new AddressType(); // cc
|
||||
return this.address;
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ public class Location extends DomainResource {
|
|||
/**
|
||||
* @param value {@link #address} (Physical location.)
|
||||
*/
|
||||
public Location setAddress(Address value) {
|
||||
public Location setAddress(AddressType value) {
|
||||
this.address = value;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -228,9 +228,9 @@ public class Media extends DomainResource {
|
|||
/**
|
||||
* The actual content of the media - inline or by direct reference to the media source file.
|
||||
*/
|
||||
@Child(name = "content", type = {Attachment.class}, order = 12, min = 1, max = 1)
|
||||
@Child(name = "content", type = {AttachmentType.class}, order = 12, min = 1, max = 1)
|
||||
@Description(shortDefinition="Actual Media - reference or data", formalDefinition="The actual content of the media - inline or by direct reference to the media source file." )
|
||||
protected Attachment content;
|
||||
protected AttachmentType content;
|
||||
|
||||
private static final long serialVersionUID = 1930988698L;
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class Media extends DomainResource {
|
|||
super();
|
||||
}
|
||||
|
||||
public Media(Enumeration<MediaType> type, Attachment content) {
|
||||
public Media(Enumeration<MediaType> type, AttachmentType content) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.content = content;
|
||||
|
@ -731,12 +731,12 @@ public class Media extends DomainResource {
|
|||
/**
|
||||
* @return {@link #content} (The actual content of the media - inline or by direct reference to the media source file.)
|
||||
*/
|
||||
public Attachment getContent() {
|
||||
public AttachmentType getContent() {
|
||||
if (this.content == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Media.content");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.content = new Attachment(); // cc
|
||||
this.content = new AttachmentType(); // cc
|
||||
return this.content;
|
||||
}
|
||||
|
||||
|
@ -747,7 +747,7 @@ public class Media extends DomainResource {
|
|||
/**
|
||||
* @param value {@link #content} (The actual content of the media - inline or by direct reference to the media source file.)
|
||||
*/
|
||||
public Media setContent(Attachment value) {
|
||||
public Media setContent(AttachmentType value) {
|
||||
this.content = value;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -1026,7 +1026,7 @@ public class Observation extends DomainResource {
|
|||
/**
|
||||
* The information determined as a result of making the observation, if the information has a simple value.
|
||||
*/
|
||||
@Child(name = "value", type = {Quantity.class, CodeableConcept.class, Attachment.class, Ratio.class, DateTimeType.class, Period.class, SampledData.class, StringType.class, TimeType.class}, order = 1, min = 0, max = 1)
|
||||
@Child(name = "value", type = {Quantity.class, CodeableConcept.class, AttachmentType.class, Ratio.class, DateTimeType.class, Period.class, SampledData.class, StringType.class, TimeType.class}, order = 1, min = 0, max = 1)
|
||||
@Description(shortDefinition="Actual result", formalDefinition="The information determined as a result of making the observation, if the information has a simple value." )
|
||||
protected Type value;
|
||||
|
||||
|
@ -1240,10 +1240,10 @@ other observer (for example a relative or EMT), or any observation made about th
|
|||
/**
|
||||
* @return {@link #value} (The information determined as a result of making the observation, if the information has a simple value.)
|
||||
*/
|
||||
public Attachment getValueAttachment() throws Exception {
|
||||
if (!(this.value instanceof Attachment))
|
||||
public AttachmentType getValueAttachment() throws Exception {
|
||||
if (!(this.value instanceof AttachmentType))
|
||||
throw new Exception("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
|
||||
return (Attachment) this.value;
|
||||
return (AttachmentType) this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -171,9 +171,9 @@ public class Organization extends DomainResource {
|
|||
/**
|
||||
* Visiting or postal addresses for the contact.
|
||||
*/
|
||||
@Child(name="address", type={Address.class}, order=4, min=0, max=1)
|
||||
@Child(name="address", type={AddressType.class}, order=4, min=0, max=1)
|
||||
@Description(shortDefinition="Visiting or postal addresses for the contact", formalDefinition="Visiting or postal addresses for the contact." )
|
||||
protected Address address;
|
||||
protected AddressType address;
|
||||
|
||||
/**
|
||||
* Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
|
||||
|
@ -269,12 +269,12 @@ public class Organization extends DomainResource {
|
|||
/**
|
||||
* @return {@link #address} (Visiting or postal addresses for the contact.)
|
||||
*/
|
||||
public Address getAddress() {
|
||||
public AddressType getAddress() {
|
||||
if (this.address == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create OrganizationContactComponent.address");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.address = new Address(); // cc
|
||||
this.address = new AddressType(); // cc
|
||||
return this.address;
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ public class Organization extends DomainResource {
|
|||
/**
|
||||
* @param value {@link #address} (Visiting or postal addresses for the contact.)
|
||||
*/
|
||||
public OrganizationContactComponent setAddress(Address value) {
|
||||
public OrganizationContactComponent setAddress(AddressType value) {
|
||||
this.address = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -423,9 +423,9 @@ public class Organization extends DomainResource {
|
|||
/**
|
||||
* An address for the organization.
|
||||
*/
|
||||
@Child(name = "address", type = {Address.class}, order = 4, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "address", type = {AddressType.class}, order = 4, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="An address for the organization", formalDefinition="An address for the organization." )
|
||||
protected List<Address> address;
|
||||
protected List<AddressType> address;
|
||||
|
||||
/**
|
||||
* The organization of which this organization forms a part.
|
||||
|
@ -607,16 +607,16 @@ public class Organization extends DomainResource {
|
|||
/**
|
||||
* @return {@link #address} (An address for the organization.)
|
||||
*/
|
||||
public List<Address> getAddress() {
|
||||
public List<AddressType> getAddress() {
|
||||
if (this.address == null)
|
||||
this.address = new ArrayList<Address>();
|
||||
this.address = new ArrayList<AddressType>();
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public boolean hasAddress() {
|
||||
if (this.address == null)
|
||||
return false;
|
||||
for (Address item : this.address)
|
||||
for (AddressType item : this.address)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -626,10 +626,10 @@ public class Organization extends DomainResource {
|
|||
* @return {@link #address} (An address for the organization.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Address addAddress() { //3
|
||||
Address t = new Address();
|
||||
public AddressType addAddress() { //3
|
||||
AddressType t = new AddressType();
|
||||
if (this.address == null)
|
||||
this.address = new ArrayList<Address>();
|
||||
this.address = new ArrayList<AddressType>();
|
||||
this.address.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -833,8 +833,8 @@ public class Organization extends DomainResource {
|
|||
dst.telecom.add(i.copy());
|
||||
};
|
||||
if (address != null) {
|
||||
dst.address = new ArrayList<Address>();
|
||||
for (Address i : address)
|
||||
dst.address = new ArrayList<AddressType>();
|
||||
for (AddressType i : address)
|
||||
dst.address.add(i.copy());
|
||||
};
|
||||
dst.partOf = partOf == null ? null : partOf.copy();
|
||||
|
|
|
@ -258,9 +258,9 @@ public class Patient extends DomainResource {
|
|||
/**
|
||||
* Address for the contact person.
|
||||
*/
|
||||
@Child(name="address", type={Address.class}, order=4, min=0, max=1)
|
||||
@Child(name="address", type={AddressType.class}, order=4, min=0, max=1)
|
||||
@Description(shortDefinition="Address for the contact person", formalDefinition="Address for the contact person." )
|
||||
protected Address address;
|
||||
protected AddressType address;
|
||||
|
||||
/**
|
||||
* Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
|
||||
|
@ -381,12 +381,12 @@ public class Patient extends DomainResource {
|
|||
/**
|
||||
* @return {@link #address} (Address for the contact person.)
|
||||
*/
|
||||
public Address getAddress() {
|
||||
public AddressType getAddress() {
|
||||
if (this.address == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create ContactComponent.address");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.address = new Address(); // cc
|
||||
this.address = new AddressType(); // cc
|
||||
return this.address;
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ public class Patient extends DomainResource {
|
|||
/**
|
||||
* @param value {@link #address} (Address for the contact person.)
|
||||
*/
|
||||
public ContactComponent setAddress(Address value) {
|
||||
public ContactComponent setAddress(AddressType value) {
|
||||
this.address = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -940,9 +940,9 @@ public class Patient extends DomainResource {
|
|||
/**
|
||||
* Addresses for the individual.
|
||||
*/
|
||||
@Child(name = "address", type = {Address.class}, order = 6, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "address", type = {AddressType.class}, order = 6, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Addresses for the individual", formalDefinition="Addresses for the individual." )
|
||||
protected List<Address> address;
|
||||
protected List<AddressType> address;
|
||||
|
||||
/**
|
||||
* This field contains a patient's most recent marital (civil) status.
|
||||
|
@ -961,9 +961,9 @@ public class Patient extends DomainResource {
|
|||
/**
|
||||
* Image of the person.
|
||||
*/
|
||||
@Child(name = "photo", type = {Attachment.class}, order = 9, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "photo", type = {AttachmentType.class}, order = 9, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Image of the person", formalDefinition="Image of the person." )
|
||||
protected List<Attachment> photo;
|
||||
protected List<AttachmentType> photo;
|
||||
|
||||
/**
|
||||
* A contact party (e.g. guardian, partner, friend) for the patient.
|
||||
|
@ -1258,16 +1258,16 @@ public class Patient extends DomainResource {
|
|||
/**
|
||||
* @return {@link #address} (Addresses for the individual.)
|
||||
*/
|
||||
public List<Address> getAddress() {
|
||||
public List<AddressType> getAddress() {
|
||||
if (this.address == null)
|
||||
this.address = new ArrayList<Address>();
|
||||
this.address = new ArrayList<AddressType>();
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public boolean hasAddress() {
|
||||
if (this.address == null)
|
||||
return false;
|
||||
for (Address item : this.address)
|
||||
for (AddressType item : this.address)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -1277,10 +1277,10 @@ public class Patient extends DomainResource {
|
|||
* @return {@link #address} (Addresses for the individual.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Address addAddress() { //3
|
||||
Address t = new Address();
|
||||
public AddressType addAddress() { //3
|
||||
AddressType t = new AddressType();
|
||||
if (this.address == null)
|
||||
this.address = new ArrayList<Address>();
|
||||
this.address = new ArrayList<AddressType>();
|
||||
this.address.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -1349,16 +1349,16 @@ public class Patient extends DomainResource {
|
|||
/**
|
||||
* @return {@link #photo} (Image of the person.)
|
||||
*/
|
||||
public List<Attachment> getPhoto() {
|
||||
public List<AttachmentType> getPhoto() {
|
||||
if (this.photo == null)
|
||||
this.photo = new ArrayList<Attachment>();
|
||||
this.photo = new ArrayList<AttachmentType>();
|
||||
return this.photo;
|
||||
}
|
||||
|
||||
public boolean hasPhoto() {
|
||||
if (this.photo == null)
|
||||
return false;
|
||||
for (Attachment item : this.photo)
|
||||
for (AttachmentType item : this.photo)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -1368,10 +1368,10 @@ public class Patient extends DomainResource {
|
|||
* @return {@link #photo} (Image of the person.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addPhoto() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addPhoto() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.photo == null)
|
||||
this.photo = new ArrayList<Attachment>();
|
||||
this.photo = new ArrayList<AttachmentType>();
|
||||
this.photo.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -1661,15 +1661,15 @@ public class Patient extends DomainResource {
|
|||
dst.birthDate = birthDate == null ? null : birthDate.copy();
|
||||
dst.deceased = deceased == null ? null : deceased.copy();
|
||||
if (address != null) {
|
||||
dst.address = new ArrayList<Address>();
|
||||
for (Address i : address)
|
||||
dst.address = new ArrayList<AddressType>();
|
||||
for (AddressType i : address)
|
||||
dst.address.add(i.copy());
|
||||
};
|
||||
dst.maritalStatus = maritalStatus == null ? null : maritalStatus.copy();
|
||||
dst.multipleBirth = multipleBirth == null ? null : multipleBirth.copy();
|
||||
if (photo != null) {
|
||||
dst.photo = new ArrayList<Attachment>();
|
||||
for (Attachment i : photo)
|
||||
dst.photo = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : photo)
|
||||
dst.photo.add(i.copy());
|
||||
};
|
||||
if (contact != null) {
|
||||
|
|
|
@ -444,16 +444,16 @@ public class Person extends DomainResource {
|
|||
/**
|
||||
* One or more addresses for the person.
|
||||
*/
|
||||
@Child(name = "address", type = {Address.class}, order = 5, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "address", type = {AddressType.class}, order = 5, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="One or more addresses for the person", formalDefinition="One or more addresses for the person." )
|
||||
protected List<Address> address;
|
||||
protected List<AddressType> address;
|
||||
|
||||
/**
|
||||
* An image that can be displayed as a thumbnail of the person to enhance the identification of the individual.
|
||||
*/
|
||||
@Child(name = "photo", type = {Attachment.class}, order = 6, min = 0, max = 1)
|
||||
@Child(name = "photo", type = {AttachmentType.class}, order = 6, min = 0, max = 1)
|
||||
@Description(shortDefinition="Image of the Person", formalDefinition="An image that can be displayed as a thumbnail of the person to enhance the identification of the individual." )
|
||||
protected Attachment photo;
|
||||
protected AttachmentType photo;
|
||||
|
||||
/**
|
||||
* The Organization that is the custodian of the person record.
|
||||
|
@ -678,16 +678,16 @@ public class Person extends DomainResource {
|
|||
/**
|
||||
* @return {@link #address} (One or more addresses for the person.)
|
||||
*/
|
||||
public List<Address> getAddress() {
|
||||
public List<AddressType> getAddress() {
|
||||
if (this.address == null)
|
||||
this.address = new ArrayList<Address>();
|
||||
this.address = new ArrayList<AddressType>();
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public boolean hasAddress() {
|
||||
if (this.address == null)
|
||||
return false;
|
||||
for (Address item : this.address)
|
||||
for (AddressType item : this.address)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -697,10 +697,10 @@ public class Person extends DomainResource {
|
|||
* @return {@link #address} (One or more addresses for the person.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Address addAddress() { //3
|
||||
Address t = new Address();
|
||||
public AddressType addAddress() { //3
|
||||
AddressType t = new AddressType();
|
||||
if (this.address == null)
|
||||
this.address = new ArrayList<Address>();
|
||||
this.address = new ArrayList<AddressType>();
|
||||
this.address.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -708,12 +708,12 @@ public class Person extends DomainResource {
|
|||
/**
|
||||
* @return {@link #photo} (An image that can be displayed as a thumbnail of the person to enhance the identification of the individual.)
|
||||
*/
|
||||
public Attachment getPhoto() {
|
||||
public AttachmentType getPhoto() {
|
||||
if (this.photo == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Person.photo");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.photo = new Attachment(); // cc
|
||||
this.photo = new AttachmentType(); // cc
|
||||
return this.photo;
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ public class Person extends DomainResource {
|
|||
/**
|
||||
* @param value {@link #photo} (An image that can be displayed as a thumbnail of the person to enhance the identification of the individual.)
|
||||
*/
|
||||
public Person setPhoto(Attachment value) {
|
||||
public Person setPhoto(AttachmentType value) {
|
||||
this.photo = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -883,8 +883,8 @@ public class Person extends DomainResource {
|
|||
dst.gender = gender == null ? null : gender.copy();
|
||||
dst.birthDate = birthDate == null ? null : birthDate.copy();
|
||||
if (address != null) {
|
||||
dst.address = new ArrayList<Address>();
|
||||
for (Address i : address)
|
||||
dst.address = new ArrayList<AddressType>();
|
||||
for (AddressType i : address)
|
||||
dst.address.add(i.copy());
|
||||
};
|
||||
dst.photo = photo == null ? null : photo.copy();
|
||||
|
|
|
@ -745,9 +745,9 @@ public class Practitioner extends DomainResource {
|
|||
/**
|
||||
* The postal address where the practitioner can be found or visited or to which mail can be delivered.
|
||||
*/
|
||||
@Child(name = "address", type = {Address.class}, order = 3, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "address", type = {AddressType.class}, order = 3, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Where practitioner can be found/visited", formalDefinition="The postal address where the practitioner can be found or visited or to which mail can be delivered." )
|
||||
protected List<Address> address;
|
||||
protected List<AddressType> address;
|
||||
|
||||
/**
|
||||
* Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.
|
||||
|
@ -766,9 +766,9 @@ public class Practitioner extends DomainResource {
|
|||
/**
|
||||
* Image of the person.
|
||||
*/
|
||||
@Child(name = "photo", type = {Attachment.class}, order = 6, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "photo", type = {AttachmentType.class}, order = 6, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition = "Image of the person", formalDefinition = "Image of the person.")
|
||||
protected List<Attachment> photo;
|
||||
protected List<AttachmentType> photo;
|
||||
|
||||
/**
|
||||
* The list of Roles/Organizations that the Practitioner is associated with.
|
||||
|
@ -884,16 +884,16 @@ public class Practitioner extends DomainResource {
|
|||
/**
|
||||
* @return {@link #address} (The postal address where the practitioner can be found or visited or to which mail can be delivered.)
|
||||
*/
|
||||
public List<Address> getAddress() {
|
||||
public List<AddressType> getAddress() {
|
||||
if (this.address == null)
|
||||
this.address = new ArrayList<Address>();
|
||||
this.address = new ArrayList<AddressType>();
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public boolean hasAddress() {
|
||||
if (this.address == null)
|
||||
return false;
|
||||
for (Address item : this.address)
|
||||
for (AddressType item : this.address)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -903,10 +903,10 @@ public class Practitioner extends DomainResource {
|
|||
* @return {@link #address} (The postal address where the practitioner can be found or visited or to which mail can be delivered.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Address addAddress() { //3
|
||||
Address t = new Address();
|
||||
public AddressType addAddress() { //3
|
||||
AddressType t = new AddressType();
|
||||
if (this.address == null)
|
||||
this.address = new ArrayList<Address>();
|
||||
this.address = new ArrayList<AddressType>();
|
||||
this.address.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -1012,16 +1012,16 @@ public class Practitioner extends DomainResource {
|
|||
/**
|
||||
* @return {@link #photo} (Image of the person.)
|
||||
*/
|
||||
public List<Attachment> getPhoto() {
|
||||
public List<AttachmentType> getPhoto() {
|
||||
if (this.photo == null)
|
||||
this.photo = new ArrayList<Attachment>();
|
||||
this.photo = new ArrayList<AttachmentType>();
|
||||
return this.photo;
|
||||
}
|
||||
|
||||
public boolean hasPhoto() {
|
||||
if (this.photo == null)
|
||||
return false;
|
||||
for (Attachment item : this.photo)
|
||||
for (AttachmentType item : this.photo)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -1031,10 +1031,10 @@ public class Practitioner extends DomainResource {
|
|||
* @return {@link #photo} (Image of the person.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addPhoto() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addPhoto() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.photo == null)
|
||||
this.photo = new ArrayList<Attachment>();
|
||||
this.photo = new ArrayList<AttachmentType>();
|
||||
this.photo.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -1158,15 +1158,15 @@ public class Practitioner extends DomainResource {
|
|||
dst.telecom.add(i.copy());
|
||||
};
|
||||
if (address != null) {
|
||||
dst.address = new ArrayList<Address>();
|
||||
for (Address i : address)
|
||||
dst.address = new ArrayList<AddressType>();
|
||||
for (AddressType i : address)
|
||||
dst.address.add(i.copy());
|
||||
};
|
||||
dst.gender = gender == null ? null : gender.copy();
|
||||
dst.birthDate = birthDate == null ? null : birthDate.copy();
|
||||
if (photo != null) {
|
||||
dst.photo = new ArrayList<Attachment>();
|
||||
for (Attachment i : photo)
|
||||
dst.photo = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : photo)
|
||||
dst.photo.add(i.copy());
|
||||
}
|
||||
;
|
||||
|
|
|
@ -746,7 +746,7 @@ public class QuestionnaireAnswers extends DomainResource {
|
|||
/**
|
||||
* The answer (or one of the answers) provided by the respondant to the question.
|
||||
*/
|
||||
@Child(name = "value", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, InstantType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class, Quantity.class}, order = 1, min = 0, max = 1)
|
||||
@Child(name = "value", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, InstantType.class, TimeType.class, StringType.class, UriType.class, AttachmentType.class, Coding.class, Quantity.class}, order = 1, min = 0, max = 1)
|
||||
@Description(shortDefinition = "Single-valued answer to the question", formalDefinition = "The answer (or one of the answers) provided by the respondant to the question.")
|
||||
protected Type value;
|
||||
|
||||
|
@ -847,10 +847,10 @@ public class QuestionnaireAnswers extends DomainResource {
|
|||
/**
|
||||
* @return {@link #value} (The answer (or one of the answers) provided by the respondant to the question.)
|
||||
*/
|
||||
public Attachment getValueAttachment() throws Exception {
|
||||
if (!(this.value instanceof Attachment))
|
||||
public AttachmentType getValueAttachment() throws Exception {
|
||||
if (!(this.value instanceof AttachmentType))
|
||||
throw new Exception("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
|
||||
return (Attachment) this.value;
|
||||
return (AttachmentType) this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -195,16 +195,16 @@ public class RelatedPerson extends DomainResource {
|
|||
/**
|
||||
* Address where the related person can be contacted or visited.
|
||||
*/
|
||||
@Child(name = "address", type = {Address.class}, order = 6, min = 0, max = 1)
|
||||
@Child(name = "address", type = {AddressType.class}, order = 6, min = 0, max = 1)
|
||||
@Description(shortDefinition="Address where the related person can be contacted or visited", formalDefinition="Address where the related person can be contacted or visited." )
|
||||
protected Address address;
|
||||
protected AddressType address;
|
||||
|
||||
/**
|
||||
* Image of the person.
|
||||
*/
|
||||
@Child(name = "photo", type = {Attachment.class}, order = 7, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Child(name = "photo", type = {AttachmentType.class}, order = 7, min = 0, max = Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Image of the person", formalDefinition="Image of the person." )
|
||||
protected List<Attachment> photo;
|
||||
protected List<AttachmentType> photo;
|
||||
|
||||
/**
|
||||
* The period of time that this relationship is considered to be valid. If there are no dates defined, then the interval is unknown.
|
||||
|
@ -428,12 +428,12 @@ public class RelatedPerson extends DomainResource {
|
|||
/**
|
||||
* @return {@link #address} (Address where the related person can be contacted or visited.)
|
||||
*/
|
||||
public Address getAddress() {
|
||||
public AddressType getAddress() {
|
||||
if (this.address == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create RelatedPerson.address");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.address = new Address(); // cc
|
||||
this.address = new AddressType(); // cc
|
||||
return this.address;
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ public class RelatedPerson extends DomainResource {
|
|||
/**
|
||||
* @param value {@link #address} (Address where the related person can be contacted or visited.)
|
||||
*/
|
||||
public RelatedPerson setAddress(Address value) {
|
||||
public RelatedPerson setAddress(AddressType value) {
|
||||
this.address = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -452,16 +452,16 @@ public class RelatedPerson extends DomainResource {
|
|||
/**
|
||||
* @return {@link #photo} (Image of the person.)
|
||||
*/
|
||||
public List<Attachment> getPhoto() {
|
||||
public List<AttachmentType> getPhoto() {
|
||||
if (this.photo == null)
|
||||
this.photo = new ArrayList<Attachment>();
|
||||
this.photo = new ArrayList<AttachmentType>();
|
||||
return this.photo;
|
||||
}
|
||||
|
||||
public boolean hasPhoto() {
|
||||
if (this.photo == null)
|
||||
return false;
|
||||
for (Attachment item : this.photo)
|
||||
for (AttachmentType item : this.photo)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
|
@ -471,10 +471,10 @@ public class RelatedPerson extends DomainResource {
|
|||
* @return {@link #photo} (Image of the person.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Attachment addPhoto() { //3
|
||||
Attachment t = new Attachment();
|
||||
public AttachmentType addPhoto() { //3
|
||||
AttachmentType t = new AttachmentType();
|
||||
if (this.photo == null)
|
||||
this.photo = new ArrayList<Attachment>();
|
||||
this.photo = new ArrayList<AttachmentType>();
|
||||
this.photo.add(t);
|
||||
return t;
|
||||
}
|
||||
|
@ -535,8 +535,8 @@ public class RelatedPerson extends DomainResource {
|
|||
dst.gender = gender == null ? null : gender.copy();
|
||||
dst.address = address == null ? null : address.copy();
|
||||
if (photo != null) {
|
||||
dst.photo = new ArrayList<Attachment>();
|
||||
for (Attachment i : photo)
|
||||
dst.photo = new ArrayList<AttachmentType>();
|
||||
for (AttachmentType i : photo)
|
||||
dst.photo.add(i.copy());
|
||||
};
|
||||
dst.period = period == null ? null : period.copy();
|
||||
|
|
|
@ -208,7 +208,7 @@ public class ResourceFactory extends Factory {
|
|||
if ("Meta".equals(name))
|
||||
return new Meta();
|
||||
if ("Address".equals(name))
|
||||
return new Address();
|
||||
return new AddressType();
|
||||
if ("Reference".equals(name))
|
||||
return new Reference();
|
||||
if ("Quantity".equals(name))
|
||||
|
@ -216,7 +216,7 @@ public class ResourceFactory extends Factory {
|
|||
if ("Period".equals(name))
|
||||
return new Period();
|
||||
if ("Attachment".equals(name))
|
||||
return new Attachment();
|
||||
return new AttachmentType();
|
||||
if ("Duration".equals(name))
|
||||
return new Duration();
|
||||
if ("Count".equals(name))
|
||||
|
|
|
@ -125,4 +125,6 @@ datatype.time=org.hl7.fhir.instance.model.TimeType
|
|||
datatype.unsignedInt=org.hl7.fhir.instance.model.UnsignedIntType
|
||||
datatype.uri=org.hl7.fhir.instance.model.UriType
|
||||
datatype.xhtml=org.hl7.fhir.instance.model.XhtmlType
|
||||
|
||||
datatype.reference=org.hl7.fhir.instance.model.Reference
|
||||
datatype.enumeration=org.hl7.fhir.instance.model.Enumeration
|
|
@ -1,8 +1,12 @@
|
|||
package ca.uhn.fhir.model;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.hl7.fhir.instance.model.Address;
|
||||
import org.hl7.fhir.instance.model.AddressType;
|
||||
import org.hl7.fhir.instance.model.BackboneElement;
|
||||
import org.hl7.fhir.instance.model.Base;
|
||||
import org.hl7.fhir.instance.model.Binary;
|
||||
|
@ -32,11 +36,12 @@ import org.hl7.fhir.instance.model.Timing;
|
|||
import org.hl7.fhir.instance.model.Type;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
import org.hl7.fhir.instance.model.annotations.Child;
|
||||
import org.hl7.fhir.instance.model.api.IRiResource;
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.api.IBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseCoding;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDecimalDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
|
||||
|
@ -45,18 +50,21 @@ import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
|||
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseParameters;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseXhtml;
|
||||
import org.hl7.fhir.instance.model.api.IBaseCoding;
|
||||
import org.hl7.fhir.instance.model.api.IDatatypeElement;
|
||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IMetaType;
|
||||
import org.hl7.fhir.instance.model.api.INarrative;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IRiResource;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
|
||||
|
||||
public class ModelInheritanceTest {
|
||||
/*
|
||||
|
@ -82,6 +90,20 @@ public class ModelInheritanceTest {
|
|||
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
|
||||
@Test
|
||||
public void testDatatypeNames() {
|
||||
for (BaseRuntimeElementDefinition<?> next : ourCtx.getElementDefinitions()) {
|
||||
if (next instanceof BaseRuntimeElementCompositeDefinition || next instanceof RuntimePrimitiveDatatypeDefinition) {
|
||||
String name = next.getImplementingClass().getName();
|
||||
if (name.endsWith(".Enumeration")) {
|
||||
continue;
|
||||
}
|
||||
assertThat(name, endsWith("Type"));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testList() {
|
||||
assertEquals("List", ourCtx.getResourceDefinition(List_.class).getName());
|
||||
|
@ -92,7 +114,7 @@ public class ModelInheritanceTest {
|
|||
*/
|
||||
@Test
|
||||
public void testAddress() {
|
||||
assertTrue(ICompositeType.class.isAssignableFrom(Address.class));
|
||||
assertTrue(ICompositeType.class.isAssignableFrom(AddressType.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -155,6 +177,9 @@ public class ModelInheritanceTest {
|
|||
@Test
|
||||
public void testEnumeration() {
|
||||
assertTrue(IBaseEnumeration.class.isAssignableFrom(Enumeration.class));
|
||||
|
||||
DatatypeDef def = Enumeration.class.getAnnotation(DatatypeDef.class);
|
||||
assertTrue(def.isSpecialization());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,258 +0,0 @@
|
|||
package ca.uhn.fhir.parser;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.hl7.fhir.instance.model.CodeableConcept;
|
||||
import org.hl7.fhir.instance.model.Composition;
|
||||
import org.hl7.fhir.instance.model.Condition;
|
||||
import org.hl7.fhir.instance.model.Condition.ConditionStatus;
|
||||
import org.hl7.fhir.instance.model.DiagnosticReport;
|
||||
import org.hl7.fhir.instance.model.HumanName;
|
||||
import org.hl7.fhir.instance.model.HumanName.NameUse;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.Observation;
|
||||
import org.hl7.fhir.instance.model.Patient;
|
||||
import org.hl7.fhir.instance.model.Patient.AdministrativeGender;
|
||||
import org.hl7.fhir.instance.model.Practitioner;
|
||||
import org.hl7.fhir.instance.model.Reference;
|
||||
import org.hl7.fhir.instance.model.api.IRiResource;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
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.Include;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.rest.server.BundleInclusionRule;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.rest.server.provider.dstu2hl7org.Dstu2Hl7OrgBundleFactory;
|
||||
|
||||
/**
|
||||
* Initially contributed by Alexander Kley for bug #29
|
||||
*/
|
||||
public class ContainedResourceEncodingTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ContainedResourceEncodingTest.class);
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ContainedResourceEncodingTest.class);
|
||||
|
||||
private Practitioner author;
|
||||
|
||||
private Composition comp;
|
||||
|
||||
private FhirContext ctx;
|
||||
|
||||
private final String patFamName1 = "FirstFamilyName";
|
||||
|
||||
private final String patGivName1 = "FirstGivenName";
|
||||
|
||||
private Patient patient;
|
||||
|
||||
private void initAuthor() {
|
||||
this.author = new Practitioner();
|
||||
this.author.setId((UUID.randomUUID().toString()));
|
||||
this.author.addIdentifier().setSystem("DoctorID").setValue("4711");
|
||||
this.author.addPractitionerRole().getRole().addCoding().setCode("doctor");
|
||||
this.author.setName(new HumanName().addFamily("Mueller").addGiven("Klaus").addPrefix("Prof. Dr."));
|
||||
|
||||
}
|
||||
|
||||
private void initComposition() {
|
||||
// new ConditionList
|
||||
|
||||
final Condition c = new Condition();
|
||||
c.setId(UUID.randomUUID().toString());
|
||||
c.setNotes("This is a note");
|
||||
c.setSubject(new Reference(this.patient));
|
||||
CodeableConcept cc = new CodeableConcept();
|
||||
cc.addCoding().setSystem("mySystem").setCode("theCode");
|
||||
c.setCode(cc);
|
||||
c.setStatus(ConditionStatus.CONFIRMED);
|
||||
|
||||
// new General Note Section
|
||||
final Composition.SectionComponent generalNoteSection = new Composition.SectionComponent();
|
||||
generalNoteSection.setId("Note");
|
||||
generalNoteSection.setTitle("Note");
|
||||
generalNoteSection.setContent(new Reference(c));
|
||||
|
||||
// new SectionList
|
||||
final List<Composition.SectionComponent> sectionList = new ArrayList<Composition.SectionComponent>();
|
||||
sectionList.add(generalNoteSection);
|
||||
|
||||
// fill composition
|
||||
this.comp = new Composition();
|
||||
this.comp.addAuthor().setResource(this.author);
|
||||
this.comp.setSubject(new Reference(this.patient));
|
||||
this.comp.getSection().addAll(sectionList);
|
||||
}
|
||||
|
||||
private void initPatient() {
|
||||
this.patient = new Patient();
|
||||
this.patient.setId((UUID.randomUUID().toString()));
|
||||
this.patient.addIdentifier().setSystem("http://example.com/fictitious-mrns").setValue("MRN001");
|
||||
this.patient.setGender(AdministrativeGender.MALE);
|
||||
this.patient.addName().setUse(NameUse.OFFICIAL).addFamily(this.patFamName1).addGiven(this.patGivName1);
|
||||
|
||||
}
|
||||
|
||||
@Before
|
||||
public void initTest() {
|
||||
logger.info("[initTest]");
|
||||
|
||||
initPatient();
|
||||
initAuthor();
|
||||
initComposition();
|
||||
this.ctx = new FhirContext();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBundleWithContained() {
|
||||
|
||||
DiagnosticReport dr = new DiagnosticReport();
|
||||
dr.setId(("123"));
|
||||
|
||||
Observation observation = new Observation();
|
||||
|
||||
CodeableConcept obsName = new CodeableConcept();
|
||||
obsName.setText("name");
|
||||
observation.setCode(obsName);
|
||||
|
||||
Reference result = dr.addResult();
|
||||
result.setResource(observation);
|
||||
|
||||
ArrayList<Reference> performers = new ArrayList<Reference>();
|
||||
Reference performer = new Reference();
|
||||
|
||||
Practitioner p = new Practitioner();
|
||||
p.setId((UUID.randomUUID().toString()));
|
||||
p.addIdentifier().setSystem("DoctorID").setValue("4711");
|
||||
p.addPractitionerRole().getRole().setText("Doctor");
|
||||
p.setName(new HumanName().addFamily("Mueller").addGiven("Klaus").addPrefix("Prof. Dr."));
|
||||
|
||||
performer.setResource(p);
|
||||
performers.add(performer);
|
||||
observation.getPerformer().addAll(performers);
|
||||
|
||||
List<IBaseResource> list = new ArrayList<IBaseResource>();
|
||||
list.add(dr);
|
||||
|
||||
Dstu2Hl7OrgBundleFactory builder = new Dstu2Hl7OrgBundleFactory(ctx);
|
||||
Set<Include> inc2 = Collections.emptySet();
|
||||
builder.addResourcesToBundle(list, BundleTypeEnum.TRANSACTION, "http://foo", BundleInclusionRule.BASED_ON_RESOURCE_PRESENCE, inc2);
|
||||
IBaseResource bundle = builder.getResourceBundle();
|
||||
|
||||
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||
String xml = parser.encodeResourceToString(bundle);
|
||||
ourLog.info(xml);
|
||||
Assert.assertTrue(xml.contains("Mueller"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBundleWithContainedWithNoIdDt() {
|
||||
|
||||
DiagnosticReport dr = new DiagnosticReport();
|
||||
dr.setId("123");
|
||||
|
||||
Observation observation = new Observation();
|
||||
|
||||
CodeableConcept obsName = new CodeableConcept();
|
||||
obsName.setText("name");
|
||||
observation.setCode(obsName);
|
||||
|
||||
Reference result = dr.addResult();
|
||||
result.setResource(observation);
|
||||
|
||||
ArrayList<Reference> performers = new ArrayList<Reference>();
|
||||
Reference performer = new Reference();
|
||||
|
||||
Practitioner p = new Practitioner();
|
||||
// no idDt on practitioner p
|
||||
p.addIdentifier().setSystem("DoctorID").setValue("4711");
|
||||
p.addPractitionerRole().getRole().setText("Doctor");
|
||||
p.setName(new HumanName().addFamily("Mueller").addGiven("Klaus").addPrefix("Prof. Dr."));
|
||||
|
||||
performer.setResource(p);
|
||||
performers.add(performer);
|
||||
observation.getPerformer().addAll(performers);
|
||||
|
||||
List<IBaseResource> list = new ArrayList<IBaseResource>();
|
||||
list.add(dr);
|
||||
|
||||
Dstu2Hl7OrgBundleFactory builder = new Dstu2Hl7OrgBundleFactory(ctx);
|
||||
Set<Include> inc2 = Collections.emptySet();
|
||||
builder.addResourcesToBundle(list, BundleTypeEnum.TRANSACTION, "http://foo", BundleInclusionRule.BASED_ON_RESOURCE_PRESENCE, inc2);
|
||||
IBaseResource bundle = builder.getResourceBundle();
|
||||
|
||||
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||
String xml = parser.encodeResourceToString(bundle);
|
||||
Assert.assertTrue(xml.contains("Mueller"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComposition() {
|
||||
|
||||
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||
|
||||
assertEquals(0, this.comp.getContained().size());
|
||||
|
||||
/**
|
||||
* This doesn't works, secund encoding creates corrupt xml
|
||||
*/
|
||||
final String expectedCompXml = parser.encodeResourceToString(this.comp);
|
||||
logger.debug("[xmlEncoding] first encoding: {}", expectedCompXml);
|
||||
|
||||
assertEquals(0, this.comp.getContained().size());
|
||||
|
||||
final String actualCompXml = parser.encodeResourceToString(this.comp);
|
||||
|
||||
assertEquals(0, this.comp.getContained().size());
|
||||
|
||||
// second encoding - xml could not be parsed back to compositon - i.e.: patient content 4 times! should be the same
|
||||
// as after first encoding!
|
||||
logger.debug("[xmlEncoding] second encoding: {}", actualCompXml);
|
||||
|
||||
final String thirdCompXml = parser.encodeResourceToString(this.comp);
|
||||
|
||||
assertEquals(0, this.comp.getContained().size());
|
||||
|
||||
// third encoding - xml could not be parsed back to compositon i.e.: patient content 4 times! should be the same as
|
||||
// afterfirst encoding!
|
||||
logger.debug("[xmlEncoding] third encoding: {}", thirdCompXml);
|
||||
|
||||
Assert.assertEquals(expectedCompXml.length(), actualCompXml.length());
|
||||
Assert.assertArrayEquals(expectedCompXml.getBytes(), actualCompXml.getBytes());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPatient() {
|
||||
logger.debug("[xmlEncoding] encode resource to xml.");
|
||||
|
||||
/**
|
||||
* This works fine, although patient instance is modifing from encoder
|
||||
*/
|
||||
final String expectedPatientXml = this.ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(this.patient);
|
||||
logger.debug("[xmlEncoding] first encoding: {}", expectedPatientXml);
|
||||
final String actualPatientXml = this.ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(this.patient);
|
||||
// second encoding - xml is corrupt - i.e.: patient content 4 times! should be the same as after first encoding!
|
||||
logger.debug("[xmlEncoding] second encoding: {}", actualPatientXml);
|
||||
|
||||
Assert.assertEquals(expectedPatientXml.length(), actualPatientXml.length());
|
||||
Assert.assertArrayEquals(expectedPatientXml.getBytes(), actualPatientXml.getBytes());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -27,8 +27,8 @@ import org.custommonkey.xmlunit.Diff;
|
|||
import org.hamcrest.core.IsNot;
|
||||
import org.hamcrest.core.StringContains;
|
||||
import org.hamcrest.text.StringContainsInOrder;
|
||||
import org.hl7.fhir.instance.model.Address;
|
||||
import org.hl7.fhir.instance.model.Address.AddressUse;
|
||||
import org.hl7.fhir.instance.model.AddressType;
|
||||
import org.hl7.fhir.instance.model.AddressType.AddressUse;
|
||||
import org.hl7.fhir.instance.model.Binary;
|
||||
import org.hl7.fhir.instance.model.Bundle;
|
||||
import org.hl7.fhir.instance.model.Bundle.BundleEntryComponent;
|
||||
|
@ -37,6 +37,7 @@ import org.hl7.fhir.instance.model.DateTimeType;
|
|||
import org.hl7.fhir.instance.model.DateType;
|
||||
import org.hl7.fhir.instance.model.DecimalType;
|
||||
import org.hl7.fhir.instance.model.DiagnosticReport;
|
||||
import org.hl7.fhir.instance.model.Enumeration;
|
||||
import org.hl7.fhir.instance.model.Extension;
|
||||
import org.hl7.fhir.instance.model.HumanName;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
@ -456,7 +457,7 @@ public class JsonParserHl7OrgTest {
|
|||
|
||||
MyPatientWithOneDeclaredAddressExtension patient = new MyPatientWithOneDeclaredAddressExtension();
|
||||
patient.addAddress().setUse(AddressUse.HOME);
|
||||
patient.setFoo(new Address().addLine("line1"));
|
||||
patient.setFoo(new AddressType().addLine("line1"));
|
||||
|
||||
String val = parser.encodeResourceToString(patient);
|
||||
ourLog.info(val);
|
||||
|
@ -464,7 +465,7 @@ public class JsonParserHl7OrgTest {
|
|||
|
||||
MyPatientWithOneDeclaredAddressExtension actual = parser.parseResource(MyPatientWithOneDeclaredAddressExtension.class, val);
|
||||
assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse());
|
||||
Address ref = actual.getFoo();
|
||||
AddressType ref = actual.getFoo();
|
||||
assertEquals("line1", ref.getLine().get(0).getValue());
|
||||
|
||||
}
|
||||
|
@ -721,7 +722,7 @@ public class JsonParserHl7OrgTest {
|
|||
|
||||
Patient patient = new Patient();
|
||||
patient.addAddress().setUse(AddressUse.HOME);
|
||||
patient.addExtension().setUrl("urn:foo").setValue(new Address().addLine("line1"));
|
||||
patient.addExtension().setUrl("urn:foo").setValue(new AddressType().addLine("line1"));
|
||||
|
||||
String val = parser.encodeResourceToString(patient);
|
||||
ourLog.info(val);
|
||||
|
@ -729,7 +730,7 @@ public class JsonParserHl7OrgTest {
|
|||
|
||||
MyPatientWithOneDeclaredAddressExtension actual = parser.parseResource(MyPatientWithOneDeclaredAddressExtension.class, val);
|
||||
assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse());
|
||||
Address ref = actual.getFoo();
|
||||
AddressType ref = actual.getFoo();
|
||||
assertEquals("line1", ref.getLine().get(0).getValue());
|
||||
|
||||
}
|
||||
|
@ -1245,13 +1246,32 @@ public class JsonParserHl7OrgTest {
|
|||
|
||||
@Child(order = 0, name = "foo")
|
||||
@org.hl7.fhir.instance.model.annotations.Extension(url = "urn:foo", definedLocally = true, isModifier = false)
|
||||
private Address myFoo;
|
||||
private AddressType myFoo;
|
||||
|
||||
public Address getFoo() {
|
||||
public AddressType getFoo() {
|
||||
return myFoo;
|
||||
}
|
||||
|
||||
public void setFoo(Address theFoo) {
|
||||
public void setFoo(AddressType theFoo) {
|
||||
myFoo = theFoo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ResourceDef(name = "Patient")
|
||||
public static class MyPatientWithOneDeclaredEnumerationExtension extends Patient {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Child(order = 0, name = "foo")
|
||||
@org.hl7.fhir.instance.model.annotations.Extension(url = "urn:foo", definedLocally = true, isModifier = false)
|
||||
private Enumeration<AddressUse> myFoo;
|
||||
|
||||
public Enumeration<AddressUse> getFoo() {
|
||||
return myFoo;
|
||||
}
|
||||
|
||||
public void setFoo(Enumeration<AddressUse> theFoo) {
|
||||
myFoo = theFoo;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.parser;
|
||||
|
||||
import org.hl7.fhir.instance.model.Attachment;
|
||||
import org.hl7.fhir.instance.model.AttachmentType;
|
||||
import org.hl7.fhir.instance.model.BackboneElement;
|
||||
import org.hl7.fhir.instance.model.DateType;
|
||||
import org.hl7.fhir.instance.model.Patient;
|
||||
|
@ -19,7 +19,7 @@ public class MyObservationWithExtensions extends Patient {
|
|||
|
||||
@Extension(url = "urn:patientext:att", definedLocally = false, isModifier = false)
|
||||
@Child(name = "extAtt", order = 0)
|
||||
private Attachment myExtAtt;
|
||||
private AttachmentType myExtAtt;
|
||||
|
||||
@Extension(url = "urn:patientext:moreext", definedLocally = false, isModifier = false)
|
||||
@Child(name = "moreExt", order = 1)
|
||||
|
@ -29,7 +29,7 @@ public class MyObservationWithExtensions extends Patient {
|
|||
@Child(name = "modExt", order = 2)
|
||||
private DateType myModExt;
|
||||
|
||||
public Attachment getExtAtt() {
|
||||
public AttachmentType getExtAtt() {
|
||||
return myExtAtt;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class MyObservationWithExtensions extends Patient {
|
|||
myModExt = theModExt;
|
||||
}
|
||||
|
||||
public void setExtAtt(Attachment theExtAtt) {
|
||||
public void setExtAtt(AttachmentType theExtAtt) {
|
||||
myExtAtt = theExtAtt;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,9 @@ import org.custommonkey.xmlunit.XMLUnit;
|
|||
import org.hamcrest.core.IsNot;
|
||||
import org.hamcrest.core.StringContains;
|
||||
import org.hamcrest.text.StringContainsInOrder;
|
||||
import org.hl7.fhir.instance.model.Address;
|
||||
import org.hl7.fhir.instance.model.Address.AddressUse;
|
||||
import org.hl7.fhir.instance.model.AddressType;
|
||||
import org.hl7.fhir.instance.model.AddressType.AddressUse;
|
||||
import org.hl7.fhir.instance.model.AddressType.AddressUseEnumFactory;
|
||||
import org.hl7.fhir.instance.model.Binary;
|
||||
import org.hl7.fhir.instance.model.Bundle;
|
||||
import org.hl7.fhir.instance.model.Bundle.BundleEntryComponent;
|
||||
|
@ -41,6 +42,8 @@ import org.hl7.fhir.instance.model.DecimalType;
|
|||
import org.hl7.fhir.instance.model.DiagnosticReport;
|
||||
import org.hl7.fhir.instance.model.DocumentManifest;
|
||||
import org.hl7.fhir.instance.model.DocumentManifest.DocumentReferenceStatus;
|
||||
import org.hl7.fhir.instance.model.EnumFactory;
|
||||
import org.hl7.fhir.instance.model.Enumeration;
|
||||
import org.hl7.fhir.instance.model.Extension;
|
||||
import org.hl7.fhir.instance.model.HumanName;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
@ -52,6 +55,7 @@ import org.hl7.fhir.instance.model.Narrative.NarrativeStatus;
|
|||
import org.hl7.fhir.instance.model.Observation;
|
||||
import org.hl7.fhir.instance.model.Organization;
|
||||
import org.hl7.fhir.instance.model.Patient;
|
||||
import org.hl7.fhir.instance.model.PrimitiveType;
|
||||
import org.hl7.fhir.instance.model.Reference;
|
||||
import org.hl7.fhir.instance.model.Resource;
|
||||
import org.hl7.fhir.instance.model.Specimen;
|
||||
|
@ -65,6 +69,7 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
|
||||
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||
import ca.uhn.fhir.parser.JsonParserHl7OrgTest.MyPatientWithOneDeclaredAddressExtension;
|
||||
import ca.uhn.fhir.parser.JsonParserHl7OrgTest.MyPatientWithOneDeclaredEnumerationExtension;
|
||||
import ca.uhn.fhir.parser.JsonParserHl7OrgTest.MyPatientWithOneDeclaredExtension;
|
||||
|
||||
public class XmlParserHl7OrgDstu2Test {
|
||||
|
@ -806,7 +811,7 @@ public class XmlParserHl7OrgDstu2Test {
|
|||
|
||||
MyPatientWithOneDeclaredAddressExtension patient = new MyPatientWithOneDeclaredAddressExtension();
|
||||
patient.addAddress().setUse(AddressUse.HOME);
|
||||
patient.setFoo(new Address().addLine("line1"));
|
||||
patient.setFoo(new AddressType().addLine("line1"));
|
||||
|
||||
String val = parser.encodeResourceToString(patient);
|
||||
ourLog.info(val);
|
||||
|
@ -814,7 +819,7 @@ public class XmlParserHl7OrgDstu2Test {
|
|||
|
||||
MyPatientWithOneDeclaredAddressExtension actual = parser.parseResource(MyPatientWithOneDeclaredAddressExtension.class, val);
|
||||
assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse());
|
||||
Address ref = actual.getFoo();
|
||||
AddressType ref = actual.getFoo();
|
||||
assertEquals("line1", ref.getLine().get(0).getValue());
|
||||
|
||||
}
|
||||
|
@ -962,13 +967,35 @@ public class XmlParserHl7OrgDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeUndeclaredExtensionWithEnumerationContent() {
|
||||
IParser parser = ourCtx.newXmlParser();
|
||||
|
||||
Patient patient = new Patient();
|
||||
patient.addAddress().setUse(AddressUse.HOME);
|
||||
EnumFactory<AddressUse> fact = new AddressUseEnumFactory();
|
||||
PrimitiveType<AddressUse> enumeration = new Enumeration<AddressUse>(fact).setValue(AddressUse.HOME);
|
||||
patient.addExtension().setUrl("urn:foo").setValue(enumeration);
|
||||
|
||||
String val = parser.encodeResourceToString(patient);
|
||||
ourLog.info(val);
|
||||
assertThat(val, StringContains.containsString("<extension url=\"urn:foo\"><valueCode value=\"home\"/></extension>"));
|
||||
|
||||
MyPatientWithOneDeclaredEnumerationExtension actual = parser.parseResource(MyPatientWithOneDeclaredEnumerationExtension.class, val);
|
||||
assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse());
|
||||
Enumeration<AddressUse> ref = actual.getFoo();
|
||||
assertEquals("home", ref.getValue().toCode());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeUndeclaredExtensionWithAddressContent() {
|
||||
IParser parser = ourCtx.newXmlParser();
|
||||
|
||||
Patient patient = new Patient();
|
||||
patient.addAddress().setUse(AddressUse.HOME);
|
||||
patient.addExtension().setUrl("urn:foo").setValue(new Address().addLine("line1"));
|
||||
patient.addExtension().setUrl("urn:foo").setValue(new AddressType().addLine("line1"));
|
||||
|
||||
String val = parser.encodeResourceToString(patient);
|
||||
ourLog.info(val);
|
||||
|
@ -976,7 +1003,7 @@ public class XmlParserHl7OrgDstu2Test {
|
|||
|
||||
MyPatientWithOneDeclaredAddressExtension actual = parser.parseResource(MyPatientWithOneDeclaredAddressExtension.class, val);
|
||||
assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse());
|
||||
Address ref = actual.getFoo();
|
||||
AddressType ref = actual.getFoo();
|
||||
assertEquals("line1", ref.getLine().get(0).getValue());
|
||||
|
||||
}
|
||||
|
@ -1077,6 +1104,10 @@ public class XmlParserHl7OrgDstu2Test {
|
|||
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient));
|
||||
|
||||
Diff d = new Diff(new StringReader(msg), new StringReader(encoded));
|
||||
|
||||
ourLog.info("Expected: {}", msg);
|
||||
ourLog.info("Actual: {}", encoded);
|
||||
|
||||
assertTrue(d.toString(), d.identical());
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -8,6 +9,7 @@ import org.eclipse.jetty.server.Server;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package ca.uhn.example;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
@ -12,7 +11,7 @@ import org.junit.Test;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||
|
||||
public class ExampleTest {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<groupId>ca.uhn.hapi.example</groupId>
|
||||
<artifactId>restful-server-example</artifactId>
|
||||
<version>0.8-SNAPSHOT</version>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>HAPI FHIR Sample RESTful Server</name>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<!-- At least one "structures" JAR must also be included -->
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package ca.uhn.example.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ca.uhn.fhir.model.api.BaseElement;
|
||||
import ca.uhn.fhir.model.api.BaseIdentifiableElement;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IExtension;
|
||||
|
@ -12,8 +11,8 @@ import ca.uhn.fhir.model.api.annotation.Child;
|
|||
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.dstu.composite.ContactDt;
|
||||
import ca.uhn.fhir.model.dstu.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu2.composite.ContactPointDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
||||
import ca.uhn.fhir.model.primitive.BooleanDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.util.ElementUtil;
|
||||
|
@ -115,7 +114,7 @@ public class MyOrganization extends Organization {
|
|||
@Description(shortDefinition = "Contains the actual contact details")
|
||||
@Extension(url = "http://foo#emergencyContactContact", isModifier = false, definedLocally = true)
|
||||
@Child(name = "contact")
|
||||
private ContactDt myContact;
|
||||
private ContactPointDt myContact;
|
||||
|
||||
/* *****************************
|
||||
* Getters and setters
|
||||
|
@ -132,14 +131,14 @@ public class MyOrganization extends Organization {
|
|||
myActive = theActive;
|
||||
}
|
||||
|
||||
public ContactDt getContact() {
|
||||
public ContactPointDt getContact() {
|
||||
if (myContact == null) {
|
||||
myContact = new ContactDt();
|
||||
myContact = new ContactPointDt();
|
||||
}
|
||||
return myContact;
|
||||
}
|
||||
|
||||
public void setContact(ContactDt theContact) {
|
||||
public void setContact(ContactPointDt theContact) {
|
||||
myContact = theContact;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package ca.uhn.example.provider;
|
||||
|
||||
import ca.uhn.example.model.MyOrganization;
|
||||
import ca.uhn.example.model.MyOrganization.EmergencyContact;
|
||||
import ca.uhn.fhir.model.dstu.composite.ContactDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.ContactUseEnum;
|
||||
import ca.uhn.fhir.model.dstu2.composite.ContactPointDt;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.BooleanDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
|
@ -51,9 +50,9 @@ public class OrganizationResourceProvider implements IResourceProvider {
|
|||
|
||||
MyOrganization retVal = new MyOrganization();
|
||||
retVal.setId("1");
|
||||
retVal.addIdentifier("urn:example:orgs", "FooOrganization");
|
||||
retVal.addIdentifier().setSystem("urn:example:orgs").setValue("FooOrganization");
|
||||
retVal.addAddress().addLine("123 Fake Street").setCity("Toronto");
|
||||
retVal.addTelecom().setUse(ContactUseEnum.WORK).setValue("1-888-123-4567");
|
||||
retVal.addTelecom().setUse(ContactPointUseEnum.WORK).setValue("1-888-123-4567");
|
||||
|
||||
// Populate the first, primitive extension
|
||||
retVal.setBillingCode(new CodeDt("00102-1"));
|
||||
|
@ -61,7 +60,7 @@ public class OrganizationResourceProvider implements IResourceProvider {
|
|||
// The second extension is repeatable and takes a block type
|
||||
MyOrganization.EmergencyContact contact = new MyOrganization.EmergencyContact();
|
||||
contact.setActive(new BooleanDt(true));
|
||||
contact.setContact(new ContactDt());
|
||||
contact.setContact(new ContactPointDt());
|
||||
retVal.getEmergencyContact().add(contact);
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -7,11 +7,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.dstu.composite.HumanNameDt;
|
||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
||||
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
|
@ -59,7 +59,7 @@ public class PatientResourceProvider implements IResourceProvider {
|
|||
patient.getIdentifier().get(0).setValue("00002");
|
||||
patient.addName().addFamily("Test");
|
||||
patient.getName().get(0).addGiven("PatientOne");
|
||||
patient.setGender(AdministrativeGenderCodesEnum.F);
|
||||
patient.setGender(AdministrativeGenderEnum.FEMALE);
|
||||
|
||||
LinkedList<Patient> list = new LinkedList<Patient>();
|
||||
list.add(patient);
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import ca.uhn.example.provider.OrganizationResourceProvider;
|
||||
import ca.uhn.example.provider.PatientResourceProvider;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
||||
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||
|
@ -23,6 +24,7 @@ public class ExampleRestfulServlet extends RestfulServer {
|
|||
*/
|
||||
@Override
|
||||
public void initialize() {
|
||||
setFhirContext(FhirContext.forDstu2());// Support DSTU2
|
||||
|
||||
/*
|
||||
* Two resource providers are defined. Each one handles a specific
|
||||
|
|
|
@ -130,6 +130,12 @@
|
|||
JPA server failed to index resources containing ContactPointDt elements with
|
||||
populated values (e.g. Patient.telecom). Thanks to Mohammad Jafari for reporting!
|
||||
</action>
|
||||
<action type="add">
|
||||
Add a new configuration method on the parsers,
|
||||
<![CDATA[<code>setStripVersionsFromReferences(boolean)</code>]]> which
|
||||
configures the parser to preserve versions in resource reference links when
|
||||
encoding. By default, these are removed.
|
||||
</action>
|
||||
<action type="fix" issue="155" dev="wdebeau1">
|
||||
Terser's IModelVisitor now supplies to the path to the element. This is
|
||||
an API change, but I don't think there are many users of the IModelVisitor yet.
|
||||
|
|
Loading…
Reference in New Issue