mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-03-09 14:33:32 +00:00
More work on getting HL7org structs working
This commit is contained in:
parent
b222b76611
commit
147305b70e
@ -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;
|
||||
@ -511,4 +509,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.IReference;
|
||||
|
||||
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) || IReference.class.isAssignableFrom(next)) {
|
||||
choiceTypes.add(next);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
@ -147,7 +157,7 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
|
||||
@Override
|
||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||
myUrlToChildExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>();
|
||||
|
||||
|
||||
BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(myChildType);
|
||||
if (elementDef instanceof RuntimePrimitiveDatatypeDefinition || elementDef instanceof RuntimeCompositeDatatypeDefinition) {
|
||||
myDatatypeChildName = "value" + elementDef.getName().substring(0, 1).toUpperCase() + elementDef.getName().substring(1);
|
||||
|
@ -42,15 +42,21 @@ public class RuntimeChildPrimitiveEnumerationDatatypeDefinition extends RuntimeC
|
||||
public Object getInstanceConstructorArguments() {
|
||||
Object retVal = myBinder;
|
||||
if (retVal == null) {
|
||||
Class<?> clazz;
|
||||
String className = myEnumerationType.getName() + "EnumFactory";
|
||||
try {
|
||||
clazz = Class.forName(className);
|
||||
retVal = clazz.newInstance();
|
||||
myBinder = retVal;
|
||||
} catch (Exception e) {
|
||||
throw new ConfigurationException("Failed to instantiate " + className, e);
|
||||
}
|
||||
retVal = toEnumFactory(myEnumerationType);
|
||||
myBinder = retVal;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static Object toEnumFactory(Class<?> theEnumerationType) {
|
||||
Class<?> clazz;
|
||||
String className = theEnumerationType.getName() + "EnumFactory";
|
||||
Object retVal;
|
||||
try {
|
||||
clazz = Class.forName(className);
|
||||
retVal = clazz.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new ConfigurationException("Failed to instantiate " + className, e);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import java.util.Set;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
|
||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||
import ca.uhn.fhir.model.api.IDatatype;
|
||||
@ -70,7 +71,9 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||
|
||||
@Override
|
||||
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theType) {
|
||||
return myDatatypeToDefinition.get(theType);
|
||||
Class<? extends IBase> type = theType;
|
||||
// if (IReference.type)
|
||||
return myDatatypeToDefinition.get(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,6 +120,7 @@ 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) {
|
||||
@ -124,8 +128,13 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
||||
// System.out.println();
|
||||
// }
|
||||
|
||||
myDatatypeToDefinition.put(next.getImplementingClass(), next);
|
||||
|
||||
if (!((IRuntimeDatatypeDefinition) next).isSpecialization()) {
|
||||
String attrName = createExtensionChildName(next);
|
||||
if (datatypeAttributeNameToDefinition.containsKey(attrName)) {
|
||||
throw new ConfigurationException("More than one child matches attribute name " + attrName);
|
||||
}
|
||||
datatypeAttributeNameToDefinition.put(attrName, next);
|
||||
datatypeAttributeNameToDefinition.put(attrName.toLowerCase(), next);
|
||||
myDatatypeToAttributeName.put(next.getImplementingClass(), attrName);
|
||||
@ -135,13 +144,12 @@ 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' in DSTU2 and 'valueResource' in DSTU1
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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.DocumentReferenceStatusEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
@ -72,6 +65,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, 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();
|
||||
|
@ -28,11 +28,14 @@
|
||||
<scope>provided</scope>
|
||||
</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();
|
||||
|
@ -246,7 +246,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))
|
||||
@ -254,7 +254,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))
|
||||
|
@ -56,7 +56,7 @@ public class SupportingDocumentation extends DomainResource {
|
||||
/**
|
||||
* The attached content.
|
||||
*/
|
||||
@Child(name="content", type={Attachment.class}, order=2, min=1, max=1)
|
||||
@Child(name="content", type={AttachmentType.class}, order=2, min=1, max=1)
|
||||
@Description(shortDefinition="Content", formalDefinition="The attached content." )
|
||||
protected Type content;
|
||||
|
||||
@ -143,10 +143,10 @@ public class SupportingDocumentation extends DomainResource {
|
||||
/**
|
||||
* @return {@link #content} (The attached content.)
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
public boolean hasContent() {
|
||||
|
@ -125,3 +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,9 @@
|
||||
package ca.uhn.fhir.model;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
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,6 +33,7 @@ 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.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
@ -56,7 +58,10 @@ import org.hl7.fhir.instance.model.api.IReference;
|
||||
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 +87,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 +111,7 @@ public class ModelInheritanceTest {
|
||||
*/
|
||||
@Test
|
||||
public void testAddress() {
|
||||
assertTrue(ICompositeType.class.isAssignableFrom(Address.class));
|
||||
assertTrue(ICompositeType.class.isAssignableFrom(AddressType.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -155,6 +174,9 @@ public class ModelInheritanceTest {
|
||||
@Test
|
||||
public void testEnumeration() {
|
||||
assertTrue(IBaseEnumeration.class.isAssignableFrom(Enumeration.class));
|
||||
|
||||
DatatypeDef def = Enumeration.class.getAnnotation(DatatypeDef.class);
|
||||
assertTrue(def.isSpecialization());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,16 +29,18 @@ 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.valueset.BundleTypeEnum;
|
||||
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 {
|
||||
public class ContainedResourceEncodingDstu2Hl7OrgTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ContainedResourceEncodingTest.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(ContainedResourceEncodingDstu2Hl7OrgTest.class);
|
||||
|
||||
private FhirContext ctx;
|
||||
private FhirContext ourCtx;
|
||||
|
||||
private Composition comp;
|
||||
|
||||
@ -57,7 +59,7 @@ public class ContainedResourceEncodingTest {
|
||||
initPatient();
|
||||
initAuthor();
|
||||
initComposition();
|
||||
this.ctx = new FhirContext();
|
||||
this.ourCtx = new FhirContext();
|
||||
|
||||
}
|
||||
|
||||
@ -115,9 +117,9 @@ public class ContainedResourceEncodingTest {
|
||||
/**
|
||||
* This works fine, although patient instance is modifing from encoder
|
||||
*/
|
||||
final String expectedPatientXml = this.ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(this.patient);
|
||||
final String expectedPatientXml = this.ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(this.patient);
|
||||
logger.debug("[xmlEncoding] first encoding: {}", expectedPatientXml);
|
||||
final String actualPatientXml = this.ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(this.patient);
|
||||
final String actualPatientXml = this.ourCtx.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);
|
||||
|
||||
@ -129,7 +131,7 @@ public class ContainedResourceEncodingTest {
|
||||
@Test
|
||||
public void testComposition() {
|
||||
|
||||
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||
IParser parser = this.ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
|
||||
assertEquals(0, this.comp.getContained().size());
|
||||
|
||||
@ -194,10 +196,13 @@ public class ContainedResourceEncodingTest {
|
||||
|
||||
List<IBaseResource> list = new ArrayList<IBaseResource>();
|
||||
list.add(dr);
|
||||
Bundle bundle = null; // RestfulServer.createBundleFromResourceList(new FhirContext(), null, list, null, null, 0);
|
||||
|
||||
Dstu2Hl7OrgBundleFactory bf = new Dstu2Hl7OrgBundleFactory(ourCtx);
|
||||
bf.initializeBundleFromResourceList("Author", list, "http://foo", "http://foo", 100, BundleTypeEnum.COLLECTION);
|
||||
org.hl7.fhir.instance.model.Bundle bundle = (org.hl7.fhir.instance.model.Bundle) bf.getResourceBundle(); // RestfulServer.createBundleFromResourceList(new FhirContext(), null, list, null, null, 0);
|
||||
|
||||
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||
String xml = parser.encodeBundleToString(bundle);
|
||||
IParser parser = this.ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
String xml = parser.encodeResourceToString(bundle);
|
||||
Assert.assertTrue(xml.contains("Mueller"));
|
||||
|
||||
}
|
||||
@ -231,12 +236,15 @@ public class ContainedResourceEncodingTest {
|
||||
observation.getPerformer().addAll(performers);
|
||||
|
||||
|
||||
List<IAnyResource> list = new ArrayList<IAnyResource>();
|
||||
List<IBaseResource> list = new ArrayList<IBaseResource>();
|
||||
list.add(dr);
|
||||
Bundle bundle = null; // RestfulServer.createBundleFromResourceList(new FhirContext(), null, list, null, null, 0);
|
||||
|
||||
Dstu2Hl7OrgBundleFactory bf = new Dstu2Hl7OrgBundleFactory(ourCtx);
|
||||
bf.initializeBundleFromResourceList("Author", list, "http://foo", "http://foo", 100, BundleTypeEnum.COLLECTION);
|
||||
org.hl7.fhir.instance.model.Bundle bundle = (org.hl7.fhir.instance.model.Bundle) bf.getResourceBundle(); // RestfulServer.createBundleFromResourceList(new FhirContext(), null, list, null, null, 0);
|
||||
|
||||
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||
String xml = parser.encodeBundleToString(bundle);
|
||||
IParser parser = this.ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
String xml = parser.encodeResourceToString(bundle);
|
||||
Assert.assertTrue(xml.contains("Mueller"));
|
||||
|
||||
}
|
@ -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 {
|
||||
@ -494,7 +499,7 @@ public class XmlParserHl7OrgDstu2Test {
|
||||
//@formatter:on
|
||||
|
||||
Patient p = ourCtx.newXmlParser().parseResource(Patient.class, res);
|
||||
assertEquals(htmlNoNs, p.getText().getDivAsString());
|
||||
assertEquals(htmlNs, p.getText().getDivAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -799,7 +804,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);
|
||||
@ -807,7 +812,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());
|
||||
|
||||
}
|
||||
@ -841,7 +846,7 @@ public class XmlParserHl7OrgDstu2Test {
|
||||
|
||||
String val = parser.encodeResourceToString(patient);
|
||||
ourLog.info(val);
|
||||
assertThat(val, StringContains.containsString("<extension url=\"urn:foo\"><valueResource><reference value=\"Organization/123\"/></valueResource></extension>"));
|
||||
assertThat(val, StringContains.containsString("<extension url=\"urn:foo\"><valueReference><reference value=\"Organization/123\"/></valueReference></extension>"));
|
||||
|
||||
Patient actual = parser.parseResource(Patient.class, val);
|
||||
assertEquals(AddressUse.HOME, patient.getAddress().get(0).getUse());
|
||||
@ -955,13 +960,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);
|
||||
@ -969,7 +996,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());
|
||||
|
||||
}
|
||||
@ -1070,6 +1097,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());
|
||||
|
||||
}
|
||||
@ -1494,9 +1525,8 @@ public class XmlParserHl7OrgDstu2Test {
|
||||
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
||||
|
||||
// The encoded escapes quote marks using XML escaping instead of JSON escaping, which is probably nicer anyhow...
|
||||
String exp = expected.toString().replace("\\\"Jim\\\"", ""Jim"");
|
||||
String act = actual.toString();
|
||||
|
||||
String exp = expected.toString().replace("\\\"Jim\\\"", ""Jim"").replace(" xmlns=\\\"http://www.w3.org/1999/xhtml\\\"", "");
|
||||
String act = actual.toString().replace(" xmlns=\\\"http://www.w3.org/1999/xhtml\\\"", "");
|
||||
ourLog.info("Expected: {}", exp);
|
||||
ourLog.info("Actual : {}", act);
|
||||
assertEquals(exp, act);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ca.uhn.fhir.jpa.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user