More work on structs

This commit is contained in:
James Agnew 2015-05-01 12:27:56 -07:00
parent 3fe60c3f1b
commit 880ab84ce8
26 changed files with 94 additions and 94 deletions

View File

@ -52,7 +52,7 @@ 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.IRiResource;
import org.hl7.fhir.instance.model.api.IBackboneElement;
import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
@ -62,7 +62,7 @@ import org.hl7.fhir.instance.model.api.IBaseXhtml;
import org.hl7.fhir.instance.model.api.IDatatypeElement;
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;
@ -505,14 +505,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 (IRiResource.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
*/
@ -546,7 +546,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
*/

View File

@ -31,7 +31,7 @@ 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.IBaseReference;
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;

View File

@ -29,7 +29,7 @@ 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.IRiResource;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
@ -58,7 +58,7 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
try {
IBaseResource instance = theClass.newInstance();
if (instance instanceof IAnyResource) {
if (instance instanceof IRiResource) {
myStructureVersion = FhirVersionEnum.DSTU2_HL7ORG;
} else {
myStructureVersion = ((IResource)instance).getStructureFhirVersionEnum();

View File

@ -26,7 +26,7 @@ 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.IRiResource;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
@ -55,7 +55,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(IRiResource.class) || next.equals(IBaseResource.class)) {
continue;
}
RuntimeResourceDefinition definition = (RuntimeResourceDefinition) theClassToElementDefinitions.get(next);

View File

@ -29,7 +29,7 @@ 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 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;

View File

@ -29,7 +29,7 @@ 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.IRiResource;
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 IRiResource) {
((IRiResource) theResouce).setId(getValue());
} else {
throw new IllegalArgumentException("Unknown resource class type, does not implement IResource or extend Resource");
}

View File

@ -40,10 +40,10 @@ 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.IRiResource;
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,8 +94,8 @@ public abstract class BaseParser implements IParser {
}
}
} else if (theTarget instanceof IDomainResource) {
List<? extends IAnyResource> containedResources = ((IDomainResource) theTarget).getContained();
for (IAnyResource next : containedResources) {
List<? extends IRiResource> containedResources = ((IDomainResource) theTarget).getContained();
for (IRiResource next : containedResources) {
String nextId = next.getId().getValue();
if (StringUtils.isNotBlank(nextId)) {
if (!nextId.startsWith("#")) {
@ -113,8 +113,8 @@ 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()) {
@ -144,7 +144,7 @@ public abstract class BaseParser implements IParser {
myContainedResources = contained;
}
protected String determineReferenceText(IReference theRef) {
protected String determineReferenceText(IBaseReference theRef) {
IIdType ref = theRef.getReference();
if (isBlank(ref.getIdPart())) {
String reference = ref.getValue();

View File

@ -54,7 +54,7 @@ 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.IRiResource;
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;
@ -420,7 +420,7 @@ public class JsonParser extends BaseParser implements IParser {
break;
}
case RESOURCE_REF: {
IReference referenceDt = (IReference) theNextValue;
IBaseReference referenceDt = (IBaseReference) theNextValue;
if (theChildName != null) {
theWriter.writeStartObject(theChildName);
} else {
@ -676,8 +676,8 @@ public class JsonParser extends BaseParser implements IParser {
resourceId = res.getId().getIdPart();
}
}
} else if (theResource instanceof IAnyResource) {
IAnyResource res = (IAnyResource) theResource;
} else if (theResource instanceof IRiResource) {
IRiResource res = (IRiResource) theResource;
if (/*theContainedResource && */ StringUtils.isNotBlank(res.getId().getIdPart())) {
resourceId = res.getId().getIdPart();
}

View File

@ -43,7 +43,7 @@ import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
import org.hl7.fhir.instance.model.api.IBaseXhtml;
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 ca.uhn.fhir.context.BaseRuntimeChildDefinition;
import ca.uhn.fhir.context.BaseRuntimeChildDefinition.IMutator;
@ -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);
}
@ -1699,7 +1699,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);
@ -2082,8 +2082,8 @@ class ParserState<T> {
}
}
}
}else if (theElement instanceof IReference) {
IReference nextRef = (IReference) theElement;
}else if (theElement instanceof IBaseReference) {
IBaseReference nextRef = (IBaseReference) theElement;
String ref = nextRef.getReference().getValue();
if (isNotBlank(ref)) {
if (ref.startsWith("#")) {
@ -2236,10 +2236,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;
@ -2297,7 +2297,7 @@ class ParserState<T> {
}
@Override
protected IReference getCurrentElement() {
protected IBaseReference getCurrentElement() {
return myInstance;
}

View File

@ -50,7 +50,7 @@ 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.IRiResource;
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);
@ -673,7 +673,7 @@ public class XmlParser extends BaseParser implements IParser {
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,7 +751,7 @@ public class XmlParser extends BaseParser implements IParser {
}
} else {
// HL7 structs
IAnyResource resource = (IAnyResource) theResource;
IRiResource resource = (IRiResource) theResource;
if (StringUtils.isNotBlank(resource.getId().getIdPart())) {
resourceId = resource.getId().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 IRiResource) {
// HL7.org Structures
writeOptionalTagWithValue(theEventWriter, "id", theResourceId);

View File

@ -25,7 +25,7 @@ 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.IRiResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IMetaType;
@ -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 IRiResource) {
((IRiResource) 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 IRiResource) {
IMetaType meta = ((IRiResource) resource).getMeta();
for (Tag next : tagList) {
meta.addTag().setSystem(next.getScheme()).setCode(next.getTerm()).setDisplay(next.getLabel());
}

View File

@ -41,7 +41,7 @@ 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.IRiResource;
import org.hl7.fhir.instance.model.api.IBaseBinary;
import org.hl7.fhir.instance.model.api.IIdType;
@ -148,7 +148,7 @@ public class RestfulServerUtils {
}
}
} else {
Date lastUpdated = ((IAnyResource)theResource).getMeta().getLastUpdated();
Date lastUpdated = ((IRiResource)theResource).getMeta().getLastUpdated();
if (lastUpdated != null) {
theHttpResponse.addHeader(Constants.HEADER_LAST_MODIFIED, DateUtils.formatDate(lastUpdated));
}

View File

@ -30,7 +30,7 @@ import java.util.TreeSet;
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.api.IReference;
import org.hl7.fhir.instance.model.api.IBaseReference;
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
@ -127,8 +127,8 @@ public class FhirTerser {
if (theElement == null || theElement.isEmpty()) {
return;
}
if (IReference.class.isAssignableFrom(theElement.getClass())) {
retVal.add(new ResourceReferenceInfo(myContext, theResource, thePathToElement, (IReference)theElement));
if (IBaseReference.class.isAssignableFrom(theElement.getClass())) {
retVal.add(new ResourceReferenceInfo(myContext, theResource, thePathToElement, (IBaseReference)theElement));
}
}
@ -243,7 +243,7 @@ public class FhirTerser {
// These are primitive types
break;
case RESOURCE_REF:
IReference resRefDt = (IReference) theElement;
IBaseReference resRefDt = (IBaseReference) theElement;
if (resRefDt.getReference().getValue() == null && resRefDt.getResource() != null) {
IBaseResource theResource = resRefDt.getResource();
if (theResource.getId() == null || theResource.getId().isEmpty() || theResource.getId().isLocal()) {
@ -353,7 +353,7 @@ public class FhirTerser {
// These are primitive types, so we don't need to visit their children
break;
case RESOURCE_REF:
IReference resRefDt = (IReference) theElement;
IBaseReference resRefDt = (IBaseReference) theElement;
if (resRefDt.getReference().getValue() == null && resRefDt.getResource() != null) {
IBaseResource theResource = resRefDt.getResource();
if (theResource.getId() == null || theResource.getId().isEmpty() || theResource.getId().isLocal()) {

View File

@ -27,7 +27,7 @@ import java.util.Set;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hl7.fhir.instance.model.IBaseResource;
import org.hl7.fhir.instance.model.api.IReference;
import org.hl7.fhir.instance.model.api.IBaseReference;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Include;
@ -39,9 +39,9 @@ import ca.uhn.fhir.model.api.annotation.ResourceDef;
public class ResourceReferenceInfo {
private String myOwningResource;
private String myName;
private IReference myResource;
private IBaseReference myResource;
public ResourceReferenceInfo(FhirContext theContext, IBaseResource theOwningResource, List<String> thePathToElement, IReference theElement) {
public ResourceReferenceInfo(FhirContext theContext, IBaseResource theOwningResource, List<String> thePathToElement, IBaseReference theElement) {
myOwningResource = theContext.getResourceDefinition(theOwningResource).getName();
@ -72,7 +72,7 @@ public class ResourceReferenceInfo {
return myName;
}
public IReference getResourceReference() {
public IBaseReference getResourceReference() {
return myResource;
}

View File

@ -20,12 +20,12 @@ package org.hl7.fhir.instance.model.api;
* #L%
*/
public interface ICoding {
public interface IBaseCoding {
ICoding setSystem(String theScheme);
IBaseCoding setSystem(String theScheme);
ICoding setCode(String theTerm);
IBaseCoding setCode(String theTerm);
ICoding setDisplay(String theLabel);
IBaseCoding setDisplay(String theLabel);
}

View File

@ -55,7 +55,7 @@ POSSIBILITY OF SUCH DAMAGE.
* Interface to be implemented by all built-in FHIR enumerations (i.e. the
* actual FHIR-defined Java Enum will implement this interface)
*/
public interface IFhirEnum {
public interface IBaseFhirEnum {
/**
* Get the XML/JSON representation for an enumerated value

View File

@ -25,7 +25,7 @@ import org.hl7.fhir.instance.model.IBaseResource;
import org.hl7.fhir.instance.model.ICompositeType;
import org.hl7.fhir.instance.model.IPrimitiveType;
public interface IReference extends ICompositeType {
public interface IBaseReference extends ICompositeType {
IBaseResource getResource();
@ -33,7 +33,7 @@ public interface IReference extends ICompositeType {
IIdType getReference();
IReference setReference(String theReference);
IBaseReference setReference(String theReference);
IBase setDisplay(String theValue);

View File

@ -22,9 +22,9 @@ package org.hl7.fhir.instance.model.api;
import java.util.List;
public interface IDomainResource extends IAnyResource {
public interface IDomainResource extends IRiResource {
List<? extends IAnyResource> getContained();
List<? extends IRiResource> getContained();
INarrative getText();

View File

@ -26,7 +26,7 @@ import org.hl7.fhir.instance.model.ICompositeType;
public interface IMetaType extends ICompositeType {
ICoding addTag();
IBaseCoding addTag();
IMetaType setLastUpdated(Date theHeaderDateValue);

View File

@ -22,11 +22,11 @@ package org.hl7.fhir.instance.model.api;
import org.hl7.fhir.instance.model.IBaseResource;
public interface IAnyResource extends IBaseResource {
public interface IRiResource extends IBaseResource {
IIdType getId();
IAnyResource setId(String theId);
IRiResource setId(String theId);
IIdType getIdElement();

View File

@ -40,10 +40,10 @@ import org.hl7.fhir.instance.model.IdType;
import org.hl7.fhir.instance.model.InstantType;
import org.hl7.fhir.instance.model.OperationOutcome;
import org.hl7.fhir.instance.model.Resource;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IRiResource;
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.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
@ -93,7 +93,7 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
IDomainResource next = (IDomainResource) nextBaseRes;
Set<String> containedIds = new HashSet<String>();
for (IAnyResource nextContained : next.getContained()) {
for (IRiResource nextContained : next.getContained()) {
if (nextContained.getId().isEmpty() == false) {
containedIds.add(nextContained.getId().getValue());
}
@ -332,11 +332,11 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
}
}
List<IReference> references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IReference.class);
List<IBaseReference> references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IBaseReference.class);
do {
List<IBaseResource> addedResourcesThisPass = new ArrayList<IBaseResource>();
for (IReference nextRef : references) {
for (IBaseReference nextRef : references) {
IBaseResource nextRes = (IBaseResource) nextRef.getResource();
if (nextRes != null) {
if (nextRes.getId().hasIdPart()) {
@ -361,9 +361,9 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
}
// Linked resources may themselves have linked resources
references = new ArrayList<IReference>();
references = new ArrayList<IBaseReference>();
for (IBaseResource iResource : addedResourcesThisPass) {
List<IReference> newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, IReference.class);
List<IBaseReference> newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, IBaseReference.class);
references.addAll(newReferences);
}

View File

@ -37,12 +37,12 @@ import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.api.ICoding;
import org.hl7.fhir.instance.model.api.IBaseCoding;
/**
* A reference to a code defined by a terminology system.
*/
@DatatypeDef(name="Coding")
public class Coding extends Type implements ICoding, ICompositeType {
public class Coding extends Type implements IBaseCoding, ICompositeType {
/**
* The identification of the code system that defines the meaning of the symbol in the code.

View File

@ -37,14 +37,14 @@ import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IReference;
import org.hl7.fhir.instance.model.api.IRiResource;
import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.utilities.Utilities;
/**
* A reference from one resource to another.
*/
@DatatypeDef(name="Reference")
public class Reference extends Type implements IReference, ICompositeType {
public class Reference extends Type implements IBaseReference, ICompositeType {
/**
@ -57,7 +57,7 @@ public class Reference extends Type implements IReference, ICompositeType {
/**
* Constructor
*/
public Reference(IAnyResource theResource) {
public Reference(IRiResource theResource) {
this.resource = theResource;
}

View File

@ -36,14 +36,14 @@ import java.util.List;
import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.Description;
import org.hl7.fhir.instance.model.annotations.ResourceDef;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IRiResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.utilities.Utilities;
/**
* Base Resource for everything.
*/
@ResourceDef(name="Resource", profile="http://hl7.org/fhir/Profile/Resource")
public abstract class Resource extends Base implements IAnyResource {
public abstract class Resource extends Base implements IRiResource {
/**
* The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes.

View File

@ -32,7 +32,7 @@ import org.hl7.fhir.instance.model.Timing;
import org.hl7.fhir.instance.model.Type;
import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IRiResource;
import org.hl7.fhir.instance.model.api.IBackboneElement;
import org.hl7.fhir.instance.model.api.IBaseBinary;
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
@ -46,13 +46,13 @@ import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
import org.hl7.fhir.instance.model.api.IBaseParameters;
import org.hl7.fhir.instance.model.api.IBaseXhtml;
import org.hl7.fhir.instance.model.api.ICoding;
import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IDatatypeElement;
import org.hl7.fhir.instance.model.api.IDomainResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IMetaType;
import org.hl7.fhir.instance.model.api.INarrative;
import org.hl7.fhir.instance.model.api.IReference;
import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
import org.junit.Test;
@ -132,7 +132,7 @@ public class ModelInheritanceTest {
@Test
public void testCoding() {
assertTrue(ICoding.class.isAssignableFrom(Coding.class));
assertTrue(IBaseCoding.class.isAssignableFrom(Coding.class));
}
@Test
@ -198,7 +198,7 @@ public class ModelInheritanceTest {
@Test
public void testReference() {
assertTrue(IReference.class.isAssignableFrom(Reference.class));
assertTrue(IBaseReference.class.isAssignableFrom(Reference.class));
}
@Test
@ -208,7 +208,7 @@ public class ModelInheritanceTest {
@Test
public void testResource() {
assertTrue(IAnyResource.class.isAssignableFrom(Resource.class));
assertTrue(IRiResource.class.isAssignableFrom(Resource.class));
}
@Test

View File

@ -21,7 +21,7 @@ import org.hl7.fhir.instance.model.Patient;
import org.hl7.fhir.instance.model.Patient.AdministrativeGender;
import org.hl7.fhir.instance.model.Practitioner;
import org.hl7.fhir.instance.model.Reference;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IRiResource;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;