Merge branch 'hl7org_structs' of github.com:jamesagnew/hapi-fhir into hl7org_structs
This commit is contained in:
commit
a731557516
|
@ -3,7 +3,7 @@ package example;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
|
|
|
@ -3,7 +3,7 @@ package example;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
||||
|
|
|
@ -2,7 +2,7 @@ package example;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.io.FileReader;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.io.filefilter.WildcardFileFilter;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Collections;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.ICodeEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
public abstract class BaseRuntimeChildDefinition {
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
|
@ -37,8 +37,8 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
|||
private List<BaseRuntimeChildDefinition> myChildrenAndExtensions;
|
||||
private Map<String, BaseRuntimeChildDefinition> myNameToChild = new HashMap<String, BaseRuntimeChildDefinition>();
|
||||
|
||||
public BaseRuntimeElementCompositeDefinition(String theName, Class<? extends T> theImplementingClass) {
|
||||
super(theName, theImplementingClass);
|
||||
public BaseRuntimeElementCompositeDefinition(String theName, Class<? extends T> theImplementingClass, boolean theStandardType) {
|
||||
super(theName, theImplementingClass, theStandardType);
|
||||
}
|
||||
|
||||
public void addChild(BaseRuntimeChildDefinition theNext) {
|
||||
|
|
|
@ -20,6 +20,7 @@ package ca.uhn.fhir.context;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -28,34 +29,44 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
|
||||
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||
|
||||
private String myName;
|
||||
private Class<? extends T> myImplementingClass;
|
||||
private static final Class<Void> VOID_CLASS = Void.class;
|
||||
|
||||
private final String myName;
|
||||
private final Class<? extends T> myImplementingClass;
|
||||
private List<RuntimeChildDeclaredExtensionDefinition> myExtensions = new ArrayList<RuntimeChildDeclaredExtensionDefinition>();
|
||||
private Map<String, RuntimeChildDeclaredExtensionDefinition> myUrlToExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>();
|
||||
private List<RuntimeChildDeclaredExtensionDefinition> myExtensionsModifier = new ArrayList<RuntimeChildDeclaredExtensionDefinition>();
|
||||
private List<RuntimeChildDeclaredExtensionDefinition> myExtensionsNonModifier = new ArrayList<RuntimeChildDeclaredExtensionDefinition>();
|
||||
private final boolean myStandardType;
|
||||
private Map<Class<?>, Constructor<T>> myConstructors = Collections.synchronizedMap(new HashMap<Class<?>, Constructor<T>>());
|
||||
|
||||
public BaseRuntimeElementDefinition(String theName, Class<? extends T> theImplementingClass) {
|
||||
public BaseRuntimeElementDefinition(String theName, Class<? extends T> theImplementingClass, boolean theStandardType) {
|
||||
assert StringUtils.isNotBlank(theName);
|
||||
assert theImplementingClass != null;
|
||||
|
||||
myName = theName;
|
||||
|
||||
String name = theName;
|
||||
// TODO: remove this and fix for the model
|
||||
if (myName.endsWith("Dt")) {
|
||||
myName = myName.substring(0, myName.length() - 2);
|
||||
if (name.endsWith("Dt")) {
|
||||
name = name.substring(0, name.length() - 2);
|
||||
}
|
||||
|
||||
|
||||
myName = name;
|
||||
myStandardType = theStandardType;
|
||||
myImplementingClass = theImplementingClass;
|
||||
}
|
||||
|
||||
public boolean isStandardType() {
|
||||
return myStandardType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName()+"[" + getName() + "]";
|
||||
|
@ -102,13 +113,9 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
|||
public T newInstance(Object theArgument) {
|
||||
try {
|
||||
if (theArgument == null) {
|
||||
return getImplementingClass().newInstance();
|
||||
} else if (theArgument instanceof IValueSetEnumBinder) {
|
||||
return getImplementingClass().getConstructor(IValueSetEnumBinder.class).newInstance(theArgument);
|
||||
} else if (theArgument instanceof IBaseEnumFactory) {
|
||||
return getImplementingClass().getConstructor(IBaseEnumFactory.class).newInstance(theArgument);
|
||||
return getConstructor(null).newInstance(null);
|
||||
} else {
|
||||
return getImplementingClass().getConstructor(theArgument.getClass()).newInstance(theArgument);
|
||||
return getConstructor(theArgument).newInstance(theArgument);
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
throw new ConfigurationException("Failed to instantiate type:" + getImplementingClass().getName(), e);
|
||||
|
@ -118,13 +125,44 @@ public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
|||
throw new ConfigurationException("Failed to instantiate type:" + getImplementingClass().getName(), e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new ConfigurationException("Failed to instantiate type:" + getImplementingClass().getName(), e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new ConfigurationException("Failed to instantiate type:" + getImplementingClass().getName(), e);
|
||||
} catch (SecurityException e) {
|
||||
throw new ConfigurationException("Failed to instantiate type:" + getImplementingClass().getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Constructor<T> getConstructor(Object theArgument) {
|
||||
|
||||
Class<? extends Object> argumentType;
|
||||
if (theArgument == null) {
|
||||
argumentType = VOID_CLASS;
|
||||
} else {
|
||||
argumentType = theArgument.getClass();
|
||||
}
|
||||
|
||||
Constructor<T> retVal = myConstructors.get(argumentType);
|
||||
if (retVal == null) {
|
||||
for (Constructor<?> next : getImplementingClass().getConstructors()) {
|
||||
if (argumentType == VOID_CLASS) {
|
||||
if (next.getParameterTypes().length == 0) {
|
||||
retVal = (Constructor<T>) next;
|
||||
break;
|
||||
}
|
||||
} else if (next.getParameterTypes().length == 1) {
|
||||
if (next.getParameterTypes()[0].isAssignableFrom(argumentType)) {
|
||||
retVal = (Constructor<T>) next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (retVal == null) {
|
||||
throw new ConfigurationException("Class " + getImplementingClass() + " has no constructor with a single argument of type " + argumentType);
|
||||
}
|
||||
myConstructors.put(argumentType, retVal);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public Class<? extends T> getImplementingClass() {
|
||||
return myImplementingClass;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import java.util.Map;
|
|||
|
||||
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 org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.i18n.HapiLocalizer;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
|
@ -84,7 +84,6 @@ public class FhirContext {
|
|||
private volatile IRestfulClientFactory myRestfulClientFactory;
|
||||
private volatile RuntimeChildUndeclaredExtensionDefinition myRuntimeChildUndeclaredExtensionDefinition;
|
||||
private final IFhirVersion myVersion;
|
||||
|
||||
private Map<FhirVersionEnum, Map<String, Class<? extends IBaseResource>>> myVersionToNameToResourceType = Collections.emptyMap();
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,21 +48,21 @@ import java.util.Set;
|
|||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IRefImplResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.instance.model.api.IBaseXhtml;
|
||||
import org.hl7.fhir.instance.model.api.IDatatypeElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.INarrative;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
|
||||
import ca.uhn.fhir.model.api.CodeableConceptElement;
|
||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||
|
@ -102,6 +102,7 @@ class ModelScanner {
|
|||
private Set<Class<? extends ICodeEnum>> myScanAlsoCodeTable = new HashSet<Class<? extends ICodeEnum>>();
|
||||
private FhirVersionEnum myVersion;
|
||||
private Map<String, BaseRuntimeElementDefinition<?>> myNameToElementDefinitions = new HashMap<String, BaseRuntimeElementDefinition<?>>();
|
||||
private Set<Class<? extends IBase>> myVersionTypes;
|
||||
|
||||
ModelScanner(FhirContext theContext, FhirVersionEnum theVersion, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theExistingDefinitions, Collection<Class<? extends IElement>> theResourceTypes) throws ConfigurationException {
|
||||
myContext = theContext;
|
||||
|
@ -182,7 +183,7 @@ class ModelScanner {
|
|||
long start = System.currentTimeMillis();
|
||||
Map<String, Class<? extends IBaseResource>> resourceTypes = myNameToResourceType;
|
||||
|
||||
scanVersionPropertyFile(theDatatypes, resourceTypes, myVersion);
|
||||
myVersionTypes = scanVersionPropertyFile(theDatatypes, resourceTypes, myVersion);
|
||||
|
||||
// toScan.add(DateDt.class);
|
||||
// toScan.add(CodeDt.class);
|
||||
|
@ -303,7 +304,7 @@ class ModelScanner {
|
|||
Block blockDefinition = pullAnnotation(theClass, Block.class);
|
||||
|
||||
if (blockDefinition != null) {
|
||||
if (IResourceBlock.class.isAssignableFrom(theClass) || IBackboneElement.class.isAssignableFrom(theClass) || IDatatypeElement.class.isAssignableFrom(theClass)) {
|
||||
if (IResourceBlock.class.isAssignableFrom(theClass) || IBaseBackboneElement.class.isAssignableFrom(theClass) || IBaseDatatypeElement.class.isAssignableFrom(theClass)) {
|
||||
scanBlock(theClass);
|
||||
} else {
|
||||
throw new ConfigurationException("Type contains a @" + Block.class.getSimpleName() + " annotation but does not implement " + IResourceBlock.class.getCanonicalName() + ": " + theClass.getCanonicalName());
|
||||
|
@ -323,7 +324,7 @@ class ModelScanner {
|
|||
throw new ConfigurationException("Block type @" + Block.class.getSimpleName() + " annotation contains no name: " + theClass.getCanonicalName());
|
||||
}
|
||||
|
||||
RuntimeResourceBlockDefinition resourceDef = new RuntimeResourceBlockDefinition(resourceName, theClass);
|
||||
RuntimeResourceBlockDefinition resourceDef = new RuntimeResourceBlockDefinition(resourceName, theClass, isStandardType(theClass));
|
||||
myClassToElementDefinitions.put(theClass, resourceDef);
|
||||
|
||||
scanCompositeElementForChildren(theClass, resourceDef);
|
||||
|
@ -334,15 +335,19 @@ class ModelScanner {
|
|||
|
||||
RuntimeCompositeDatatypeDefinition resourceDef;
|
||||
if (theClass.equals(ExtensionDt.class)) {
|
||||
resourceDef = new RuntimeExtensionDtDefinition(theDatatypeDefinition, theClass);
|
||||
resourceDef = new RuntimeExtensionDtDefinition(theDatatypeDefinition, theClass, true);
|
||||
} else {
|
||||
resourceDef = new RuntimeCompositeDatatypeDefinition(theDatatypeDefinition, theClass);
|
||||
resourceDef = new RuntimeCompositeDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
||||
}
|
||||
myClassToElementDefinitions.put(theClass, resourceDef);
|
||||
myNameToElementDefinitions.put(resourceDef.getName(), resourceDef);
|
||||
scanCompositeElementForChildren(theClass, resourceDef);
|
||||
}
|
||||
|
||||
private boolean isStandardType(Class<? extends IBase> theClass) {
|
||||
return myVersionTypes.contains(theClass);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void scanCompositeElementForChildren(Class<? extends IBase> theClass, BaseRuntimeElementCompositeDefinition<?> theDefinition) {
|
||||
Set<String> elementNames = new HashSet<String>();
|
||||
|
@ -505,14 +510,14 @@ class ModelScanner {
|
|||
RuntimeChildContainedResources def = new RuntimeChildContainedResources(next, childAnnotation, descriptionAnnotation, elementName);
|
||||
orderMap.put(order, def);
|
||||
|
||||
} else if (IAnyResource.class.isAssignableFrom(nextElementType) || IResource.class.equals(nextElementType)) {
|
||||
} else if (IRefImplResource.class.isAssignableFrom(nextElementType) || IResource.class.equals(nextElementType)) {
|
||||
/*
|
||||
* Child is a resource as a direct child, as in Bundle.entry.resource
|
||||
*/
|
||||
RuntimeChildDirectResource def = new RuntimeChildDirectResource(next, childAnnotation, descriptionAnnotation, elementName);
|
||||
orderMap.put(order, def);
|
||||
|
||||
} else if (choiceTypes.size() > 1 && !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) && !IReference.class.isAssignableFrom(nextElementType)) {
|
||||
} else if (choiceTypes.size() > 1 && !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) && !IBaseReference.class.isAssignableFrom(nextElementType)) {
|
||||
/*
|
||||
* Child is a choice element
|
||||
*/
|
||||
|
@ -551,7 +556,7 @@ class ModelScanner {
|
|||
if (IBase.class.isAssignableFrom(nextElementType)) {
|
||||
addScanAlso((Class<? extends IBase>) nextElementType);
|
||||
}
|
||||
} else if (BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) || IReference.class.isAssignableFrom(nextElementType)) {
|
||||
} else if (BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) || IBaseReference.class.isAssignableFrom(nextElementType)) {
|
||||
/*
|
||||
* Child is a resource reference
|
||||
*/
|
||||
|
@ -566,7 +571,7 @@ class ModelScanner {
|
|||
RuntimeChildResourceDefinition def = new RuntimeChildResourceDefinition(next, elementName, childAnnotation, descriptionAnnotation, refTypesList);
|
||||
orderMap.put(order, def);
|
||||
|
||||
} else if (IResourceBlock.class.isAssignableFrom(nextElementType) || IBackboneElement.class.isAssignableFrom(nextElementType) || IDatatypeElement.class.isAssignableFrom(nextElementType)) {
|
||||
} else if (IResourceBlock.class.isAssignableFrom(nextElementType) || IBaseBackboneElement.class.isAssignableFrom(nextElementType) || IBaseDatatypeElement.class.isAssignableFrom(nextElementType)) {
|
||||
/*
|
||||
* Child is a resource block (i.e. a sub-tag within a resource) TODO: do these have a better name
|
||||
* according to HL7?
|
||||
|
@ -650,15 +655,15 @@ class ModelScanner {
|
|||
if (theClass.equals(XhtmlDt.class)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<XhtmlDt> clazz = (Class<XhtmlDt>) theClass;
|
||||
resourceDef = new RuntimePrimitiveDatatypeNarrativeDefinition(resourceName, clazz);
|
||||
resourceDef = new RuntimePrimitiveDatatypeNarrativeDefinition(resourceName, clazz, isStandardType(clazz));
|
||||
} else if (IBaseXhtml.class.isAssignableFrom(theClass)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IBaseXhtml> clazz = (Class<? extends IBaseXhtml>) theClass;
|
||||
resourceDef = new RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition(resourceName, clazz);
|
||||
resourceDef = new RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition(resourceName, clazz, isStandardType(clazz));
|
||||
} else if (IIdType.class.isAssignableFrom(theClass)) {
|
||||
resourceDef = new RuntimeIdDatatypeDefinition(theDatatypeDefinition, theClass);
|
||||
resourceDef = new RuntimeIdDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
||||
} else {
|
||||
resourceDef = new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass);
|
||||
resourceDef = new RuntimePrimitiveDatatypeDefinition(theDatatypeDefinition, theClass, isStandardType(theClass));
|
||||
}
|
||||
myClassToElementDefinitions.put(theClass, resourceDef);
|
||||
myNameToElementDefinitions.put(resourceName, resourceDef);
|
||||
|
@ -693,7 +698,7 @@ class ModelScanner {
|
|||
}
|
||||
}
|
||||
|
||||
RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition);
|
||||
RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition, isStandardType(theClass));
|
||||
myClassToElementDefinitions.put(theClass, resourceDef);
|
||||
if (primaryNameProvider) {
|
||||
if (resourceDef.getStructureVersion() == myVersion) {
|
||||
|
@ -763,7 +768,9 @@ class ModelScanner {
|
|||
return type;
|
||||
}
|
||||
|
||||
static void scanVersionPropertyFile(Set<Class<? extends IBase>> theDatatypes, Map<String, Class<? extends IBaseResource>> theResourceTypes, FhirVersionEnum version) {
|
||||
static Set<Class<? extends IBase>> scanVersionPropertyFile(Set<Class<? extends IBase>> theDatatypes, Map<String, Class<? extends IBaseResource>> theResourceTypes, FhirVersionEnum version) {
|
||||
Set<Class<? extends IBase>> retVal = new HashSet<Class<? extends IBase>>();
|
||||
|
||||
InputStream str = version.getVersionImplementation().getFhirVersionPropertiesFile();
|
||||
Properties prop = new Properties();
|
||||
try {
|
||||
|
@ -776,7 +783,11 @@ class ModelScanner {
|
|||
if (theDatatypes != null) {
|
||||
try {
|
||||
// Datatypes
|
||||
Class<?> dtType = Class.forName(nextValue);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IBase> dtType = (Class<? extends IBase>) Class.forName(nextValue);
|
||||
retVal.add(dtType);
|
||||
|
||||
if (IElement.class.isAssignableFrom(dtType)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IElement> nextClass = (Class<? extends IElement>) dtType;
|
||||
|
@ -791,7 +802,7 @@ class ModelScanner {
|
|||
}
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
ourLog.error("Unknown class[" + nextValue + "] for data type definition: " + nextKey.substring("datatype.".length()), e);
|
||||
throw new ConfigurationException("Unknown class[" + nextValue + "] for data type definition: " + nextKey.substring("datatype.".length()), e);
|
||||
}
|
||||
}
|
||||
} else if (nextKey.startsWith("resource.")) {
|
||||
|
@ -801,21 +812,22 @@ class ModelScanner {
|
|||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IBaseResource> nextClass = (Class<? extends IBaseResource>) Class.forName(nextValue);
|
||||
if (!IBaseResource.class.isAssignableFrom(nextClass)) {
|
||||
ourLog.warn("Class is not assignable from " + IBaseResource.class.getSimpleName() + ": " + nextValue);
|
||||
continue;
|
||||
throw new ConfigurationException("Class is not assignable from " + IBaseResource.class.getSimpleName() + ": " + nextValue);
|
||||
}
|
||||
|
||||
theResourceTypes.put(resName, nextClass);
|
||||
} catch (ClassNotFoundException e) {
|
||||
ourLog.error("Unknown class[" + nextValue + "] for resource definition: " + nextKey.substring("resource.".length()), e);
|
||||
throw new ConfigurationException("Unknown class[" + nextValue + "] for resource definition: " + nextKey.substring("resource.".length()), e);
|
||||
}
|
||||
} else {
|
||||
ourLog.warn("Unexpected property in version property file: {}={}", nextKey, nextValue);
|
||||
throw new ConfigurationException("Unexpected property in version property file: " + nextKey + "=" + nextValue);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new ConfigurationException("Failed to load model property file from classpath: " + "/ca/uhn/fhir/model/dstu/model.properties");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public Map<String, BaseRuntimeElementDefinition<?>> getNameToElementDefinitions() {
|
||||
|
|
|
@ -27,9 +27,9 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
|
||||
import ca.uhn.fhir.model.api.IDatatype;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -63,7 +63,7 @@ public class RuntimeChildAny extends RuntimeChildChoiceDefinition {
|
|||
}
|
||||
}
|
||||
|
||||
if (IResource.class.isAssignableFrom(next) || IDatatype.class.isAssignableFrom(next) || IBaseDatatype.class.isAssignableFrom(next) || IReference.class.isAssignableFrom(next)) {
|
||||
if (IResource.class.isAssignableFrom(next) || IDatatype.class.isAssignableFrom(next) || IBaseDatatype.class.isAssignableFrom(next) || IBaseReference.class.isAssignableFrom(next)) {
|
||||
choiceTypes.add(next);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
@ -90,7 +90,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
|
|||
elementName = getElementName() + StringUtils.capitalize(next.getSimpleName());
|
||||
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
||||
types.add((Class<? extends IBaseResource>) next);
|
||||
nextDef = new RuntimeResourceReferenceDefinition(elementName, types);
|
||||
nextDef = new RuntimeResourceReferenceDefinition(elementName, types, false);
|
||||
nextDef.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||
|
||||
myNameToChildDefinition.put(getElementName() + "Reference", nextDef);
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -26,8 +26,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
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.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
@ -68,9 +68,9 @@ public class RuntimeChildContainedResources extends BaseRuntimeDeclaredChildDefi
|
|||
if (BaseContainedDt.class.isAssignableFrom(actualType)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends BaseContainedDt> type = (Class<? extends BaseContainedDt>) actualType;
|
||||
myElem = new RuntimeElemContainedResources(type);
|
||||
myElem = new RuntimeElemContainedResources(type, false);
|
||||
} else if (List.class.isAssignableFrom(actualType)) {
|
||||
myElem = new RuntimeElemContainedResourceList(IBaseResource.class);
|
||||
myElem = new RuntimeElemContainedResourceList(IBaseResource.class, false);
|
||||
} else {
|
||||
throw new ConfigurationException("Fhir Version definition returned invalid contained type: " + actualType);
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
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.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
@ -166,7 +166,7 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
|
|||
myDatatypeChildName = "valueResource";
|
||||
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
||||
types.add(IResource.class);
|
||||
myChildDef = new RuntimeResourceReferenceDefinition("valueResource", types);
|
||||
myChildDef = new RuntimeResourceReferenceDefinition("valueResource", types, false);
|
||||
} else {
|
||||
myChildDef = elementDef;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ import java.util.Collections;
|
|||
import java.util.Map;
|
||||
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.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
@ -43,7 +43,7 @@ public class RuntimeChildDirectResource extends BaseRuntimeDeclaredChildDefiniti
|
|||
|
||||
@Override
|
||||
public BaseRuntimeElementDefinition<?> getChildByName(String theName) {
|
||||
return new RuntimeElementDirectResource();
|
||||
return new RuntimeElementDirectResource(false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Collections;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -29,9 +29,9 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
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.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
@ -60,7 +60,7 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
|
|||
|
||||
@Override
|
||||
public String getChildNameByDatatype(Class<? extends IBase> theDatatype) {
|
||||
if (IReference.class.isAssignableFrom(theDatatype)) {
|
||||
if (IBaseReference.class.isAssignableFrom(theDatatype)) {
|
||||
return getElementName();
|
||||
}
|
||||
return null;
|
||||
|
@ -68,7 +68,7 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
|
|||
|
||||
@Override
|
||||
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theDatatype) {
|
||||
if (IReference.class.isAssignableFrom(theDatatype)) {
|
||||
if (IBaseReference.class.isAssignableFrom(theDatatype)) {
|
||||
return myRuntimeDef;
|
||||
}
|
||||
return null;
|
||||
|
@ -86,7 +86,7 @@ public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefi
|
|||
|
||||
@Override
|
||||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||
myRuntimeDef = new RuntimeResourceReferenceDefinition(getElementName(), myResourceTypes);
|
||||
myRuntimeDef = new RuntimeResourceReferenceDefinition(getElementName(), myResourceTypes, false);
|
||||
myRuntimeDef.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||
|
||||
myValidChildNames = new HashSet<String>();
|
||||
|
|
|
@ -25,13 +25,11 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||
import ca.uhn.fhir.model.api.IDatatype;
|
||||
|
@ -71,9 +69,7 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
|||
|
||||
@Override
|
||||
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theType) {
|
||||
Class<? extends IBase> type = theType;
|
||||
// if (IReference.type)
|
||||
return myDatatypeToDefinition.get(type);
|
||||
return myDatatypeToDefinition.get(theType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,6 +118,8 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
|||
myDatatypeToAttributeName = new HashMap<Class<? extends IBase>, String>();
|
||||
myDatatypeToDefinition = new HashMap<Class<? extends IBase>, BaseRuntimeElementDefinition<?>>();
|
||||
|
||||
// for (theContext.get)
|
||||
|
||||
for (BaseRuntimeElementDefinition<?> next : theClassToElementDefinitions.values()) {
|
||||
if (next instanceof IRuntimeDatatypeDefinition) {
|
||||
// if (next.getName().equals("CodeableConcept")) {
|
||||
|
@ -131,6 +129,11 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
|||
myDatatypeToDefinition.put(next.getImplementingClass(), next);
|
||||
|
||||
if (!((IRuntimeDatatypeDefinition) next).isSpecialization()) {
|
||||
|
||||
if (!next.isStandardType()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String qualifiedName = next.getImplementingClass().getName();
|
||||
|
||||
/*
|
||||
|
@ -176,7 +179,7 @@ public class RuntimeChildUndeclaredExtensionDefinition extends BaseRuntimeChildD
|
|||
private void addReferenceBinding(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions, String value) {
|
||||
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
|
||||
types.add(IBaseResource.class);
|
||||
RuntimeResourceReferenceDefinition def = new RuntimeResourceReferenceDefinition(value, types);
|
||||
RuntimeResourceReferenceDefinition def = new RuntimeResourceReferenceDefinition(value, types, false);
|
||||
def.sealAndInitialize(theContext, theClassToElementDefinitions);
|
||||
|
||||
myAttributeNameToDefinition.put(value, def);
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
import org.hl7.fhir.instance.model.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
|
@ -31,8 +31,8 @@ public class RuntimeCompositeDatatypeDefinition extends BaseRuntimeElementCompos
|
|||
|
||||
private boolean mySpecialization;
|
||||
|
||||
public RuntimeCompositeDatatypeDefinition(DatatypeDef theDef, Class<? extends ICompositeType> theImplementingClass) {
|
||||
super(theDef.name(), theImplementingClass);
|
||||
public RuntimeCompositeDatatypeDefinition(DatatypeDef theDef, Class<? extends ICompositeType> theImplementingClass, boolean theStandardType) {
|
||||
super(theDef.name(), theImplementingClass, theStandardType);
|
||||
|
||||
String resourceName = theDef.name();
|
||||
if (isBlank(resourceName)) {
|
||||
|
|
|
@ -20,15 +20,15 @@ package ca.uhn.fhir.context;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/**
|
||||
* HL7org structures use a List for contained instead of a distinct datatype
|
||||
*/
|
||||
public class RuntimeElemContainedResourceList extends BaseRuntimeElementDefinition<IBaseResource> {
|
||||
|
||||
public RuntimeElemContainedResourceList(Class<IBaseResource> theClass) {
|
||||
super("contained", theClass);
|
||||
public RuntimeElemContainedResourceList(Class<IBaseResource> theClass, boolean theStandardType) {
|
||||
super("contained", theClass, theStandardType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,8 +24,8 @@ import ca.uhn.fhir.model.base.composite.BaseContainedDt;
|
|||
|
||||
public class RuntimeElemContainedResources extends BaseRuntimeElementDefinition<BaseContainedDt> {
|
||||
|
||||
public RuntimeElemContainedResources(Class<? extends BaseContainedDt> theClass) {
|
||||
super("contained", theClass);
|
||||
public RuntimeElemContainedResources(Class<? extends BaseContainedDt> theClass, boolean theStandardType) {
|
||||
super("contained", theClass, theStandardType);
|
||||
assert BaseContainedDt.class.isAssignableFrom(theClass);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@ package ca.uhn.fhir.context;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
public class RuntimeElementDirectResource extends BaseRuntimeElementDefinition<IBaseResource> {
|
||||
|
||||
public RuntimeElementDirectResource() {
|
||||
super("DirectChildResource", IBaseResource.class);
|
||||
public RuntimeElementDirectResource(boolean theStandardType) {
|
||||
super("DirectChildResource", IBaseResource.class, theStandardType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,8 +25,8 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
||||
|
@ -34,8 +34,8 @@ public class RuntimeExtensionDtDefinition extends RuntimeCompositeDatatypeDefini
|
|||
|
||||
private List<BaseRuntimeChildDefinition> myChildren;
|
||||
|
||||
public RuntimeExtensionDtDefinition(DatatypeDef theDef, Class<? extends ICompositeType> theImplementingClass) {
|
||||
super(theDef, theImplementingClass);
|
||||
public RuntimeExtensionDtDefinition(DatatypeDef theDef, Class<? extends ICompositeType> theImplementingClass, boolean theStandardType) {
|
||||
super(theDef, theImplementingClass, theStandardType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,14 +20,14 @@ package ca.uhn.fhir.context;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
||||
public class RuntimeIdDatatypeDefinition extends RuntimePrimitiveDatatypeDefinition implements IRuntimeDatatypeDefinition {
|
||||
|
||||
public RuntimeIdDatatypeDefinition(DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass) {
|
||||
super(theDef, theImplementingClass);
|
||||
public RuntimeIdDatatypeDefinition(DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass, boolean theStandardType) {
|
||||
super(theDef, theImplementingClass, theStandardType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,8 +24,8 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
|
@ -34,8 +34,8 @@ public class RuntimePrimitiveDatatypeDefinition extends BaseRuntimeElementDefini
|
|||
|
||||
private boolean mySpecialization;
|
||||
|
||||
public RuntimePrimitiveDatatypeDefinition(DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass) {
|
||||
super(theDef.name(), theImplementingClass);
|
||||
public RuntimePrimitiveDatatypeDefinition(DatatypeDef theDef, Class<? extends IPrimitiveType<?>> theImplementingClass, boolean theStandardType) {
|
||||
super(theDef.name(), theImplementingClass, theStandardType);
|
||||
|
||||
String resourceName = theDef.name();
|
||||
if (isBlank(resourceName)) {
|
||||
|
|
|
@ -22,14 +22,14 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||
|
||||
public class RuntimePrimitiveDatatypeNarrativeDefinition extends BaseRuntimeElementDefinition<XhtmlDt> {
|
||||
|
||||
public RuntimePrimitiveDatatypeNarrativeDefinition(String theName, Class<XhtmlDt> theImplementingClass) {
|
||||
super(theName, theImplementingClass);
|
||||
public RuntimePrimitiveDatatypeNarrativeDefinition(String theName, Class<XhtmlDt> theImplementingClass, boolean theStandardType) {
|
||||
super(theName, theImplementingClass, theStandardType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,13 +22,13 @@ package ca.uhn.fhir.context;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseXhtml;
|
||||
|
||||
public class RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition extends BaseRuntimeElementDefinition<IBaseXhtml> {
|
||||
|
||||
public RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition(String theName, Class<? extends IBaseXhtml> theImplementingClass) {
|
||||
super(theName, theImplementingClass);
|
||||
public RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition(String theName, Class<? extends IBaseXhtml> theImplementingClass, boolean theStandardType) {
|
||||
super(theName, theImplementingClass, theStandardType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,12 +20,12 @@ package ca.uhn.fhir.context;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
public class RuntimeResourceBlockDefinition extends BaseRuntimeElementCompositeDefinition<IBase> {
|
||||
|
||||
public RuntimeResourceBlockDefinition(String theName, Class<? extends IBase> theImplementingClass) {
|
||||
super(theName, theImplementingClass);
|
||||
public RuntimeResourceBlockDefinition(String theName, Class<? extends IBase> theImplementingClass, boolean theStandardType) {
|
||||
super(theName, theImplementingClass, theStandardType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,9 +27,9 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IRefImplResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
|
@ -50,15 +50,15 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
|
|||
return myStructureVersion;
|
||||
}
|
||||
|
||||
public RuntimeResourceDefinition(FhirContext theContext, String theResourceName, Class<? extends IBaseResource> theClass, ResourceDef theResourceAnnotation) {
|
||||
super(theResourceName, theClass);
|
||||
public RuntimeResourceDefinition(FhirContext theContext, String theResourceName, Class<? extends IBaseResource> theClass, ResourceDef theResourceAnnotation, boolean theStandardType) {
|
||||
super(theResourceName, theClass, theStandardType);
|
||||
myContext= theContext;
|
||||
myResourceProfile = theResourceAnnotation.profile();
|
||||
myId = theResourceAnnotation.id();
|
||||
|
||||
try {
|
||||
IBaseResource instance = theClass.newInstance();
|
||||
if (instance instanceof IAnyResource) {
|
||||
if (instance instanceof IRefImplResource) {
|
||||
myStructureVersion = FhirVersionEnum.DSTU2_HL7ORG;
|
||||
} else {
|
||||
myStructureVersion = ((IResource)instance).getStructureFhirVersionEnum();
|
||||
|
|
|
@ -24,9 +24,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IRefImplResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
||||
|
@ -38,9 +38,10 @@ public class RuntimeResourceReferenceDefinition extends BaseRuntimeElementDefini
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
* @param theStandardType
|
||||
*/
|
||||
public RuntimeResourceReferenceDefinition(String theName, List<Class<? extends IBaseResource>> theResourceTypes) {
|
||||
super(theName, BaseResourceReferenceDt.class);
|
||||
public RuntimeResourceReferenceDefinition(String theName, List<Class<? extends IBaseResource>> theResourceTypes, boolean theStandardType) {
|
||||
super(theName, BaseResourceReferenceDt.class, theStandardType);
|
||||
if (theResourceTypes == null || theResourceTypes.isEmpty()) {
|
||||
throw new ConfigurationException("Element '" + theName + "' has no resource types noted");
|
||||
}
|
||||
|
@ -55,7 +56,7 @@ public class RuntimeResourceReferenceDefinition extends BaseRuntimeElementDefini
|
|||
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
|
||||
myResourceTypeToDefinition = new HashMap<Class<? extends IBaseResource>, RuntimeResourceDefinition>();
|
||||
for (Class<? extends IBaseResource> next : myResourceTypes) {
|
||||
if (next.equals(IResource.class) || next.equals(IAnyResource.class) || next.equals(IBaseResource.class)) {
|
||||
if (next.equals(IResource.class) || next.equals(IRefImplResource.class) || next.equals(IBaseResource.class)) {
|
||||
continue;
|
||||
}
|
||||
RuntimeResourceDefinition definition = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next);
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.model.api;
|
|||
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
|
@ -47,7 +48,7 @@ import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
|||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
|
||||
public class Bundle extends BaseBundle /* implements IElement */{
|
||||
public class Bundle extends BaseBundle implements IBase /* implements IElement */{
|
||||
|
||||
private ResourceMetadataMap myResourceMetadata;
|
||||
private BoundCodeDt<BundleTypeEnum> myType;
|
||||
|
|
|
@ -32,7 +32,7 @@ import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
|||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
|
||||
@DatatypeDef(name = "Extension")
|
||||
public class ExtensionDt extends BaseIdentifiableElement implements ICompositeDatatype, IBaseExtension<ExtensionDt> {
|
||||
public class ExtensionDt extends BaseIdentifiableElement implements ICompositeDatatype, IBaseExtension<ExtensionDt, IDatatype> {
|
||||
|
||||
private boolean myModifier;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.model.api;
|
||||
|
||||
import org.hl7.fhir.instance.model.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.model.api;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
|
|
|
@ -22,8 +22,8 @@ package ca.uhn.fhir.model.api;
|
|||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.model.api;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ import java.util.Arrays;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
||||
/**
|
||||
* This interface is the parent interface for all FHIR Resource definition
|
||||
* classes. Classes implementing this interface should be annotated
|
||||
|
@ -42,11 +44,10 @@ import java.util.Set;
|
|||
* should not need to implement it directly.
|
||||
* </p>
|
||||
*/
|
||||
public interface IResource extends ICompositeElement, org.hl7.fhir.instance.model.IBaseResource {
|
||||
public interface IResource extends ICompositeElement, org.hl7.fhir.instance.model.api.IBaseResource {
|
||||
public static final Include INCLUDE_ALL = new Include("*");
|
||||
public static final Set<Include> WILDCARD_ALL_SET = new HashSet<Include>(Arrays.asList(INCLUDE_ALL));
|
||||
|
||||
|
||||
/**
|
||||
* Returns the contained resource list for this resource.
|
||||
* <p>
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.LinkedHashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
/**
|
||||
* A collection of tags present on a single resource. TagList is backed by a {@link LinkedHashSet}, so the order of added tags will be consistent, but duplicates will not be preserved.
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
@Target(value=ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
|
@ -27,9 +27,9 @@ import org.apache.http.HttpResponse;
|
|||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.BaseIdentifiableElement;
|
||||
|
@ -40,7 +40,7 @@ import ca.uhn.fhir.parser.IParser;
|
|||
import ca.uhn.fhir.rest.client.BaseClient;
|
||||
import ca.uhn.fhir.rest.client.api.IRestfulClient;
|
||||
|
||||
public abstract class BaseResourceReferenceDt extends BaseIdentifiableElement implements IBaseDatatype, IReference {
|
||||
public abstract class BaseResourceReferenceDt extends BaseIdentifiableElement implements IBaseDatatype, IBaseReference {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseResourceReferenceDt.class);
|
||||
private IBaseResource myResource;
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.apache.commons.lang3.ObjectUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IRefImplResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
||||
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||
|
@ -546,8 +546,8 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
|
|||
throw new NullPointerException("theResource can not be null");
|
||||
} else if (theResouce instanceof IResource) {
|
||||
((IResource) theResouce).setId(new IdDt(getValue()));
|
||||
} else if (theResouce instanceof IAnyResource) {
|
||||
((IAnyResource) theResouce).setId(getValue());
|
||||
} else if (theResouce instanceof IRefImplResource) {
|
||||
((IRefImplResource) theResouce).setId(getValue());
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown resource class type, does not implement IResource or extend Resource");
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
|
|||
if (theResouce == null) {
|
||||
throw new NullPointerException("theResource can not be null");
|
||||
} else if (theResouce instanceof IBaseResource) {
|
||||
IIdType retVal = ((IBaseResource) theResouce).getId();
|
||||
IIdType retVal = ((IBaseResource) theResouce).getIdElement();
|
||||
if (retVal == null) {
|
||||
return null;
|
||||
} else if (retVal instanceof IdDt) {
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.model.view;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.Properties;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.io.input.ReaderInputStream;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.thymeleaf.Arguments;
|
||||
import org.thymeleaf.Configuration;
|
||||
import org.thymeleaf.TemplateEngine;
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.narrative;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
|
||||
|
|
|
@ -37,13 +37,13 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IRefImplResource;
|
||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
|
||||
|
@ -94,9 +94,9 @@ public abstract class BaseParser implements IParser {
|
|||
}
|
||||
}
|
||||
} else if (theTarget instanceof IDomainResource) {
|
||||
List<? extends IAnyResource> containedResources = ((IDomainResource) theTarget).getContained();
|
||||
for (IAnyResource next : containedResources) {
|
||||
String nextId = next.getId().getValue();
|
||||
List<? extends IRefImplResource> containedResources = ((IDomainResource) theTarget).getContained();
|
||||
for (IRefImplResource next : containedResources) {
|
||||
String nextId = next.getIdElement().getValue();
|
||||
if (StringUtils.isNotBlank(nextId)) {
|
||||
if (!nextId.startsWith("#")) {
|
||||
nextId = '#' + nextId;
|
||||
|
@ -113,22 +113,22 @@ public abstract class BaseParser implements IParser {
|
|||
}
|
||||
|
||||
{
|
||||
List<IReference> allElements = myContext.newTerser().getAllPopulatedChildElementsOfType(theResource, IReference.class);
|
||||
for (IReference next : allElements) {
|
||||
List<IBaseReference> allElements = myContext.newTerser().getAllPopulatedChildElementsOfType(theResource, IBaseReference.class);
|
||||
for (IBaseReference next : allElements) {
|
||||
IBaseResource resource = next.getResource();
|
||||
if (resource != null) {
|
||||
if (resource.getId().isEmpty() || resource.getId().isLocal()) {
|
||||
if (resource.getIdElement().isEmpty() || resource.getIdElement().isLocal()) {
|
||||
theContained.addContained(resource);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
containResourcesForEncoding(theContained, resource, theTarget);
|
||||
} else if (next.getReference().isLocal()) {
|
||||
} else if (next.getReferenceElement().isLocal()) {
|
||||
if (existingIdToContainedResource != null) {
|
||||
IBaseResource potentialTarget = existingIdToContainedResource.remove(next.getReference().getValue());
|
||||
IBaseResource potentialTarget = existingIdToContainedResource.remove(next.getReferenceElement().getValue());
|
||||
if (potentialTarget != null) {
|
||||
theContained.addContained(next.getReference(), potentialTarget);
|
||||
theContained.addContained(next.getReferenceElement(), potentialTarget);
|
||||
containResourcesForEncoding(theContained, potentialTarget, theTarget);
|
||||
}
|
||||
}
|
||||
|
@ -144,8 +144,8 @@ public abstract class BaseParser implements IParser {
|
|||
myContainedResources = contained;
|
||||
}
|
||||
|
||||
protected String determineReferenceText(IReference theRef) {
|
||||
IIdType ref = theRef.getReference();
|
||||
protected String determineReferenceText(IBaseReference theRef) {
|
||||
IIdType ref = theRef.getReferenceElement();
|
||||
if (isBlank(ref.getIdPart())) {
|
||||
String reference = ref.getValue();
|
||||
if (theRef.getResource() != null) {
|
||||
|
@ -156,11 +156,11 @@ public abstract class BaseParser implements IParser {
|
|||
} else {
|
||||
reference = "#" + containedId.getValue();
|
||||
}
|
||||
} else if (theRef.getResource().getId() != null && theRef.getResource().getId().hasIdPart()) {
|
||||
} else if (theRef.getResource().getIdElement() != null && theRef.getResource().getIdElement().hasIdPart()) {
|
||||
if (isStripVersionsFromReferences()) {
|
||||
reference = theRef.getResource().getId().toVersionless().getValue();
|
||||
reference = theRef.getResource().getIdElement().toVersionless().getValue();
|
||||
} else {
|
||||
reference = theRef.getResource().getId().getValue();
|
||||
reference = theRef.getResource().getIdElement().getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public abstract class BaseParser implements IParser {
|
|||
if (base != null && base.size() > 0) {
|
||||
IPrimitiveType<?> baseType = (IPrimitiveType<?>) base.get(0);
|
||||
IBaseResource res = ((IBaseResource) retVal);
|
||||
res.setId(new IdDt(baseType.getValueAsString(), def.getName(), res.getId().getIdPart(), res.getId().getVersionIdPart()));
|
||||
res.setId(new IdDt(baseType.getValueAsString(), def.getName(), res.getIdElement().getIdPart(), res.getIdElement().getVersionIdPart()));
|
||||
}
|
||||
|
||||
BaseRuntimeChildDefinition entryChild = def.getChildByName("entry");
|
||||
|
@ -305,12 +305,12 @@ public abstract class BaseParser implements IParser {
|
|||
if (entryResources != null && entryResources.size() > 0) {
|
||||
IBaseResource res = (IBaseResource) entryResources.get(0);
|
||||
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(res);
|
||||
String versionIdPart = res.getId().getVersionIdPart();
|
||||
String versionIdPart = res.getIdElement().getVersionIdPart();
|
||||
if (isBlank(versionIdPart) && res instanceof IResource) {
|
||||
versionIdPart = ResourceMetadataKeyEnum.VERSION.get((IResource) res);
|
||||
}
|
||||
|
||||
res.setId(new IdDt(baseType.getValueAsString(), resDef.getName(), res.getId().getIdPart(), versionIdPart));
|
||||
res.setId(new IdDt(baseType.getValueAsString(), resDef.getName(), res.getIdElement().getIdPart(), versionIdPart));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -399,8 +399,8 @@ public abstract class BaseParser implements IParser {
|
|||
}
|
||||
|
||||
IIdType newId;
|
||||
if (theResource.getId().isLocal()) {
|
||||
newId = theResource.getId();
|
||||
if (theResource.getIdElement().isLocal()) {
|
||||
newId = theResource.getIdElement();
|
||||
} else {
|
||||
// TODO: make this configurable between the two below (and something else?)
|
||||
// newId = new IdDt(UUID.randomUUID().toString());
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.io.IOException;
|
|||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
|
|
|
@ -51,10 +51,10 @@ import javax.json.stream.JsonParsingException;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IRefImplResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
|
@ -64,7 +64,7 @@ import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
|||
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
||||
|
@ -143,7 +143,7 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
myContext = theContext;
|
||||
}
|
||||
|
||||
private void addToHeldExtensions(int valueIdx, List<? extends IBaseExtension<?>> ext, ArrayList<ArrayList<HeldExtension>> list, boolean theIsModifier) {
|
||||
private void addToHeldExtensions(int valueIdx, List<? extends IBaseExtension<?, ?>> ext, ArrayList<ArrayList<HeldExtension>> list, boolean theIsModifier) {
|
||||
if (ext.size() > 0) {
|
||||
list.ensureCapacity(valueIdx);
|
||||
while (list.size() <= valueIdx) {
|
||||
|
@ -152,7 +152,7 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
if (list.get(valueIdx) == null) {
|
||||
list.set(valueIdx, new ArrayList<JsonParser.HeldExtension>());
|
||||
}
|
||||
for (IBaseExtension<?> next : ext) {
|
||||
for (IBaseExtension<?, ?> next : ext) {
|
||||
list.get(valueIdx).add(new HeldExtension(next, theIsModifier));
|
||||
}
|
||||
}
|
||||
|
@ -413,14 +413,14 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
theWriter.writeStartObject();
|
||||
}
|
||||
if (theNextValue instanceof IBaseExtension) {
|
||||
theWriter.write("url", ((IBaseExtension<?>) theNextValue).getUrl());
|
||||
theWriter.write("url", ((IBaseExtension<?, ?>) theNextValue).getUrl());
|
||||
}
|
||||
encodeCompositeElementToStreamWriter(theResDef, theResource, theNextValue, theWriter, childCompositeDef, theContainedResource);
|
||||
theWriter.writeEnd();
|
||||
break;
|
||||
}
|
||||
case RESOURCE_REF: {
|
||||
IReference referenceDt = (IReference) theNextValue;
|
||||
IBaseReference referenceDt = (IBaseReference) theNextValue;
|
||||
if (theChildName != null) {
|
||||
theWriter.writeStartObject(theChildName);
|
||||
} else {
|
||||
|
@ -596,12 +596,12 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
} else {
|
||||
if (nextValue instanceof IBaseHasExtensions) {
|
||||
IBaseHasExtensions element = (IBaseHasExtensions) nextValue;
|
||||
List<? extends IBaseExtension<?>> ext = element.getExtension();
|
||||
List<? extends IBaseExtension<?, ?>> ext = element.getExtension();
|
||||
addToHeldExtensions(valueIdx, ext, extensions, false);
|
||||
}
|
||||
if (nextValue instanceof IBaseHasModifierExtensions) {
|
||||
IBaseHasModifierExtensions element = (IBaseHasModifierExtensions) nextValue;
|
||||
List<? extends IBaseExtension<?>> ext = element.getModifierExtension();
|
||||
List<? extends IBaseExtension<?, ?>> ext = element.getModifierExtension();
|
||||
addToHeldExtensions(valueIdx, ext, extensions, true);
|
||||
}
|
||||
}
|
||||
|
@ -676,10 +676,10 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
resourceId = res.getId().getIdPart();
|
||||
}
|
||||
}
|
||||
} else if (theResource instanceof IAnyResource) {
|
||||
IAnyResource res = (IAnyResource) theResource;
|
||||
if (StringUtils.isNotBlank(res.getId().getIdPart())) {
|
||||
resourceId = res.getId().getIdPart();
|
||||
} else if (theResource instanceof IRefImplResource) {
|
||||
IRefImplResource res = (IRefImplResource) theResource;
|
||||
if (/*theContainedResource && */ StringUtils.isNotBlank(res.getIdElement().getIdPart())) {
|
||||
resourceId = res.getIdElement().getIdPart();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -876,8 +876,8 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
} else {
|
||||
if (theElement instanceof IBaseHasExtensions) {
|
||||
IBaseHasExtensions element = (IBaseHasExtensions) theElement;
|
||||
List<? extends IBaseExtension<?>> ext = element.getExtension();
|
||||
for (IBaseExtension<?> next : ext) {
|
||||
List<? extends IBaseExtension<?, ?>> ext = element.getExtension();
|
||||
for (IBaseExtension<?, ?> next : ext) {
|
||||
if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) {
|
||||
continue;
|
||||
}
|
||||
|
@ -886,8 +886,8 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
}
|
||||
if (theElement instanceof IBaseHasModifierExtensions) {
|
||||
IBaseHasModifierExtensions element = (IBaseHasModifierExtensions) theElement;
|
||||
List<? extends IBaseExtension<?>> ext = element.getModifierExtension();
|
||||
for (IBaseExtension<?> next : ext) {
|
||||
List<? extends IBaseExtension<?, ?>> ext = element.getModifierExtension();
|
||||
for (IBaseExtension<?, ?> next : ext) {
|
||||
if (next == null || next.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1096,7 +1096,7 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
if (object instanceof IIdentifiableElement) {
|
||||
((IIdentifiableElement) object).setElementSpecificId(elementId);
|
||||
} else if (object instanceof IBaseResource) {
|
||||
((IBaseResource) object).getId().setValue(elementId);
|
||||
((IBaseResource) object).getIdElement().setValue(elementId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1384,11 +1384,11 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
private class HeldExtension implements Comparable<HeldExtension> {
|
||||
|
||||
private RuntimeChildDeclaredExtensionDefinition myDef;
|
||||
private IBaseExtension<?> myUndeclaredExtension;
|
||||
private IBaseExtension<?, ?> myUndeclaredExtension;
|
||||
private IBase myValue;
|
||||
private boolean myModifier;
|
||||
|
||||
public HeldExtension(IBaseExtension<?> theUndeclaredExtension, boolean theModifier) {
|
||||
public HeldExtension(IBaseExtension<?, ?> theUndeclaredExtension, boolean theModifier) {
|
||||
assert theUndeclaredExtension != null;
|
||||
myUndeclaredExtension = theUndeclaredExtension;
|
||||
myModifier = theModifier;
|
||||
|
@ -1420,7 +1420,7 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
}
|
||||
}
|
||||
|
||||
private void writeUndeclaredExtInDstu1Format(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonGenerator theEventWriter, IBaseExtension<?> ext) throws IOException {
|
||||
private void writeUndeclaredExtInDstu1Format(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonGenerator theEventWriter, IBaseExtension<?, ?> ext) throws IOException {
|
||||
IBaseDatatype value = ext.getValue();
|
||||
String extensionUrl = ext.getUrl();
|
||||
|
||||
|
@ -1439,7 +1439,7 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
}
|
||||
|
||||
for (Object next : ext.getExtension()) {
|
||||
writeUndeclaredExtInDstu1Format(theResDef, theResource, theEventWriter, (IBaseExtension<?>) next);
|
||||
writeUndeclaredExtInDstu1Format(theResDef, theResource, theEventWriter, (IBaseExtension<?, ?>) next);
|
||||
}
|
||||
theEventWriter.writeEnd();
|
||||
} else {
|
||||
|
|
|
@ -32,18 +32,18 @@ import javax.xml.stream.events.XMLEvent;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
import org.hl7.fhir.instance.model.api.IBaseElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseXhtml;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition.IMutator;
|
||||
|
@ -821,7 +821,7 @@ class ParserState<T> {
|
|||
} else {
|
||||
if (theIsModifier == false) {
|
||||
if (getCurrentElement() instanceof IBaseHasExtensions) {
|
||||
IBaseExtension<?> ext = ((IBaseHasExtensions) getCurrentElement()).addExtension();
|
||||
IBaseExtension<?, ?> ext = ((IBaseHasExtensions) getCurrentElement()).addExtension();
|
||||
ext.setUrl(theUrlAttr);
|
||||
ParserState<T>.ExtensionState newState = new ExtensionState(myPreResourceState, ext);
|
||||
push(newState);
|
||||
|
@ -830,7 +830,7 @@ class ParserState<T> {
|
|||
}
|
||||
} else {
|
||||
if (getCurrentElement() instanceof IBaseHasModifierExtensions) {
|
||||
IBaseExtension<?> ext = ((IBaseHasModifierExtensions) getCurrentElement()).addModifierExtension();
|
||||
IBaseExtension<?, ?> ext = ((IBaseHasModifierExtensions) getCurrentElement()).addModifierExtension();
|
||||
ext.setUrl(theUrlAttr);
|
||||
ParserState<T>.ExtensionState newState = new ExtensionState(myPreResourceState, ext);
|
||||
push(newState);
|
||||
|
@ -1383,12 +1383,12 @@ class ParserState<T> {
|
|||
public void wereBack() {
|
||||
IBaseResource res = getCurrentElement();
|
||||
assert res != null;
|
||||
if (res.getId() == null || res.getId().isEmpty()) {
|
||||
if (res.getIdElement() == null || res.getIdElement().isEmpty()) {
|
||||
ourLog.debug("Discarding contained resource with no ID!");
|
||||
} else {
|
||||
getPreResourceState().getContainedResources().put(res.getId().getValue(), res);
|
||||
if (!res.getId().isLocal()) {
|
||||
res.getId().setValue('#' + res.getId().getIdPart());
|
||||
getPreResourceState().getContainedResources().put(res.getIdElement().getValue(), res);
|
||||
if (!res.getIdElement().isLocal()) {
|
||||
res.getIdElement().setValue('#' + res.getIdElement().getIdPart());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1483,8 +1483,8 @@ class ParserState<T> {
|
|||
|
||||
private BaseState createResourceReferenceState(ParserState<T>.PreResourceState thePreResourceState, IBase newChildInstance) {
|
||||
BaseState newState;
|
||||
if (newChildInstance instanceof IReference) {
|
||||
newState = new ResourceReferenceStateHl7Org(thePreResourceState, (IReference) newChildInstance);
|
||||
if (newChildInstance instanceof IBaseReference) {
|
||||
newState = new ResourceReferenceStateHl7Org(thePreResourceState, (IBaseReference) newChildInstance);
|
||||
} else {
|
||||
newState = new ResourceReferenceStateHapi(thePreResourceState, (BaseResourceReferenceDt) newChildInstance);
|
||||
}
|
||||
|
@ -1657,9 +1657,9 @@ class ParserState<T> {
|
|||
|
||||
private class ExtensionState extends BaseState {
|
||||
|
||||
private IBaseExtension<?> myExtension;
|
||||
private IBaseExtension<?, ?> myExtension;
|
||||
|
||||
public ExtensionState(PreResourceState thePreResourceState, IBaseExtension<?> theExtension) {
|
||||
public ExtensionState(PreResourceState thePreResourceState, IBaseExtension<?, ?> theExtension) {
|
||||
super(thePreResourceState);
|
||||
myExtension = theExtension;
|
||||
}
|
||||
|
@ -1700,7 +1700,7 @@ class ParserState<T> {
|
|||
ICompositeType newChildInstance = (ICompositeType) newResourceReferenceDt(getPreResourceState().myInstance);
|
||||
myExtension.setValue(newChildInstance);
|
||||
if (myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
|
||||
ParserState<T>.ResourceReferenceStateHl7Org newState = new ResourceReferenceStateHl7Org(getPreResourceState(), (IReference) newChildInstance);
|
||||
ParserState<T>.ResourceReferenceStateHl7Org newState = new ResourceReferenceStateHl7Org(getPreResourceState(), (IBaseReference) newChildInstance);
|
||||
push(newState);
|
||||
} else {
|
||||
ResourceReferenceStateHapi newState = new ResourceReferenceStateHapi(getPreResourceState(), (BaseResourceReferenceDt) newChildInstance);
|
||||
|
@ -1722,7 +1722,7 @@ class ParserState<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected IBaseExtension<?> getCurrentElement() {
|
||||
protected IBaseExtension<?, ?> getCurrentElement() {
|
||||
return myExtension;
|
||||
}
|
||||
|
||||
|
@ -1955,12 +1955,12 @@ class ParserState<T> {
|
|||
IDomainResource elem = (IDomainResource) getCurrentElement();
|
||||
String resourceName = myContext.getResourceDefinition(elem).getName();
|
||||
String versionId = elem.getMeta().getVersionId();
|
||||
if (StringUtils.isBlank(elem.getId().getIdPart())) {
|
||||
if (StringUtils.isBlank(elem.getIdElement().getIdPart())) {
|
||||
// Resource has no ID
|
||||
} else if (StringUtils.isNotBlank(versionId)) {
|
||||
elem.getIdElement().setValue(resourceName + "/" + elem.getId().getIdPart() + "/_history/" + versionId);
|
||||
elem.getIdElement().setValue(resourceName + "/" + elem.getIdElement().getIdPart() + "/_history/" + versionId);
|
||||
} else {
|
||||
elem.getIdElement().setValue(resourceName + "/" + elem.getId().getIdPart());
|
||||
elem.getIdElement().setValue(resourceName + "/" + elem.getIdElement().getIdPart());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2078,9 +2078,9 @@ class ParserState<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (theElement instanceof IReference) {
|
||||
IReference nextRef = (IReference) theElement;
|
||||
String ref = nextRef.getReference().getValue();
|
||||
}else if (theElement instanceof IBaseReference) {
|
||||
IBaseReference nextRef = (IBaseReference) theElement;
|
||||
String ref = nextRef.getReferenceElement().getValue();
|
||||
if (isNotBlank(ref)) {
|
||||
if (ref.startsWith("#")) {
|
||||
IBaseResource target = myContainedResources.get(ref.substring(1));
|
||||
|
@ -2192,7 +2192,7 @@ class ParserState<T> {
|
|||
} else if (myInstance instanceof IBaseElement) {
|
||||
((IBaseElement) myInstance).setId(theValue);
|
||||
} else if (myInstance instanceof IBaseResource) {
|
||||
new IdDt(theValue).applyTo((org.hl7.fhir.instance.model.IBaseResource) myInstance);
|
||||
new IdDt(theValue).applyTo((org.hl7.fhir.instance.model.api.IBaseResource) myInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2232,10 +2232,10 @@ class ParserState<T> {
|
|||
|
||||
private class ResourceReferenceStateHl7Org extends BaseState {
|
||||
|
||||
private IReference myInstance;
|
||||
private IBaseReference myInstance;
|
||||
private ResourceReferenceSubState mySubState;
|
||||
|
||||
public ResourceReferenceStateHl7Org(PreResourceState thePreResourceState, IReference theInstance) {
|
||||
public ResourceReferenceStateHl7Org(PreResourceState thePreResourceState, IBaseReference theInstance) {
|
||||
super(thePreResourceState);
|
||||
myInstance = theInstance;
|
||||
mySubState = ResourceReferenceSubState.INITIAL;
|
||||
|
@ -2293,7 +2293,7 @@ class ParserState<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected IReference getCurrentElement() {
|
||||
protected IBaseReference getCurrentElement() {
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,10 @@ import javax.xml.stream.events.StartElement;
|
|||
import javax.xml.stream.events.XMLEvent;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IRefImplResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
|
@ -60,7 +60,7 @@ import org.hl7.fhir.instance.model.api.IBaseXhtml;
|
|||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.INarrative;
|
||||
import org.hl7.fhir.instance.model.api.IReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
||||
|
@ -490,7 +490,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
break;
|
||||
}
|
||||
case RESOURCE_REF: {
|
||||
IReference ref = (IReference) nextValue;
|
||||
IBaseReference ref = (IBaseReference) nextValue;
|
||||
if (!ref.isEmpty()) {
|
||||
theEventWriter.writeStartElement(childName);
|
||||
encodeResourceReferenceToStreamWriter(theEventWriter, ref, theResource, theIncludedResource);
|
||||
|
@ -616,7 +616,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
|
||||
if (nextValue instanceof IBaseExtension && myContext.getVersion().getVersion() == FhirVersionEnum.DSTU1) {
|
||||
// This is called for the Query resource in DSTU1 only
|
||||
extensionUrl = ((IBaseExtension<?>) nextValue).getUrl();
|
||||
extensionUrl = ((IBaseExtension<?, ?>) nextValue).getUrl();
|
||||
encodeChildElementToStreamWriter(theResource, theEventWriter, nextValue, childName, childDef, extensionUrl, theIncludedResource);
|
||||
|
||||
} else if (extensionUrl != null && childName.equals("extension") == false) {
|
||||
|
@ -664,16 +664,16 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
|
||||
/**
|
||||
* This is just to work around the fact that casting java.util.List<ca.uhn.fhir.model.api.ExtensionDt> to
|
||||
* java.util.List<? extends org.hl7.fhir.instance.model.api.IBaseExtension<?>> seems to be rejected by the compiler
|
||||
* java.util.List<? extends org.hl7.fhir.instance.model.api.IBaseExtension<?, ?>> seems to be rejected by the compiler
|
||||
* some of the time.
|
||||
*/
|
||||
private <Q extends IBaseExtension<?>> List<IBaseExtension<?>> toBaseExtensionList(final List<Q> theList) {
|
||||
List<IBaseExtension<?>> retVal = new ArrayList<IBaseExtension<?>>(theList.size());
|
||||
private <Q extends IBaseExtension<?, ?>> List<IBaseExtension<?, ?>> toBaseExtensionList(final List<Q> theList) {
|
||||
List<IBaseExtension<?, ?>> retVal = new ArrayList<IBaseExtension<?, ?>>(theList.size());
|
||||
retVal.addAll(theList);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private void encodeResourceReferenceToStreamWriter(XMLStreamWriter theEventWriter, IReference theRef, IBaseResource theResource, boolean theIncludedResource) throws XMLStreamException {
|
||||
private void encodeResourceReferenceToStreamWriter(XMLStreamWriter theEventWriter, IBaseReference theRef, IBaseResource theResource, boolean theIncludedResource) throws XMLStreamException {
|
||||
String reference = determineReferenceText(theRef);
|
||||
|
||||
encodeExtensionsIfPresent(theResource, theEventWriter, theRef, theIncludedResource);
|
||||
|
@ -751,9 +751,9 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
}
|
||||
} else {
|
||||
// HL7 structs
|
||||
IAnyResource resource = (IAnyResource) theResource;
|
||||
if (StringUtils.isNotBlank(resource.getId().getIdPart())) {
|
||||
resourceId = resource.getId().getIdPart();
|
||||
IRefImplResource resource = (IRefImplResource) theResource;
|
||||
if (StringUtils.isNotBlank(resource.getIdElement().getIdPart())) {
|
||||
resourceId = resource.getIdElement().getIdPart();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -773,7 +773,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
theEventWriter.writeStartElement(resDef.getName());
|
||||
theEventWriter.writeDefaultNamespace(FHIR_NS);
|
||||
|
||||
if (theResource instanceof IAnyResource) {
|
||||
if (theResource instanceof IRefImplResource) {
|
||||
|
||||
// HL7.org Structures
|
||||
writeOptionalTagWithValue(theEventWriter, "id", theResourceId);
|
||||
|
@ -890,8 +890,8 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
}
|
||||
}
|
||||
|
||||
private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theWriter, List<? extends IBaseExtension<?>> theExtensions, String tagName, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
for (IBaseExtension<?> next : theExtensions) {
|
||||
private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theWriter, List<? extends IBaseExtension<?, ?>> theExtensions, String tagName, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
for (IBaseExtension<?, ?> next : theExtensions) {
|
||||
if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/**
|
||||
* RESTful method annotation used for a method which provides FHIR "operations".
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -37,11 +37,11 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseConformance;
|
||||
import org.hl7.fhir.instance.model.api.IBaseParameters;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
|
@ -283,7 +283,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
if (isNotBlank(theId)) {
|
||||
return theId;
|
||||
}
|
||||
return theResource.getId().getIdPart();
|
||||
return theResource.getIdElement().getIdPart();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1578,7 +1578,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
private final class TransactionExecutable<T> extends BaseClientExecutable<ITransactionTyped<T>, T> implements ITransactionTyped<T> {
|
||||
|
||||
private Bundle myBundle;
|
||||
private List<IBaseResource> myResources;
|
||||
private List<? extends IBaseResource> myResources;
|
||||
private IBaseBundle myBaseBundle;
|
||||
private String myRawBundle;
|
||||
private EncodingEnum myRawBundleEncoding;
|
||||
|
@ -1588,7 +1588,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
}
|
||||
|
||||
public TransactionExecutable(List<? extends IBaseResource> theResources) {
|
||||
myResources = new ArrayList<IBaseResource>(theResources);
|
||||
myResources = theResources;
|
||||
}
|
||||
|
||||
public TransactionExecutable(IBaseBundle theBundle) {
|
||||
|
@ -1709,7 +1709,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
invocation = MethodUtil.createUpdateInvocation(myContext, myResource, myResourceBody, myCriterionList.toParamList());
|
||||
} else {
|
||||
if (myId == null) {
|
||||
myId = myResource.getId();
|
||||
myId = myResource.getIdElement();
|
||||
}
|
||||
if (myId == null || myId.hasIdPart() == false) {
|
||||
throw new InvalidRequestException("No ID supplied for resource to update, can not invoke server");
|
||||
|
|
|
@ -23,7 +23,7 @@ package ca.uhn.fhir.rest.client;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
|
@ -35,7 +35,7 @@ import ca.uhn.fhir.model.primitive.UriDt;
|
|||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.client.api.IRestfulClient;
|
||||
import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
|
||||
import ca.uhn.fhir.rest.client.exceptions.FhirClientInnapropriateForServerException;
|
||||
import ca.uhn.fhir.rest.client.exceptions.FhirClientInappropriateForServerException;
|
||||
import ca.uhn.fhir.rest.gclient.ICreate;
|
||||
import ca.uhn.fhir.rest.gclient.IDelete;
|
||||
import ca.uhn.fhir.rest.gclient.IFetchConformanceUntyped;
|
||||
|
@ -116,7 +116,7 @@ public interface IGenericClient extends IRestfulClient {
|
|||
*
|
||||
* @throws FhirClientConnectionException
|
||||
* if the conformance statement cannot be read, or if the client
|
||||
* @throws FhirClientInnapropriateForServerException
|
||||
* @throws FhirClientInappropriateForServerException
|
||||
* If the conformance statement indicates that the server is inappropriate for this client (e.g. it implements the wrong version of FHIR)
|
||||
*/
|
||||
void forceConformanceCheck() throws FhirClientConnectionException;
|
||||
|
|
|
@ -43,15 +43,15 @@ import org.apache.http.impl.client.HttpClientBuilder;
|
|||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.client.ProxyAuthenticationStrategy;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.rest.client.api.IRestfulClient;
|
||||
import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
|
||||
import ca.uhn.fhir.rest.client.exceptions.FhirClientInnapropriateForServerException;
|
||||
import ca.uhn.fhir.rest.client.exceptions.FhirClientInappropriateForServerException;
|
||||
import ca.uhn.fhir.rest.method.BaseMethodBinding;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.util.FhirTerser;
|
||||
|
@ -316,7 +316,7 @@ public class RestfulClientFactory implements IRestfulClientFactory {
|
|||
if (serverFhirVersionEnum != null) {
|
||||
FhirVersionEnum contextFhirVersion = myContext.getVersion().getVersion();
|
||||
if (!contextFhirVersion.isEquivalentTo(serverFhirVersionEnum)) {
|
||||
throw new FhirClientInnapropriateForServerException(myContext.getLocalizer().getMessage(RestfulClientFactory.class, "wrongVersionInConformance", theServerBase + Constants.URL_TOKEN_METADATA, serverFhirVersionString, serverFhirVersionEnum, contextFhirVersion));
|
||||
throw new FhirClientInappropriateForServerException(myContext.getLocalizer().getMessage(RestfulClientFactory.class, "wrongVersionInConformance", theServerBase + Constants.URL_TOKEN_METADATA, serverFhirVersionString, serverFhirVersionEnum, contextFhirVersion));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,19 +27,19 @@ import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
|||
* communicate with a server which is a valid FHIR server but is incompatible
|
||||
* with this client for some reason.
|
||||
*/
|
||||
public class FhirClientInnapropriateForServerException extends BaseServerResponseException {
|
||||
public class FhirClientInappropriateForServerException extends BaseServerResponseException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FhirClientInnapropriateForServerException(Throwable theCause) {
|
||||
public FhirClientInappropriateForServerException(Throwable theCause) {
|
||||
super(0, theCause);
|
||||
}
|
||||
|
||||
public FhirClientInnapropriateForServerException(String theMessage, Throwable theCause) {
|
||||
public FhirClientInappropriateForServerException(String theMessage, Throwable theCause) {
|
||||
super(0, theMessage, theCause);
|
||||
}
|
||||
|
||||
public FhirClientInnapropriateForServerException(String theMessage) {
|
||||
public FhirClientInappropriateForServerException(String theMessage) {
|
||||
super(0, theMessage);
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.gclient;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
||||
public interface IBaseOn<T> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.gclient;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
public interface IReadExecutable<T extends IBaseResource> extends IClientExecutable<IReadExecutable<T>, T>{
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.gclient;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.rest.server.exceptions.NotModifiedException;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.gclient;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ package ca.uhn.fhir.rest.gclient;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.gclient;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.gclient;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
public interface IUpdate {
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Map;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -33,8 +33,8 @@ import org.apache.http.client.methods.HttpRequestBase;
|
|||
import org.apache.http.entity.AbstractHttpEntity;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
|
@ -65,7 +65,7 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
|
|||
private String myIfNoneExistString;
|
||||
private Map<String, List<String>> myParams;
|
||||
private final IBaseResource myResource;
|
||||
private final List<IBaseResource> myResources;
|
||||
private final List<? extends IBaseResource> myResources;
|
||||
private final TagList myTagList;
|
||||
private final String myUrlPath;
|
||||
|
||||
|
@ -105,7 +105,7 @@ abstract class BaseHttpClientInvocationWithContents extends BaseHttpClientInvoca
|
|||
myBundleType = null;
|
||||
}
|
||||
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, List<IBaseResource> theResources, BundleTypeEnum theBundleType) {
|
||||
public BaseHttpClientInvocationWithContents(FhirContext theContext, List<? extends IBaseResource> theResources, BundleTypeEnum theBundleType) {
|
||||
myContext = theContext;
|
||||
myResource = null;
|
||||
myTagList = null;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.Set;
|
|||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -36,7 +36,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -25,8 +25,8 @@ import java.lang.reflect.Method;
|
|||
import java.lang.reflect.Modifier;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -35,7 +35,8 @@ import java.util.Set;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -1,371 +0,0 @@
|
|||
package ca.uhn.fhir.rest.method;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2015 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.parser.IParser;
|
||||
import ca.uhn.fhir.rest.client.exceptions.InvalidResponseException;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer.NarrativeModeEnum;
|
||||
import ca.uhn.fhir.rest.server.RestfulServerUtils;
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
||||
import ca.uhn.fhir.util.ReflectionUtil;
|
||||
|
||||
abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding<Object> {
|
||||
protected static final Set<String> ALLOWED_PARAMS;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseResourceReturningMethodBinding.class);
|
||||
|
||||
static {
|
||||
HashSet<String> set = new HashSet<String>();
|
||||
set.add(Constants.PARAM_FORMAT);
|
||||
set.add(Constants.PARAM_NARRATIVE);
|
||||
set.add(Constants.PARAM_PRETTY);
|
||||
set.add(Constants.PARAM_SORT);
|
||||
set.add(Constants.PARAM_SORT_ASC);
|
||||
set.add(Constants.PARAM_SORT_DESC);
|
||||
set.add(Constants.PARAM_COUNT);
|
||||
ALLOWED_PARAMS = Collections.unmodifiableSet(set);
|
||||
}
|
||||
|
||||
private MethodReturnTypeEnum myMethodReturnType;
|
||||
private Class<?> myResourceListCollectionType;
|
||||
private String myResourceName;
|
||||
private Class<? extends IResource> myResourceType;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public BaseResourceReturningMethodBinding(Class<?> theReturnResourceType, Method theMethod, FhirContext theContext, Object theProvider) {
|
||||
super(theMethod, theContext, theProvider);
|
||||
|
||||
Class<?> methodReturnType = theMethod.getReturnType();
|
||||
if (Collection.class.isAssignableFrom(methodReturnType)) {
|
||||
|
||||
myMethodReturnType = MethodReturnTypeEnum.LIST_OF_RESOURCES;
|
||||
Class<?> collectionType = ReflectionUtil.getGenericCollectionTypeOfMethodReturnType(theMethod);
|
||||
if (collectionType != null) {
|
||||
if (!Object.class.equals(collectionType) && !IResource.class.isAssignableFrom(collectionType)) {
|
||||
throw new ConfigurationException("Method " + theMethod.getDeclaringClass().getSimpleName() + "#" + theMethod.getName() + " returns an invalid collection generic type: " + collectionType);
|
||||
}
|
||||
}
|
||||
myResourceListCollectionType = collectionType;
|
||||
|
||||
} else if (IBaseResource.class.isAssignableFrom(methodReturnType)) {
|
||||
if (Modifier.isAbstract(methodReturnType.getModifiers()) == false && theContext.getResourceDefinition((Class<? extends IBaseResource>) methodReturnType).isBundle()) {
|
||||
myMethodReturnType = MethodReturnTypeEnum.BUNDLE_RESOURCE;
|
||||
} else {
|
||||
myMethodReturnType = MethodReturnTypeEnum.RESOURCE;
|
||||
}
|
||||
} else if (Bundle.class.isAssignableFrom(methodReturnType)) {
|
||||
myMethodReturnType = MethodReturnTypeEnum.BUNDLE;
|
||||
} else if (IBundleProvider.class.isAssignableFrom(methodReturnType)) {
|
||||
myMethodReturnType = MethodReturnTypeEnum.BUNDLE_PROVIDER;
|
||||
} else {
|
||||
throw new ConfigurationException("Invalid return type '" + methodReturnType.getCanonicalName() + "' on method '" + theMethod.getName() + "' on type: " + theMethod.getDeclaringClass().getCanonicalName());
|
||||
}
|
||||
|
||||
if (theReturnResourceType != null) {
|
||||
if (IResource.class.isAssignableFrom(theReturnResourceType)) {
|
||||
ResourceDef resourceDefAnnotation = theReturnResourceType.getAnnotation(ResourceDef.class);
|
||||
if (resourceDefAnnotation == null) {
|
||||
if (Modifier.isAbstract(theReturnResourceType.getModifiers())) {
|
||||
// If we're returning an abstract type, that's ok
|
||||
} else {
|
||||
throw new ConfigurationException(theReturnResourceType.getCanonicalName() + " has no @" + ResourceDef.class.getSimpleName() + " annotation");
|
||||
}
|
||||
} else {
|
||||
myResourceType = (Class<? extends IResource>) theReturnResourceType;
|
||||
myResourceName = resourceDefAnnotation.name();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MethodReturnTypeEnum getMethodReturnType() {
|
||||
return myMethodReturnType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResourceName() {
|
||||
return myResourceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the response is a bundle, this type will be placed in the root of the bundle (can be null)
|
||||
*/
|
||||
protected abstract BundleTypeEnum getResponseBundleType();
|
||||
|
||||
public abstract ReturnTypeEnum getReturnType();
|
||||
|
||||
@Override
|
||||
public Object invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map<String, List<String>> theHeaders) throws IOException {
|
||||
IParser parser = createAppropriateParserForParsingResponse(theResponseMimeType, theResponseReader, theResponseStatusCode);
|
||||
|
||||
switch (getReturnType()) {
|
||||
case BUNDLE: {
|
||||
Bundle bundle;
|
||||
if (myResourceType != null) {
|
||||
bundle = parser.parseBundle(myResourceType, theResponseReader);
|
||||
} else {
|
||||
bundle = parser.parseBundle(theResponseReader);
|
||||
}
|
||||
switch (getMethodReturnType()) {
|
||||
case BUNDLE:
|
||||
return bundle;
|
||||
case LIST_OF_RESOURCES:
|
||||
List<IResource> listOfResources;
|
||||
if (myResourceListCollectionType != null) {
|
||||
listOfResources = new ArrayList<IResource>();
|
||||
for (IResource next : bundle.toListOfResources()) {
|
||||
if (!myResourceListCollectionType.isAssignableFrom(next.getClass())) {
|
||||
ourLog.debug("Not returning resource of type {} because it is not a subclass or instance of {}", next.getClass(), myResourceListCollectionType);
|
||||
continue;
|
||||
}
|
||||
listOfResources.add(next);
|
||||
}
|
||||
} else {
|
||||
listOfResources = bundle.toListOfResources();
|
||||
}
|
||||
return listOfResources;
|
||||
case RESOURCE:
|
||||
List<IResource> list = bundle.toListOfResources();
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
} else if (list.size() == 1) {
|
||||
return list.get(0);
|
||||
} else {
|
||||
throw new InvalidResponseException(theResponseStatusCode, "FHIR server call returned a bundle with multiple resources, but this method is only able to returns one.");
|
||||
}
|
||||
case BUNDLE_PROVIDER:
|
||||
throw new IllegalStateException("Return type of " + IBundleProvider.class.getSimpleName() + " is not supported in clients");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RESOURCE: {
|
||||
IResource resource;
|
||||
if (myResourceType != null) {
|
||||
resource = parser.parseResource(myResourceType, theResponseReader);
|
||||
} else {
|
||||
resource = parser.parseResource(theResponseReader);
|
||||
}
|
||||
|
||||
MethodUtil.parseClientRequestResourceHeaders(null, theHeaders, resource);
|
||||
|
||||
switch (getMethodReturnType()) {
|
||||
case BUNDLE:
|
||||
return Bundle.withSingleResource(resource);
|
||||
case LIST_OF_RESOURCES:
|
||||
return Collections.singletonList(resource);
|
||||
case RESOURCE:
|
||||
return resource;
|
||||
case BUNDLE_PROVIDER:
|
||||
throw new IllegalStateException("Return type of " + IBundleProvider.class.getSimpleName() + " is not supported in clients");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Should not get here!");
|
||||
}
|
||||
|
||||
public abstract Object invokeServer(RequestDetails theRequest, Object[] theMethodParams) throws InvalidRequestException, InternalErrorException;
|
||||
|
||||
@Override
|
||||
public void invokeServer(RestfulServer theServer, Request theRequest) throws BaseServerResponseException, IOException {
|
||||
|
||||
// Pretty print
|
||||
boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theRequest);
|
||||
|
||||
// Narrative mode
|
||||
NarrativeModeEnum narrativeMode = RestfulServerUtils.determineNarrativeMode(theRequest);
|
||||
|
||||
// Determine response encoding
|
||||
EncodingEnum responseEncoding = RestfulServerUtils.determineResponseEncodingNoDefault(theRequest.getServletRequest());
|
||||
|
||||
// Is this request coming from a browser
|
||||
String uaHeader = theRequest.getServletRequest().getHeader("user-agent");
|
||||
boolean requestIsBrowser = false;
|
||||
if (uaHeader != null && uaHeader.contains("Mozilla")) {
|
||||
requestIsBrowser = true;
|
||||
}
|
||||
|
||||
Object requestObject = parseRequestObject(theRequest);
|
||||
|
||||
// Method params
|
||||
Object[] params = new Object[getParameters().size()];
|
||||
for (int i = 0; i < getParameters().size(); i++) {
|
||||
IParameter param = getParameters().get(i);
|
||||
if (param != null) {
|
||||
params[i] = param.translateQueryParametersIntoServerArgument(theRequest, requestObject);
|
||||
}
|
||||
}
|
||||
|
||||
Integer count = RestfulServerUtils.extractCountParameter(theRequest.getServletRequest());
|
||||
|
||||
boolean respondGzip = theRequest.isRespondGzip();
|
||||
|
||||
HttpServletResponse response = theRequest.getServletResponse();
|
||||
Object resultObj = invokeServer(theRequest, params);
|
||||
switch (getReturnType()) {
|
||||
case BUNDLE: {
|
||||
|
||||
if (getMethodReturnType() == MethodReturnTypeEnum.BUNDLE_RESOURCE) {
|
||||
IResource resource;
|
||||
if (resultObj instanceof IBundleProvider) {
|
||||
IBundleProvider result = (IBundleProvider) resultObj;
|
||||
resource = result.getResources(0, 1).get(0);
|
||||
} else {
|
||||
resource = (IResource) resultObj;
|
||||
}
|
||||
|
||||
/*
|
||||
* We assume that the bundle we got back from the handling method may not have everything populated
|
||||
* (e.g. self links, bundle type, etc) so we do that here.
|
||||
*/
|
||||
IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().newBundleFactory();
|
||||
bundleFactory.initializeWithBundleResource(resource);
|
||||
bundleFactory.addRootPropertiesToBundle(null, theRequest.getFhirServerBase(), theRequest.getCompleteUrl(), count, getResponseBundleType());
|
||||
|
||||
for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
|
||||
IServerInterceptor next = theServer.getInterceptors().get(i);
|
||||
boolean continueProcessing = next.outgoingResponse(theRequest, resource, theRequest.getServletRequest(), theRequest.getServletResponse());
|
||||
if (!continueProcessing) {
|
||||
ourLog.debug("Interceptor {} returned false, not continuing processing");
|
||||
return;
|
||||
}
|
||||
}
|
||||
RestfulServerUtils.streamResponseAsResource(theServer, response, resource, responseEncoding, prettyPrint, requestIsBrowser, narrativeMode, respondGzip, theRequest.getFhirServerBase());
|
||||
break;
|
||||
} else {
|
||||
Set<Include> includes = getRequestIncludesFromParams(params);
|
||||
|
||||
IBundleProvider result = (IBundleProvider) resultObj;
|
||||
IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().newBundleFactory();
|
||||
<<<<<<< HEAD
|
||||
bundleFactory.initializeBundleFromBundleProvider(theServer, result, responseEncoding, theRequest.getFhirServerBase(), theRequest.getCompleteUrl(), prettyPrint, 0, count, null, getResponseBundleType());
|
||||
=======
|
||||
bundleFactory.initializeBundleFromBundleProvider(theServer, result, responseEncoding, theRequest.getFhirServerBase(), theRequest.getCompleteUrl(), prettyPrint, 0, count, null,
|
||||
getResponseBundleType(), includes);
|
||||
>>>>>>> 48880ab6077c7aeee21e23196fb21d1c26851709
|
||||
Bundle bundle = bundleFactory.getDstu1Bundle();
|
||||
if (bundle != null) {
|
||||
for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
|
||||
IServerInterceptor next = theServer.getInterceptors().get(i);
|
||||
boolean continueProcessing = next.outgoingResponse(theRequest, bundle, theRequest.getServletRequest(), theRequest.getServletResponse());
|
||||
if (!continueProcessing) {
|
||||
ourLog.debug("Interceptor {} returned false, not continuing processing");
|
||||
return;
|
||||
}
|
||||
}
|
||||
RestfulServerUtils.streamResponseAsBundle(theServer, response, bundle, responseEncoding, theRequest.getFhirServerBase(), prettyPrint, narrativeMode, respondGzip, requestIsBrowser);
|
||||
} else {
|
||||
IBaseResource resBundle = bundleFactory.getResourceBundle();
|
||||
for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
|
||||
IServerInterceptor next = theServer.getInterceptors().get(i);
|
||||
boolean continueProcessing = next.outgoingResponse(theRequest, resBundle, theRequest.getServletRequest(), theRequest.getServletResponse());
|
||||
if (!continueProcessing) {
|
||||
ourLog.debug("Interceptor {} returned false, not continuing processing");
|
||||
return;
|
||||
}
|
||||
}
|
||||
RestfulServerUtils.streamResponseAsResource(theServer, response, (IResource) resBundle, responseEncoding, prettyPrint, requestIsBrowser, narrativeMode, Constants.STATUS_HTTP_200_OK, theRequest.isRespondGzip(), theRequest.getFhirServerBase());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
case RESOURCE: {
|
||||
IBundleProvider result = (IBundleProvider) resultObj;
|
||||
if (result.size() == 0) {
|
||||
throw new ResourceNotFoundException(theRequest.getId());
|
||||
} else if (result.size() > 1) {
|
||||
throw new InternalErrorException("Method returned multiple resources");
|
||||
}
|
||||
|
||||
IResource resource = result.getResources(0, 1).get(0);
|
||||
|
||||
for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
|
||||
IServerInterceptor next = theServer.getInterceptors().get(i);
|
||||
boolean continueProcessing = next.outgoingResponse(theRequest, resource, theRequest.getServletRequest(), theRequest.getServletResponse());
|
||||
if (!continueProcessing) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RestfulServerUtils.streamResponseAsResource(theServer, response, resource, responseEncoding, prettyPrint, requestIsBrowser, narrativeMode, respondGzip, theRequest.getFhirServerBase());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses may override
|
||||
*
|
||||
* @param theRequest
|
||||
* The incoming request
|
||||
* @throws IOException
|
||||
* Subclasses may throw this in the event of an IO exception
|
||||
*/
|
||||
protected Object parseRequestObject(Request theRequest) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void setResourceName(String theResourceName) {
|
||||
myResourceName = theResourceName;
|
||||
}
|
||||
|
||||
public enum MethodReturnTypeEnum {
|
||||
BUNDLE, BUNDLE_PROVIDER, BUNDLE_RESOURCE, LIST_OF_RESOURCES, RESOURCE
|
||||
}
|
||||
|
||||
public enum ReturnTypeEnum {
|
||||
BUNDLE, RESOURCE
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum;
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Map;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.lang.reflect.Modifier;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -190,10 +190,10 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding {
|
|||
List<IBaseResource> retVal = resources.getResources(theFromIndex, theToIndex);
|
||||
int index = theFromIndex;
|
||||
for (IBaseResource nextResource : retVal) {
|
||||
if (nextResource.getId() == null || isBlank(nextResource.getId().getIdPart())) {
|
||||
if (nextResource.getIdElement() == null || isBlank(nextResource.getIdElement().getIdPart())) {
|
||||
throw new InternalErrorException("Server provided resource at index " + index + " with no ID set (using IResource#setId(IdDt))");
|
||||
}
|
||||
if (isBlank(nextResource.getId().getVersionIdPart()) && nextResource instanceof IResource) {
|
||||
if (isBlank(nextResource.getIdElement().getVersionIdPart()) && nextResource instanceof IResource) {
|
||||
IdDt versionId = (IdDt) ResourceMetadataKeyEnum.VERSION_ID.get((IResource) nextResource);
|
||||
if (versionId == null || versionId.isEmpty()) {
|
||||
throw new InternalErrorException("Server provided resource at index " + index + " with no Version ID set (using IResource#setId(IdDt))");
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.AbstractHttpEntity;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
|
@ -47,7 +47,7 @@ public class HttpPostClientInvocation extends BaseHttpClientInvocationWithConten
|
|||
super(theContext, theTagList, theUrlExtension);
|
||||
}
|
||||
|
||||
public HttpPostClientInvocation(FhirContext theContext, List<IBaseResource> theResources, BundleTypeEnum theBundleType) {
|
||||
public HttpPostClientInvocation(FhirContext theContext, List<? extends IBaseResource> theResources, BundleTypeEnum theBundleType) {
|
||||
super(theContext, theResources, theBundleType);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ package ca.uhn.fhir.rest.method;
|
|||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.http.entity.AbstractHttpEntity;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
|
|
@ -24,10 +24,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.utils.DateUtils;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IRefImplResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IMetaType;
|
||||
import org.hl7.fhir.instance.model.api.IBaseMetaType;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
@ -450,8 +450,8 @@ public class MethodUtil {
|
|||
if (resource instanceof IResource) {
|
||||
InstantDt lmValue = new InstantDt(headerDateValue);
|
||||
((IResource) resource).getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, lmValue);
|
||||
} else if (resource instanceof IAnyResource) {
|
||||
((IAnyResource) resource).getMeta().setLastUpdated(headerDateValue);
|
||||
} else if (resource instanceof IRefImplResource) {
|
||||
((IRefImplResource) resource).getMeta().setLastUpdated(headerDateValue);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ourLog.warn("Unable to parse date string '{}'. Error is: {}", headerValue, e.toString());
|
||||
|
@ -495,8 +495,8 @@ public class MethodUtil {
|
|||
}
|
||||
if (resource instanceof IResource) {
|
||||
ResourceMetadataKeyEnum.TAG_LIST.put((IResource) resource, tagList);
|
||||
} else if (resource instanceof IAnyResource) {
|
||||
IMetaType meta = ((IAnyResource) resource).getMeta();
|
||||
} else if (resource instanceof IRefImplResource) {
|
||||
IBaseMetaType meta = ((IRefImplResource) resource).getMeta();
|
||||
for (Tag next : tagList) {
|
||||
meta.addTag().setSystem(next.getScheme()).setCode(next.getTerm()).setDisplay(next.getLabel());
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
|
|
|
@ -32,11 +32,11 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseParameters;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -26,10 +26,10 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBase;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition.IAccessor;
|
||||
|
|
|
@ -31,8 +31,8 @@ import java.util.Map;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
@ -209,8 +209,8 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding implem
|
|||
IBaseResource responseResource = responseResources.get(0);
|
||||
|
||||
ifNoneMatch = MethodUtil.parseETagValue(ifNoneMatch);
|
||||
if (responseResource.getId() != null && responseResource.getId().hasVersionIdPart()) {
|
||||
if (responseResource.getId().getVersionIdPart().equals(ifNoneMatch)) {
|
||||
if (responseResource.getIdElement() != null && responseResource.getIdElement().hasVersionIdPart()) {
|
||||
if (responseResource.getIdElement().getVersionIdPart().equals(ifNoneMatch)) {
|
||||
ourLog.debug("Returning HTTP 301 because request specified {}={}", Constants.HEADER_IF_NONE_MATCH, ifNoneMatch);
|
||||
throw new NotModifiedException("Not Modified");
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue