Merge branch 'mochaholic-master'

t push origin master# the commit.
This commit is contained in:
jamesagnew 2015-02-24 07:50:14 -05:00
commit a2992dd46f
191 changed files with 5231 additions and 4804 deletions

View File

@ -37,7 +37,9 @@ public class PlainProvider {
//START SNIPPET: plainProviderServer //START SNIPPET: plainProviderServer
public class ExampleServlet extends RestfulServer { public class ExampleServlet extends RestfulServer {
/** Constructor */ /**
* Constructor
*/
public ExampleServlet() { public ExampleServlet() {
/* /*
* Plain providers are passed to the server in the same way * Plain providers are passed to the server in the same way
@ -59,7 +61,9 @@ public class ExampleServlet extends RestfulServer {
//START SNIPPET: addressStrategy //START SNIPPET: addressStrategy
public class MyServlet extends RestfulServer { public class MyServlet extends RestfulServer {
/** Constructor */ /**
* Constructor
*/
public MyServlet() { public MyServlet() {
String serverBaseUrl = "http://foo.com/fhir"; String serverBaseUrl = "http://foo.com/fhir";

View File

@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.text.WordUtils; import org.apache.commons.lang3.text.WordUtils;
import org.hl7.fhir.instance.model.IBase; import org.hl7.fhir.instance.model.IBase;

View File

@ -34,5 +34,4 @@ public class RuntimeChildPrimitiveDatatypeDefinition extends BaseRuntimeChildDat
} }
} }

View File

@ -27,6 +27,7 @@ import org.hl7.fhir.instance.model.IBaseResource;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.IServerConformanceProvider; import ca.uhn.fhir.rest.server.IServerConformanceProvider;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
@ -49,4 +50,7 @@ public interface IFhirVersion {
Class<?> getContainedType(); Class<?> getContainedType();
BaseCodingDt newCodingDt();
} }

View File

@ -28,6 +28,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.model.primitive.DecimalDt; import ca.uhn.fhir.model.primitive.DecimalDt;
@ -62,6 +63,36 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
*/ */
public abstract class ResourceMetadataKeyEnum<T> { public abstract class ResourceMetadataKeyEnum<T> {
public static final ResourceMetadataKeyEnum<List<BaseCodingDt>> SECURITY_LABELS = new ResourceMetadataKeyEnum<List<BaseCodingDt>>("SECURITY_LABELS") {
@Override
public List<BaseCodingDt> get(IResource resource) {
Object obj = resource.getResourceMetadata().get(SECURITY_LABELS);
if (obj == null) {
return null;
} else {
try {
List<BaseCodingDt> securityLabels = (List<BaseCodingDt>) obj;
if (securityLabels.isEmpty())
return null;
else
return securityLabels;
} catch (ClassCastException e) {
throw new InternalErrorException("Found an object of type '" + obj.getClass().getCanonicalName() + "' in resource metadata for key SECURITY_LABELS - Expected "
+ BaseCodingDt.class.getCanonicalName());
}
}
}
@Override
public void put(IResource iResource, List<BaseCodingDt> labels) {
iResource.getResourceMetadata().put(SECURITY_LABELS, labels);
}
};
/** /**
* If present and populated with a date/time (as an instance of {@link InstantDt}), this value is an indication that the resource is in the deleted state. This key is only used in a limited number * If present and populated with a date/time (as an instance of {@link InstantDt}), this value is an indication that the resource is in the deleted state. This key is only used in a limited number
* of scenarios, such as POSTing transaction bundles to a server, or returning resource history. * of scenarios, such as POSTing transaction bundles to a server, or returning resource history.

View File

@ -69,6 +69,13 @@ public abstract class BaseCodingDt extends BaseIdentifiableElement implements IC
public abstract BaseCodingDt setDisplay( String theString); public abstract BaseCodingDt setDisplay( String theString);
/*
todo: handle version
public abstract StringDt getVersion();
public abstract BaseCodingDt setVersion ( String theString);
*/
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -49,6 +49,8 @@ import javax.json.stream.JsonGenerator;
import javax.json.stream.JsonGeneratorFactory; import javax.json.stream.JsonGeneratorFactory;
import javax.json.stream.JsonParsingException; import javax.json.stream.JsonParsingException;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.primitive.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.IBase; import org.hl7.fhir.instance.model.IBase;
@ -668,12 +670,27 @@ public class JsonParser extends BaseParser implements IParser {
if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1) && theResource instanceof IResource) { if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1) && theResource instanceof IResource) {
IResource resource = (IResource) theResource; IResource resource = (IResource) theResource;
if (!ElementUtil.isEmpty(resource.getId().getVersionIdPart(), ResourceMetadataKeyEnum.UPDATED.get(resource))) { List<BaseCodingDt> securityLabels = ResourceMetadataKeyEnum.SECURITY_LABELS.get(resource);
if (securityLabels == null) {
securityLabels = Collections.emptyList();
}
if (!ElementUtil.isEmpty(resource.getId().getVersionIdPart(), ResourceMetadataKeyEnum.UPDATED.get(resource), securityLabels)) {
theEventWriter.writeStartObject("meta"); theEventWriter.writeStartObject("meta");
writeOptionalTagWithTextNode(theEventWriter, "versionId", resource.getId().getVersionIdPart()); writeOptionalTagWithTextNode(theEventWriter, "versionId", resource.getId().getVersionIdPart());
writeOptionalTagWithTextNode(theEventWriter, "lastUpdated", ResourceMetadataKeyEnum.UPDATED.get(resource)); writeOptionalTagWithTextNode(theEventWriter, "lastUpdated", ResourceMetadataKeyEnum.UPDATED.get(resource));
if (securityLabels.isEmpty()==false) {
theEventWriter.writeStartArray("security");
for (BaseCodingDt securityLabel : securityLabels) {
theEventWriter.writeStartObject();
BaseRuntimeElementCompositeDefinition<?> def = (BaseRuntimeElementCompositeDefinition<?>) myContext.getElementDefinition(securityLabel.getClass());
encodeCompositeElementChildrenToStreamWriter(resDef, resource, securityLabel, theEventWriter, def.getChildren(), theIsSubElementWithinResource);
theEventWriter.writeEnd(); theEventWriter.writeEnd();
} }
theEventWriter.writeEnd();
}
theEventWriter.writeEnd(); //end meta
}
} }
if (theResource instanceof BaseBinary) { if (theResource instanceof BaseBinary) {

View File

@ -30,6 +30,8 @@ import java.util.Map;
import javax.xml.stream.events.StartElement; import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent; import javax.xml.stream.events.XMLEvent;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.IBase; import org.hl7.fhir.instance.model.IBase;
@ -52,30 +54,25 @@ import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeChildDeclaredExtensionDefinition; import ca.uhn.fhir.context.RuntimeChildDeclaredExtensionDefinition;
import ca.uhn.fhir.context.RuntimeElemContainedResources;
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition; import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeNarrativeDefinition; import ca.uhn.fhir.context.RuntimePrimitiveDatatypeNarrativeDefinition;
import ca.uhn.fhir.context.RuntimeResourceBlockDefinition; import ca.uhn.fhir.context.RuntimeResourceBlockDefinition;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeResourceReferenceDefinition;
import ca.uhn.fhir.model.api.BaseBundle; import ca.uhn.fhir.model.api.BaseBundle;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.BundleEntry; import ca.uhn.fhir.model.api.BundleEntry;
import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.ICompositeDatatype; import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.ICompositeElement;
import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IExtension; import ca.uhn.fhir.model.api.IExtension;
import ca.uhn.fhir.model.api.IFhirVersion; import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IIdentifiableElement; import ca.uhn.fhir.model.api.IIdentifiableElement;
import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.IResourceBlock;
import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions; import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.Tag;
import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.base.resource.BaseBinary; import ca.uhn.fhir.model.base.resource.BaseBinary;
import ca.uhn.fhir.model.base.resource.ResourceMetadataMap; import ca.uhn.fhir.model.base.resource.ResourceMetadataMap;
@ -1664,6 +1661,21 @@ class ParserState<T> {
} }
private class SecurityLabelElementStateHapi extends ElementCompositeState<BaseCodingDt> {
public SecurityLabelElementStateHapi(ParserState<T>.PreResourceState thePreResourceState,BaseRuntimeElementCompositeDefinition<?> theDef, BaseCodingDt codingDt) {
super(thePreResourceState, theDef, codingDt);
}
@Override
public void endingElement() throws DataFormatException {
pop();
}
}
private class MetaElementState extends BaseState { private class MetaElementState extends BaseState {
private ResourceMetadataMap myMap; private ResourceMetadataMap myMap;
@ -1687,6 +1699,17 @@ class ParserState<T> {
InstantDt updated = new InstantDt(); InstantDt updated = new InstantDt();
push(new PrimitiveState(getPreResourceState(), updated)); push(new PrimitiveState(getPreResourceState(), updated));
myMap.put(ResourceMetadataKeyEnum.UPDATED, updated); myMap.put(ResourceMetadataKeyEnum.UPDATED, updated);
} else if (theLocalPart.equals("security")) {
@SuppressWarnings("unchecked")
List<BaseCodingDt> securityLabels = (List<BaseCodingDt>) myMap.get(ResourceMetadataKeyEnum.SECURITY_LABELS);
if (securityLabels == null) {
securityLabels = new ArrayList<BaseCodingDt>();
myMap.put(ResourceMetadataKeyEnum.SECURITY_LABELS, securityLabels);
}
BaseCodingDt securityLabel= myContext.getVersion().newCodingDt();
BaseRuntimeElementCompositeDefinition<?> codinfDef = (BaseRuntimeElementCompositeDefinition<?>) myContext.getElementDefinition(securityLabel.getClass());
push(new SecurityLabelElementStateHapi(getPreResourceState(), codinfDef, securityLabel));
securityLabels.add(securityLabel);
} else { } else {
throw new DataFormatException("Unexpected element '" + theLocalPart + "' found in 'meta' element"); throw new DataFormatException("Unexpected element '" + theLocalPart + "' found in 'meta' element");
} }
@ -1928,7 +1951,6 @@ class ParserState<T> {
return true; return true;
} }
@SuppressWarnings("unchecked")
@Override @Override
public void wereBack() { public void wereBack() {
myContext.newTerser().visit(myInstance, new IModelVisitor() { myContext.newTerser().visit(myInstance, new IModelVisitor() {

View File

@ -27,10 +27,9 @@ import java.io.Reader;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer; import java.io.Writer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.ListIterator;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.FactoryConfigurationError;
@ -71,14 +70,12 @@ import ca.uhn.fhir.context.RuntimeChildUndeclaredExtensionDefinition;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.BundleEntry; import ca.uhn.fhir.model.api.BundleEntry;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions; import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.Tag;
import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
@ -88,7 +85,6 @@ import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.XhtmlDt; import ca.uhn.fhir.model.primitive.XhtmlDt;
import ca.uhn.fhir.narrative.INarrativeGenerator; import ca.uhn.fhir.narrative.INarrativeGenerator;
import ca.uhn.fhir.rest.method.BaseMethodBinding;
import ca.uhn.fhir.util.NonPrettyPrintWriterWrapper; import ca.uhn.fhir.util.NonPrettyPrintWriterWrapper;
import ca.uhn.fhir.util.PrettyPrintWriterWrapper; import ca.uhn.fhir.util.PrettyPrintWriterWrapper;
import ca.uhn.fhir.util.XmlUtil; import ca.uhn.fhir.util.XmlUtil;
@ -109,7 +105,8 @@ public class XmlParser extends BaseParser implements IParser {
private boolean myPrettyPrint; private boolean myPrettyPrint;
/** /**
* Do not use this constructor, the recommended way to obtain a new instance of the XML parser is to invoke {@link FhirContext#newXmlParser()}. * Do not use this constructor, the recommended way to obtain a new instance of the XML parser is to invoke
* {@link FhirContext#newXmlParser()}.
*/ */
public XmlParser(FhirContext theContext) { public XmlParser(FhirContext theContext) {
super(theContext); super(theContext);
@ -438,8 +435,7 @@ public class XmlParser extends BaseParser implements IParser {
theEventWriter.close(); theEventWriter.close();
} }
private void encodeChildElementToStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, IBase nextValue, String childName, BaseRuntimeElementDefinition<?> childDef, private void encodeChildElementToStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, IBase nextValue, String childName, BaseRuntimeElementDefinition<?> childDef, String theExtensionUrl, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
String theExtensionUrl, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
if (nextValue.isEmpty()) { if (nextValue.isEmpty()) {
if (childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCES && getContainedResources().isEmpty() == false && theIncludedResource == false) { if (childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCES && getContainedResources().isEmpty() == false && theIncludedResource == false) {
// We still want to go in.. // We still want to go in..
@ -483,9 +479,10 @@ public class XmlParser extends BaseParser implements IParser {
case CONTAINED_RESOURCES: { case CONTAINED_RESOURCES: {
BaseContainedDt value = (BaseContainedDt) nextValue; BaseContainedDt value = (BaseContainedDt) nextValue;
/* /*
* Disable per #103 for (IResource next : value.getContainedResources()) { if (getContainedResources().getResourceId(next) != null) { continue; } * Disable per #103 for (IResource next : value.getContainedResources()) { if
* theEventWriter.writeStartElement("contained"); encodeResourceToXmlStreamWriter(next, theEventWriter, true, fixContainedResourceId(next.getId().getValue())); * (getContainedResources().getResourceId(next) != null) { continue; }
* theEventWriter.writeEndElement(); } * theEventWriter.writeStartElement("contained"); encodeResourceToXmlStreamWriter(next, theEventWriter,
* true, fixContainedResourceId(next.getId().getValue())); theEventWriter.writeEndElement(); }
*/ */
for (IBaseResource next : getContainedResources().getContainedResources()) { for (IBaseResource next : getContainedResources().getContainedResources()) {
IdDt resourceId = getContainedResources().getResourceId(next); IdDt resourceId = getContainedResources().getResourceId(next);
@ -517,8 +514,7 @@ public class XmlParser extends BaseParser implements IParser {
} }
private void encodeCompositeElementChildrenToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, List<? extends BaseRuntimeChildDefinition> children, private void encodeCompositeElementChildrenToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, List<? extends BaseRuntimeChildDefinition> children, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
boolean theIncludedResource) throws XMLStreamException, DataFormatException {
for (BaseRuntimeChildDefinition nextChild : children) { for (BaseRuntimeChildDefinition nextChild : children) {
if (nextChild.getElementName().equals("extension") || nextChild.getElementName().equals("modifierExtension")) { if (nextChild.getElementName().equals("extension") || nextChild.getElementName().equals("modifierExtension")) {
continue; continue;
@ -599,8 +595,7 @@ public class XmlParser extends BaseParser implements IParser {
} }
} }
private void encodeCompositeElementToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> theElementDefinition, private void encodeCompositeElementToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> theElementDefinition, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
boolean theIncludedResource) throws XMLStreamException, DataFormatException {
encodeExtensionsIfPresent(theResource, theEventWriter, theElement, theIncludedResource); encodeExtensionsIfPresent(theResource, theEventWriter, theElement, theIncludedResource);
encodeCompositeElementChildrenToStreamWriter(theResource, theElement, theEventWriter, theElementDefinition.getExtensions(), theIncludedResource); encodeCompositeElementChildrenToStreamWriter(theResource, theElement, theEventWriter, theElementDefinition.getExtensions(), theIncludedResource);
encodeCompositeElementChildrenToStreamWriter(theResource, theElement, theEventWriter, theElementDefinition.getChildren(), theIncludedResource); encodeCompositeElementChildrenToStreamWriter(theResource, theElement, theEventWriter, theElementDefinition.getChildren(), theIncludedResource);
@ -623,8 +618,9 @@ 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 * This is just to work around the fact that casting java.util.List<ca.uhn.fhir.model.api.ExtensionDt> to
* rejected by the compiler some of the time. * 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) { private <Q extends IBaseExtension<?>> List<IBaseExtension<?>> toBaseExtensionList(final List<Q> theList) {
List<IBaseExtension<?>> retVal = new ArrayList<IBaseExtension<?>>(theList.size()); List<IBaseExtension<?>> retVal = new ArrayList<IBaseExtension<?>>(theList.size());
@ -647,11 +643,10 @@ public class XmlParser extends BaseParser implements IParser {
} }
} }
private void encodeResourceToStreamWriterInDstu2Format(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, private void encodeResourceToStreamWriterInDstu2Format(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> resDef, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
BaseRuntimeElementCompositeDefinition<?> resDef, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
/* /*
* DSTU2 requires extensions to come in a specific spot within the encoded content - This is a bit of a messy way to make that happen, but hopefully this won't matter as much once we use the * DSTU2 requires extensions to come in a specific spot within the encoded content - This is a bit of a messy
* HL7 structures * way to make that happen, but hopefully this won't matter as much once we use the HL7 structures
*/ */
List<BaseRuntimeChildDefinition> preExtensionChildren = new ArrayList<BaseRuntimeChildDefinition>(); List<BaseRuntimeChildDefinition> preExtensionChildren = new ArrayList<BaseRuntimeChildDefinition>();
@ -741,12 +736,17 @@ public class XmlParser extends BaseParser implements IParser {
if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) { if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
// DSTU2+ // DSTU2+
IResource resource = (IResource) theResource; IResource resource = (IResource) theResource;
writeOptionalTagWithValue(theEventWriter, "id", theResourceId); writeOptionalTagWithValue(theEventWriter, "id", theResourceId);
InstantDt updated = (InstantDt) resource.getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED); InstantDt updated = (InstantDt) resource.getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
IdDt resourceId = resource.getId(); IdDt resourceId = resource.getId();
if (resourceId != null && isNotBlank(resourceId.getVersionIdPart()) || (updated != null && !updated.isEmpty())) { List<BaseCodingDt> securityLabels = ResourceMetadataKeyEnum.SECURITY_LABELS.get(resource);
if (securityLabels == null) {
securityLabels = Collections.emptyList();
}
if ((resourceId != null && isNotBlank(resourceId.getVersionIdPart())) || (updated != null && !updated.isEmpty()) || !securityLabels.isEmpty()) {
theEventWriter.writeStartElement("meta"); theEventWriter.writeStartElement("meta");
String versionIdPart = resourceId.getVersionIdPart(); String versionIdPart = resourceId.getVersionIdPart();
if (isBlank(versionIdPart)) { if (isBlank(versionIdPart)) {
@ -756,6 +756,12 @@ public class XmlParser extends BaseParser implements IParser {
if (updated != null) { if (updated != null) {
writeOptionalTagWithValue(theEventWriter, "lastUpdated", updated.getValueAsString()); writeOptionalTagWithValue(theEventWriter, "lastUpdated", updated.getValueAsString());
} }
for (BaseCodingDt securityLabel : securityLabels) {
theEventWriter.writeStartElement("security");
BaseRuntimeElementCompositeDefinition<?> def = (BaseRuntimeElementCompositeDefinition<?>) myContext.getElementDefinition(securityLabel.getClass());
encodeCompositeElementChildrenToStreamWriter(resource, securityLabel, theEventWriter, def.getChildren(), theContainedResource);
theEventWriter.writeEndElement();
}
theEventWriter.writeEndElement(); theEventWriter.writeEndElement();
} }
@ -822,8 +828,7 @@ public class XmlParser extends BaseParser implements IParser {
} }
} }
private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theWriter, List<? extends IBaseExtension<?>> theExtensions, String tagName, boolean theIncludedResource) private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theWriter, List<? extends IBaseExtension<?>> theExtensions, String tagName, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
throws XMLStreamException, DataFormatException {
for (IBaseExtension<?> next : theExtensions) { for (IBaseExtension<?> next : theExtensions) {
if (next == null) { if (next == null) {
continue; continue;

View File

@ -43,7 +43,6 @@ public interface ICreateTyped extends IClientExecutable<ICreateTyped, MethodOutc
* *
* @param theSearchUrl The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>, * @param theSearchUrl The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>,
* for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code> * for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code>
*
* @since HAPI 0.9 / FHIR DSTU 2 * @since HAPI 0.9 / FHIR DSTU 2
*/ */
ICreateTyped conditionalByUrl(String theSearchUrl); ICreateTyped conditionalByUrl(String theSearchUrl);

View File

@ -37,7 +37,6 @@ public interface IDelete {
* *
* @param theSearchUrl The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>, * @param theSearchUrl The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>,
* for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code> * for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code>
*
* @since HAPI 0.9 / FHIR DSTU 2 * @since HAPI 0.9 / FHIR DSTU 2
*/ */
IDeleteTyped resourceConditionalByUrl(String theSearchUrl); IDeleteTyped resourceConditionalByUrl(String theSearchUrl);

View File

@ -34,7 +34,6 @@ public interface IUpdateTyped extends IUpdateExecutable {
* *
* @param theSearchUrl The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>, * @param theSearchUrl The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>,
* for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code> * for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code>
*
* @since HAPI 0.9 / FHIR DSTU 2 * @since HAPI 0.9 / FHIR DSTU 2
*/ */
IUpdateTyped conditionalByUrl(String theSearchUrl); IUpdateTyped conditionalByUrl(String theSearchUrl);

View File

@ -49,8 +49,7 @@ import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.UriDt; import ca.uhn.fhir.model.primitive.UriDt;
public class InternalCodingDt public class InternalCodingDt extends BaseCodingDt implements ICompositeDatatype
extends BaseCodingDt implements ICompositeDatatype
{ {
/** /**

View File

@ -25,19 +25,16 @@ public interface IBaseEnumFactory<T extends Enum<?>> {
/** /**
* Read an enumeration value from the string that represents it on the XML or JSON * Read an enumeration value from the string that represents it on the XML or JSON
* *
* @param codeString * @param codeString the value found in the XML or JSON
* the value found in the XML or JSON
* @return the enumeration value * @return the enumeration value
* @throws IllegalArgumentException * @throws IllegalArgumentException is the value is not known
* is the value is not known
*/ */
public T fromCode(String codeString) throws IllegalArgumentException; public T fromCode(String codeString) throws IllegalArgumentException;
/** /**
* Get the XML/JSON representation for an enumerated value * Get the XML/JSON representation for an enumerated value
* *
* @param code * @param code - the enumeration value
* - the enumeration value
* @return the XML/JSON representation * @return the XML/JSON representation
*/ */
public String toCode(T code); public String toCode(T code);

View File

@ -1331,7 +1331,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
} }
retVal.addAll(resources); retVal.addAll(resources);
} }
} while (includePids.size() > 0 && previouslyLoadedPids.size() < getConfig().getIncludeLimit()); }
while (includePids.size() > 0 && previouslyLoadedPids.size() < getConfig().getIncludeLimit());
if (previouslyLoadedPids.size() >= getConfig().getIncludeLimit()) { if (previouslyLoadedPids.size() >= getConfig().getIncludeLimit()) {
OperationOutcome oo = new OperationOutcome(); OperationOutcome oo = new OperationOutcome();

View File

@ -41,8 +41,7 @@ public interface IFhirResourceDao<T extends IResource> extends IDao {
DaoMethodOutcome create(T theResource, String theIfNoneExist); DaoMethodOutcome create(T theResource, String theIfNoneExist);
/** /**
* @param thePerformIndexing * @param thePerformIndexing Use with caution! If you set this to false, you need to manually perform indexing or your resources
* Use with caution! If you set this to false, you need to manually perform indexing or your resources
* won't be indexed and searches won't work. * won't be indexed and searches won't work.
*/ */
DaoMethodOutcome create(T theResource, String theIfNoneExist, boolean thePerformIndexing); DaoMethodOutcome create(T theResource, String theIfNoneExist, boolean thePerformIndexing);
@ -75,8 +74,7 @@ public interface IFhirResourceDao<T extends IResource> extends IDao {
BaseHasResource readEntity(IdDt theId); BaseHasResource readEntity(IdDt theId);
/** /**
* @param theCheckForForcedId * @param theCheckForForcedId If true, this method should fail if the requested ID contains a numeric PID which exists, but is
* If true, this method should fail if the requested ID contains a numeric PID which exists, but is
* obscured by a "forced ID" so should not exist as far as the outside world is concerned. * obscured by a "forced ID" so should not exist as far as the outside world is concerned.
*/ */
BaseHasResource readEntity(IdDt theId, boolean theCheckForForcedId); BaseHasResource readEntity(IdDt theId, boolean theCheckForForcedId);

View File

@ -138,7 +138,6 @@ public class FhirSystemDaoDstu2Test {
} }
@Test @Test
public void testTransactionCreateMatchUrlWithTwoMatch() { public void testTransactionCreateMatchUrlWithTwoMatch() {
String methodName = "testTransactionCreateMatchUrlWithTwoMatch"; String methodName = "testTransactionCreateMatchUrlWithTwoMatch";

View File

@ -3,10 +3,14 @@
<title>Search results for resource type Patient</title> <title>Search results for resource type Patient</title>
<id>urn:uuid:d05b8832-2ec2-4df1-9a8f-905ba57823</id> <id>urn:uuid:d05b8832-2ec2-4df1-9a8f-905ba57823</id>
<link href="http://fhir.healthintersections.com.au/open/" rel="fhir-base"/> <link href="http://fhir.healthintersections.com.au/open/" rel="fhir-base"/>
<link href="http://fhir.healthintersections.com.au/open/Patient/_search?_format=text/xml+fhir&amp;search-id=433c4ae6-9b99-4fee-ae1d-b8461a7d9c&amp;&amp;search-sort=_id" rel="self" /> <link href="http://fhir.healthintersections.com.au/open/Patient/_search?_format=text/xml+fhir&amp;search-id=433c4ae6-9b99-4fee-ae1d-b8461a7d9c&amp;&amp;search-sort=_id"
<link href="http://fhir.healthintersections.com.au/open/Patient/_search?_format=text/xml+fhir&amp;search-id=433c4ae6-9b99-4fee-ae1d-b8461a7d9c&amp;&amp;search-sort=_id&amp;search-offset=0&amp;_count=50" rel="first" /> rel="self"/>
<link href="http://fhir.healthintersections.com.au/open/Patient/_search?_format=text/xml+fhir&amp;search-id=433c4ae6-9b99-4fee-ae1d-b8461a7d9c&amp;&amp;search-sort=_id&amp;search-offset=50&amp;_count=50" rel="next" /> <link href="http://fhir.healthintersections.com.au/open/Patient/_search?_format=text/xml+fhir&amp;search-id=433c4ae6-9b99-4fee-ae1d-b8461a7d9c&amp;&amp;search-sort=_id&amp;search-offset=0&amp;_count=50"
<link href="http://fhir.healthintersections.com.au/open/Patient/_search?_format=text/xml+fhir&amp;search-id=433c4ae6-9b99-4fee-ae1d-b8461a7d9c&amp;&amp;search-sort=_id&amp;search-offset=300&amp;_count=50" rel="last" /> rel="first"/>
<link href="http://fhir.healthintersections.com.au/open/Patient/_search?_format=text/xml+fhir&amp;search-id=433c4ae6-9b99-4fee-ae1d-b8461a7d9c&amp;&amp;search-sort=_id&amp;search-offset=50&amp;_count=50"
rel="next"/>
<link href="http://fhir.healthintersections.com.au/open/Patient/_search?_format=text/xml+fhir&amp;search-id=433c4ae6-9b99-4fee-ae1d-b8461a7d9c&amp;&amp;search-sort=_id&amp;search-offset=300&amp;_count=50"
rel="last"/>
<updated>2015-02-21T17:08:03Z</updated> <updated>2015-02-21T17:08:03Z</updated>
<totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">303</totalResults> <totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">303</totalResults>
<entry> <entry>
@ -27,23 +31,32 @@
<b>Generated Narrative</b> <b>Generated Narrative</b>
</p> </p>
<p> <p>
<b>identifier</b>: ??</p> <b>identifier</b>: ??
<p>
<b>name</b>: Eve Everywoman</p>
<p>
<b>telecom</b>: ph: 555-555-2003(work)</p>
<p>
<b>gender</b>: Female
<span style="background: LightGoldenRodYellow ">(Details : {http://hl7.org/fhir/v3/AdministrativeGender code "F" := "Female", given as "Female"})</span>
</p> </p>
<p> <p>
<b>birthDate</b>: 1955-01-06</p> <b>name</b>: Eve Everywoman
</p>
<p> <p>
<b>address</b>: 2222 Home Street, (home)</p> <b>telecom</b>: ph: 555-555-2003(work)
</p>
<p> <p>
<b>photo</b>:</p> <b>gender</b>: Female
<span style="background: LightGoldenRodYellow ">(Details :
{http://hl7.org/fhir/v3/AdministrativeGender code "F" := "Female", given as "Female"})
</span>
</p>
<p> <p>
<b>active</b>: -1</p> <b>birthDate</b>: 1955-01-06
</p>
<p>
<b>address</b>: 2222 Home Street, (home)
</p>
<p>
<b>photo</b>:
</p>
<p>
<b>active</b>: -1
</p>
</div> </div>
</text> </text>
<identifier> <identifier>
@ -81,7 +94,10 @@
</Patient> </Patient>
</content> </content>
<summary type="xhtml"> <summary type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">Generated Narrative&#xD;&#xA;identifier: ??&#xD;&#xA;name: Eve Everywoman&#xD;&#xA;telecom: ph: 555-555-2003(work)&#xD;&#xA;gender: Female (Details : {http://hl7.org/fhir/v3/AdministrativeGender code "F" := "Female", given as "Female"})&#xD;&#xA;birthDate: 1955-01-06&#xD;&#xA;address: 2222 Home Street&#x2026;</div> <div xmlns="http://www.w3.org/1999/xhtml">Generated Narrative&#xD;&#xA;identifier: ??&#xD;&#xA;name: Eve
Everywoman&#xD;&#xA;telecom: ph: 555-555-2003(work)&#xD;&#xA;gender: Female (Details :
{http://hl7.org/fhir/v3/AdministrativeGender code "F" := "Female", given as "Female"})&#xD;&#xA;birthDate:
1955-01-06&#xD;&#xA;address: 2222 Home Street&#x2026;</div>
</summary> </summary>
</entry> </entry>
<entry> <entry>
@ -120,16 +136,24 @@
<tr> <tr>
<td>Name</td> <td>Name</td>
<td>Peter James <td>Peter James
<b>Chalmers</b>("Jim")</td> </tr> <b>Chalmers</b>("Jim")
</td>
</tr>
<tr> <tr>
<td>Address</td> <td>Address</td>
<td>534 Erewhon, Pleasantville, Orange County, 3999</td> </tr> <td>534 Erewhon, Pleasantville, Orange County, 3999</td>
</tr>
<tr> <tr>
<td>Contacts</td> <td>Contacts</td>
<td>Home: unknown. Work: (03) 5555 6473</td> </tr> <td>Home: unknown. Work: (03) 5555 6473</td>
</tr>
<tr> <tr>
<td>Id</td> <td>Id</td>
<td>MRN: 12345 (Acme Healthcare)</td> </tr> </tbody> </table> </div> <td>MRN: 12345 (Acme Healthcare)</td>
</tr>
</tbody>
</table>
</div>
</text> </text>
<!-- Peter James Chalmers, but called "Jim" --> <!-- Peter James Chalmers, but called "Jim" -->
<name> <name>
@ -152,7 +176,9 @@
</Patient> </Patient>
</content> </content>
<summary type="xhtml"> <summary type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">Name&#xA; Peter James Chalmers ("Jim")&#xA; &#xA; &#xA; Address&#xA; 534 Erewhon, Pleasantville, Orange County, 3999&#xA; &#xA; &#xA; Contacts&#xA; Home: unknown. Work: (03) 5555 6473&#xA; &#xA; &#x2026;</div> <div xmlns="http://www.w3.org/1999/xhtml">Name&#xA; Peter James Chalmers ("Jim")&#xA; &#xA; &#xA; Address&#xA;
534 Erewhon, Pleasantville, Orange County, 3999&#xA; &#xA; &#xA; Contacts&#xA; Home: unknown. Work: (03)
5555 6473&#xA; &#xA; &#x2026;</div>
</summary> </summary>
</entry> </entry>
</feed> </feed>

View File

@ -0,0 +1,20 @@
package ca.uhn.fhirtest;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
/**
* Created by mochaholic on 18/02/2015.
*/
public class MySqlServer implements InitializingBean, DisposableBean {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MySqlServer.class);
@Override
public void destroy() throws Exception {
}
@Override
public void afterPropertiesSet() throws Exception {
}
}

View File

@ -1,11 +1,13 @@
package ca.uhn.fhirtest; package ca.uhn.fhirtest;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.ContextLoaderListener;
@ -50,7 +52,8 @@ public class TestRestfulServer extends RestfulServer {
// retrieve all the appropriate resource providers and the // retrieve all the appropriate resource providers and the
// conformance provider // conformance provider
List<IResourceProvider> beans; List<IResourceProvider> beans;
JpaSystemProviderDstu1 systemProvider; JpaSystemProviderDstu1 systemProviderDstu1 = null;
JpaSystemProviderDstu2 systemProviderDstu2 = null;
IFhirSystemDao systemDao; IFhirSystemDao systemDao;
ETagSupportEnum etagSupport; ETagSupportEnum etagSupport;
String baseUrlProperty; String baseUrlProperty;
@ -58,7 +61,7 @@ public class TestRestfulServer extends RestfulServer {
case "BASE": { case "BASE": {
setFhirContext(FhirContext.forDstu1()); setFhirContext(FhirContext.forDstu1());
beans = myAppCtx.getBean("myResourceProvidersDstu1", List.class); beans = myAppCtx.getBean("myResourceProvidersDstu1", List.class);
systemProvider = myAppCtx.getBean("mySystemProviderDstu1", JpaSystemProviderDstu1.class); systemProviderDstu1 = myAppCtx.getBean("mySystemProviderDstu1", JpaSystemProviderDstu1.class);
systemDao = myAppCtx.getBean("mySystemDaoDstu1", IFhirSystemDao.class); systemDao = myAppCtx.getBean("mySystemDaoDstu1", IFhirSystemDao.class);
etagSupport = ETagSupportEnum.DISABLED; etagSupport = ETagSupportEnum.DISABLED;
JpaConformanceProviderDstu1 confProvider = new JpaConformanceProviderDstu1(this, systemDao); JpaConformanceProviderDstu1 confProvider = new JpaConformanceProviderDstu1(this, systemDao);
@ -70,7 +73,7 @@ public class TestRestfulServer extends RestfulServer {
case "DSTU1": { case "DSTU1": {
setFhirContext(FhirContext.forDstu1()); setFhirContext(FhirContext.forDstu1());
beans = myAppCtx.getBean("myResourceProvidersDstu1", List.class); beans = myAppCtx.getBean("myResourceProvidersDstu1", List.class);
systemProvider = myAppCtx.getBean("mySystemProviderDstu1", JpaSystemProviderDstu1.class); systemProviderDstu1 = myAppCtx.getBean("mySystemProviderDstu1", JpaSystemProviderDstu1.class);
systemDao = myAppCtx.getBean("mySystemDaoDstu1", IFhirSystemDao.class); systemDao = myAppCtx.getBean("mySystemDaoDstu1", IFhirSystemDao.class);
etagSupport = ETagSupportEnum.DISABLED; etagSupport = ETagSupportEnum.DISABLED;
JpaConformanceProviderDstu1 confProvider = new JpaConformanceProviderDstu1(this, systemDao); JpaConformanceProviderDstu1 confProvider = new JpaConformanceProviderDstu1(this, systemDao);
@ -82,7 +85,7 @@ public class TestRestfulServer extends RestfulServer {
case "DSTU2": { case "DSTU2": {
setFhirContext(FhirContext.forDstu2()); setFhirContext(FhirContext.forDstu2());
beans = myAppCtx.getBean("myResourceProvidersDstu2", List.class); beans = myAppCtx.getBean("myResourceProvidersDstu2", List.class);
systemProvider = myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu1.class); systemProviderDstu2 = myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class);
systemDao = myAppCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class); systemDao = myAppCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class);
etagSupport = ETagSupportEnum.ENABLED; etagSupport = ETagSupportEnum.ENABLED;
JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao); JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao);
@ -115,7 +118,13 @@ public class TestRestfulServer extends RestfulServer {
ourLog.info(" * Have resource provider for: {}", nextResourceProvider.getResourceType().getSimpleName()); ourLog.info(" * Have resource provider for: {}", nextResourceProvider.getResourceType().getSimpleName());
} }
setResourceProviders(beans); setResourceProviders(beans);
setPlainProviders(systemProvider);
List provList = new ArrayList();
if (systemProviderDstu1 != null)
provList.add(systemProviderDstu1);
if (systemProviderDstu2 != null)
provList.add(systemProviderDstu2);
setPlainProviders(provList);
/* /*
* This tells the server to use "incorrect" MIME types if it detects that the * This tells the server to use "incorrect" MIME types if it detects that the

View File

@ -1,5 +1,6 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:oauth="http://www.springframework.org/schema/security/oauth2" xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
@ -25,6 +26,12 @@
<bean id="dbServer" class="ca.uhn.fhirtest.DerbyNetworkServer"> <bean id="dbServer" class="ca.uhn.fhirtest.DerbyNetworkServer">
</bean> </bean>
<!--for mysql-->
<!--
<bean id="dbServer" class="ca.uhn.fhirtest.MySqlServer">
</bean>
-->
<bean depends-on="dbServer" id="myPersistenceDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> <bean depends-on="dbServer" id="myPersistenceDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<!-- ;create=true /opt/glassfish/glassfish4/glassfish/nodes/localhost-domain1/fhirtest/fhirdb --> <!-- ;create=true /opt/glassfish/glassfish4/glassfish/nodes/localhost-domain1/fhirtest/fhirdb -->
<!-- <property name="url" value="jdbc:hsqldb:hsql://localhost/uhnfhirdb"/>--> <!-- <property name="url" value="jdbc:hsqldb:hsql://localhost/uhnfhirdb"/>-->
@ -37,6 +44,18 @@
<property name="password" value="SA"/> <property name="password" value="SA"/>
</bean> </bean>
<!--for mysql-->
<!--
<bean depends-on="dbServer" id="myPersistenceDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://fhirdb.url/fhirdbname" />
<property name="username" value="sa"/>
<property name="password" value="sa"/>
<property name="testOnBorrow" value="true"/>
<property name="validationQuery" value="select 1;"/>
</bean>
-->
<bean depends-on="dbServer" id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <bean depends-on="dbServer" id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" /> <property name="dataSource" ref="myPersistenceDataSource" />
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" /> <property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />
@ -47,6 +66,7 @@
<property name="generateDdl" value="true" /> <property name="generateDdl" value="true" />
<property name="databasePlatform" value="org.hibernate.dialect.DerbyTenSevenDialect" /> <property name="databasePlatform" value="org.hibernate.dialect.DerbyTenSevenDialect" />
<!-- <property name="databasePlatform" value="org.hibernate.dialect.HSQLDialect" />--> <!-- <property name="databasePlatform" value="org.hibernate.dialect.HSQLDialect" />-->
<!-- <property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect" /> -->
</bean> </bean>
</property> </property>
</bean> </bean>

View File

@ -29,8 +29,10 @@ import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.IFhirVersion; import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.composite.ContainedDt; import ca.uhn.fhir.model.dev.composite.ContainedDt;
import ca.uhn.fhir.model.dev.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dev.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dev.resource.Profile; import ca.uhn.fhir.model.dev.resource.Profile;
@ -102,4 +104,9 @@ public class FhirDev implements IFhirVersion {
return ContainedDt.class; return ContainedDt.class;
} }
@Override
public BaseCodingDt newCodingDt() {
return new CodingDt();
}
} }

View File

@ -61,8 +61,10 @@ import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.dstu.composite.CodingDt;
import ca.uhn.fhir.model.dstu.composite.ContainedDt; import ca.uhn.fhir.model.dstu.composite.ContainedDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Profile; import ca.uhn.fhir.model.dstu.resource.Profile;
@ -377,4 +379,10 @@ public class FhirDstu1 implements IFhirVersion {
return ContainedDt.class; return ContainedDt.class;
} }
@Override
public BaseCodingDt newCodingDt() {
return new CodingDt();
}
} }

View File

@ -23,18 +23,18 @@ package ca.uhn.fhir.model.dstu2;
import java.io.InputStream; import java.io.InputStream;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IDatatype;
import ca.uhn.fhir.model.api.IFhirVersion; import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.composite.ContainedDt; import ca.uhn.fhir.model.dstu2.composite.ContainedDt;
import ca.uhn.fhir.model.dstu2.composite.CountDt;
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu2.resource.Profile; import ca.uhn.fhir.model.dstu2.resource.Profile;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
@ -104,4 +104,10 @@ public class FhirDstu2 implements IFhirVersion {
return ContainedDt.class; return ContainedDt.class;
} }
@Override
public BaseCodingDt newCodingDt() {
return new CodingDt();
}
} }

View File

@ -1,12 +1,11 @@
package ca.uhn.fhir.parser; package ca.uhn.fhir.parser;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.sf.json.JSON; import net.sf.json.JSON;
import net.sf.json.JSONSerializer; import net.sf.json.JSONSerializer;
@ -21,14 +20,15 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu2.resource.Binary; import ca.uhn.fhir.model.dstu2.resource.Binary;
import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription; import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription;
import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers; import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers;
import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum; import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum;
import ca.uhn.fhir.model.primitive.BooleanDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.DateDt; import ca.uhn.fhir.model.primitive.DateDt;
import ca.uhn.fhir.model.primitive.DateTimeDt; import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IdDt;
@ -50,6 +50,80 @@ public class JsonParserTest {
assertEquals("{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", val); assertEquals("{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", val);
} }
@Test
public void testEncodeAndParseSecurityLabels() {
Patient p = new Patient();
p.addName().addFamily("FAMILY");
List<BaseCodingDt> labels = new ArrayList<BaseCodingDt>();
labels.add(new CodingDt().setSystem("SYSTEM1").setCode("CODE1").setDisplay("DISPLAY1").setPrimary(true).setVersion("VERSION1").setValueSet(new ResourceReferenceDt("ValueSet1")));
labels.add(new CodingDt().setSystem("SYSTEM2").setCode("CODE2").setDisplay("DISPLAY2").setPrimary(false).setVersion("VERSION2").setValueSet(new ResourceReferenceDt("ValueSet2")));
ResourceMetadataKeyEnum.SECURITY_LABELS.put(p, labels);
String enc = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p);
ourLog.info(enc);
//@formatter:off
assertEquals("{\n" +
" \"resourceType\":\"Patient\",\n" +
" \"meta\":{\n" +
" \"security\":[\n" +
" {\n" +
" \"system\":\"SYSTEM1\",\n" +
" \"version\":\"VERSION1\",\n" +
" \"code\":\"CODE1\",\n" +
" \"display\":\"DISPLAY1\",\n" +
" \"primary\":true,\n" +
" \"valueSet\":{\n" +
" \"reference\":\"ValueSet1\"\n" +
" }\n" +
" },\n" +
" {\n" +
" \"system\":\"SYSTEM2\",\n" +
" \"version\":\"VERSION2\",\n" +
" \"code\":\"CODE2\",\n" +
" \"display\":\"DISPLAY2\",\n" +
" \"primary\":false,\n" +
" \"valueSet\":{\n" +
" \"reference\":\"ValueSet2\"\n" +
" }\n" +
" }\n" +
" ]\n" +
" },\n" +
" \"name\":[\n" +
" {\n" +
" \"family\":[\n" +
" \"FAMILY\"\n" +
" ]\n" +
" }\n" +
" ]\n" +
"}", enc.trim());
//@formatter:on
Patient parsed = ourCtx.newJsonParser().parseResource(Patient.class, enc);
List<BaseCodingDt> gotLabels = ResourceMetadataKeyEnum.SECURITY_LABELS.get(parsed);
assertEquals(2,gotLabels.size());
CodingDt label = (CodingDt) gotLabels.get(0);
assertEquals("SYSTEM1", label.getSystem());
assertEquals("CODE1", label.getCode());
assertEquals("DISPLAY1", label.getDisplay());
assertEquals(true, label.getPrimary());
assertEquals("VERSION1", label.getVersion());
assertEquals("ValueSet1", label.getValueSet().getReference().getValue());
label = (CodingDt) gotLabels.get(1);
assertEquals("SYSTEM2", label.getSystem());
assertEquals("CODE2", label.getCode());
assertEquals("DISPLAY2", label.getDisplay());
assertEquals(false, label.getPrimary());
assertEquals("VERSION2", label.getVersion());
assertEquals("ValueSet2", label.getValueSet().getReference().getValue());
}
/** /**
* Fixing #89 * Fixing #89
*/ */

View File

@ -1,8 +1,6 @@
package ca.uhn.fhir.parser; package ca.uhn.fhir.parser;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.emptyOrNullString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@ -10,6 +8,8 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.StringReader; import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.Diff;
@ -21,8 +21,11 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.composite.DurationDt; import ca.uhn.fhir.model.dstu2.composite.DurationDt;
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt; import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu2.resource.AllergyIntolerance; import ca.uhn.fhir.model.dstu2.resource.AllergyIntolerance;
import ca.uhn.fhir.model.dstu2.resource.Binary; import ca.uhn.fhir.model.dstu2.resource.Binary;
import ca.uhn.fhir.model.dstu2.resource.Composition; import ca.uhn.fhir.model.dstu2.resource.Composition;
@ -47,6 +50,73 @@ public class XmlParserTest {
XMLUnit.setIgnoreWhitespace(true); XMLUnit.setIgnoreWhitespace(true);
} }
@Test
public void testEncodeAndParseSecurityLabels() {
Patient p = new Patient();
p.addName().addFamily("FAMILY");
List<BaseCodingDt> labels = new ArrayList<BaseCodingDt>();
labels.add(new CodingDt().setSystem("SYSTEM1").setCode("CODE1").setDisplay("DISPLAY1").setPrimary(true).setVersion("VERSION1").setValueSet(new ResourceReferenceDt("ValueSet1")));
labels.add(new CodingDt().setSystem("SYSTEM2").setCode("CODE2").setDisplay("DISPLAY2").setPrimary(false).setVersion("VERSION2").setValueSet(new ResourceReferenceDt("ValueSet2")));
ResourceMetadataKeyEnum.SECURITY_LABELS.put(p, labels);
String enc = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(p);
ourLog.info(enc);
//@formatter:off
assertThat(enc, stringContainsInOrder("<Patient xmlns=\"http://hl7.org/fhir\">",
"<meta>",
"<security>",
"<system value=\"SYSTEM1\"/>",
"<version value=\"VERSION1\"/>",
"<code value=\"CODE1\"/>",
"<display value=\"DISPLAY1\"/>",
"<primary value=\"true\"/>",
"<valueSet>",
"<reference value=\"ValueSet1\"/>",
"</valueSet>",
"</security>",
"<security>",
"<system value=\"SYSTEM2\"/>",
"<version value=\"VERSION2\"/>",
"<code value=\"CODE2\"/>",
"<display value=\"DISPLAY2\"/>",
"<primary value=\"false\"/>",
"<valueSet>",
"<reference value=\"ValueSet2\"/>",
"</valueSet>",
"</security>",
"</meta>",
"<name>",
"<family value=\"FAMILY\"/>",
"</name>",
"</Patient>"));
//@formatter:on
Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, enc);
List<BaseCodingDt> gotLabels = ResourceMetadataKeyEnum.SECURITY_LABELS.get(parsed);
assertEquals(2,gotLabels.size());
CodingDt label = (CodingDt) gotLabels.get(0);
assertEquals("SYSTEM1", label.getSystem());
assertEquals("CODE1", label.getCode());
assertEquals("DISPLAY1", label.getDisplay());
assertEquals(true, label.getPrimary());
assertEquals("VERSION1", label.getVersion());
assertEquals("ValueSet1", label.getValueSet().getReference().getValue());
label = (CodingDt) gotLabels.get(1);
assertEquals("SYSTEM2", label.getSystem());
assertEquals("CODE2", label.getCode());
assertEquals("DISPLAY2", label.getDisplay());
assertEquals(false, label.getPrimary());
assertEquals("VERSION2", label.getVersion());
assertEquals("ValueSet2", label.getValueSet().getReference().getValue());
}
@Test @Test
public void testDuration() { public void testDuration() {
Encounter enc = new Encounter(); Encounter enc = new Encounter();

View File

@ -26,20 +26,14 @@ import java.util.ArrayList;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.conf.ServerConformanceProvider; import org.hl7.fhir.instance.conf.ServerConformanceProvider;
import org.hl7.fhir.instance.conf.ServerProfileProvider; import org.hl7.fhir.instance.conf.ServerProfileProvider;
import org.hl7.fhir.instance.model.Extension;
import org.hl7.fhir.instance.model.Profile; import org.hl7.fhir.instance.model.Profile;
import org.hl7.fhir.instance.model.Reference; import org.hl7.fhir.instance.model.Reference;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IFhirVersion; import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
@ -106,4 +100,9 @@ public class FhirDstu2Hl7Org implements IFhirVersion {
return ArrayList.class; return ArrayList.class;
} }
@Override
public BaseCodingDt newCodingDt() {
throw new UnsupportedOperationException();
}
} }

View File

@ -169,15 +169,19 @@ public class Conformance extends DomainResource {
} }
public String getDefinition() { public String getDefinition() {
switch (this) { switch (this) {
case CLIENT: return "The application acts as a client for this resource."; case CLIENT:
case SERVER: return "The application acts as a server for this resource."; return "The application acts as a client for this resource.";
case SERVER:
return "The application acts as a server for this resource.";
default: return "?"; default: return "?";
} }
} }
public String getDisplay() { public String getDisplay() {
switch (this) { switch (this) {
case CLIENT: return "Client"; case CLIENT:
case SERVER: return "Server"; return "Client";
case SERVER:
return "Server";
default: return "?"; default: return "?";
} }
} }

View File

@ -123,8 +123,10 @@ public class DiagnosticOrder extends DomainResource {
} }
public String toCode() { public String toCode() {
switch (this) { switch (this) {
case PROPOSED: return "proposed"; case PROPOSED:
case PLANNED: return "planned"; return "proposed";
case PLANNED:
return "planned";
case REQUESTED: return "requested"; case REQUESTED: return "requested";
case RECEIVED: return "received"; case RECEIVED: return "received";
case ACCEPTED: return "accepted"; case ACCEPTED: return "accepted";
@ -139,8 +141,10 @@ public class DiagnosticOrder extends DomainResource {
} }
public String getSystem() { public String getSystem() {
switch (this) { switch (this) {
case PROPOSED: return ""; case PROPOSED:
case PLANNED: return ""; return "";
case PLANNED:
return "";
case REQUESTED: return ""; case REQUESTED: return "";
case RECEIVED: return ""; case RECEIVED: return "";
case ACCEPTED: return ""; case ACCEPTED: return "";
@ -155,8 +159,10 @@ public class DiagnosticOrder extends DomainResource {
} }
public String getDefinition() { public String getDefinition() {
switch (this) { switch (this) {
case PROPOSED: return "The request has been proposed."; case PROPOSED:
case PLANNED: return "The request has been planned."; return "The request has been proposed.";
case PLANNED:
return "The request has been planned.";
case REQUESTED: return "The request has been placed."; case REQUESTED: return "The request has been placed.";
case RECEIVED: return "The receiving system has received the order, but not yet decided whether it will be performed."; case RECEIVED: return "The receiving system has received the order, but not yet decided whether it will be performed.";
case ACCEPTED: return "The receiving system has accepted the order, but work has not yet commenced."; case ACCEPTED: return "The receiving system has accepted the order, but work has not yet commenced.";
@ -171,8 +177,10 @@ public class DiagnosticOrder extends DomainResource {
} }
public String getDisplay() { public String getDisplay() {
switch (this) { switch (this) {
case PROPOSED: return "proposed"; case PROPOSED:
case PLANNED: return "planned"; return "proposed";
case PLANNED:
return "planned";
case REQUESTED: return "requested"; case REQUESTED: return "requested";
case RECEIVED: return "received"; case RECEIVED: return "received";
case ACCEPTED: return "accepted"; case ACCEPTED: return "accepted";

View File

@ -40,7 +40,9 @@ import org.hl7.fhir.instance.model.annotations.Block;
import org.hl7.fhir.instance.model.annotations.Child; import org.hl7.fhir.instance.model.annotations.Child;
import org.hl7.fhir.instance.model.annotations.Description; import org.hl7.fhir.instance.model.annotations.Description;
/** /**
* Describes the event of a patient consuming or otherwise being administered a medication. This may be as simple as swallowing a tablet or it may be a long running infusion. Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner. * Describes the event of a patient consuming or otherwise being administered a medication. This may be as simple as swallowing a tablet or it may be a long running infusion.
Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.
*/ */
@ResourceDef(name="MedicationAdministration", profile="http://hl7.org/fhir/Profile/MedicationAdministration") @ResourceDef(name="MedicationAdministration", profile="http://hl7.org/fhir/Profile/MedicationAdministration")
public class MedicationAdministration extends DomainResource { public class MedicationAdministration extends DomainResource {
@ -183,7 +185,9 @@ public class MedicationAdministration extends DomainResource {
protected CodeableConcept route; protected CodeableConcept route;
/** /**
* A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration. * A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.
*/ */
@Child(name="method", type={CodeableConcept.class}, order=4, min=0, max=1) @Child(name="method", type={CodeableConcept.class}, order=4, min=0, max=1)
@Description(shortDefinition="How drug was administered", formalDefinition="A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.\r\rTerminologies used often pre-coordinate this term with the route and or form of administration." ) @Description(shortDefinition="How drug was administered", formalDefinition="A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.\r\rTerminologies used often pre-coordinate this term with the route and or form of administration." )
@ -307,7 +311,9 @@ public class MedicationAdministration extends DomainResource {
} }
/** /**
* @return {@link #method} (A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration.) * @return {@link #method} (A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.)
*/ */
public CodeableConcept getMethod() { public CodeableConcept getMethod() {
if (this.method == null) if (this.method == null)
@ -323,7 +329,9 @@ public class MedicationAdministration extends DomainResource {
} }
/** /**
* @param value {@link #method} (A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration.) * @param value {@link #method} (A coded value indicating the method by which the medication was introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.)
*/ */
public MedicationAdministrationDosageComponent setMethod(CodeableConcept value) { public MedicationAdministrationDosageComponent setMethod(CodeableConcept value) {
this.method = value; this.method = value;

View File

@ -197,7 +197,9 @@ public class MedicationDispense extends DomainResource {
protected CodeableConcept route; protected CodeableConcept route;
/** /**
* A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration. * A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.
*/ */
@Child(name="method", type={CodeableConcept.class}, order=6, min=0, max=1) @Child(name="method", type={CodeableConcept.class}, order=6, min=0, max=1)
@Description(shortDefinition="Technique for administering medication", formalDefinition="A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.\r\rTerminologies used often pre-coordinate this term with the route and or form of administration." ) @Description(shortDefinition="Technique for administering medication", formalDefinition="A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.\r\rTerminologies used often pre-coordinate this term with the route and or form of administration." )
@ -386,7 +388,9 @@ public class MedicationDispense extends DomainResource {
} }
/** /**
* @return {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration.) * @return {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.)
*/ */
public CodeableConcept getMethod() { public CodeableConcept getMethod() {
if (this.method == null) if (this.method == null)
@ -402,7 +406,9 @@ public class MedicationDispense extends DomainResource {
} }
/** /**
* @param value {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration.) * @param value {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.)
*/ */
public MedicationDispenseDosageInstructionComponent setMethod(CodeableConcept value) { public MedicationDispenseDosageInstructionComponent setMethod(CodeableConcept value) {
this.method = value; this.method = value;

View File

@ -232,7 +232,9 @@ public class MedicationPrescription extends DomainResource {
protected CodeableConcept route; protected CodeableConcept route;
/** /**
* A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration. * A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.
*/ */
@Child(name="method", type={CodeableConcept.class}, order=7, min=0, max=1) @Child(name="method", type={CodeableConcept.class}, order=7, min=0, max=1)
@Description(shortDefinition="Technique for administering medication", formalDefinition="A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.\r\rTerminologies used often pre-coordinate this term with the route and or form of administration." ) @Description(shortDefinition="Technique for administering medication", formalDefinition="A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.\r\rTerminologies used often pre-coordinate this term with the route and or form of administration." )
@ -470,7 +472,9 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @return {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration.) * @return {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.)
*/ */
public CodeableConcept getMethod() { public CodeableConcept getMethod() {
if (this.method == null) if (this.method == null)
@ -486,7 +490,9 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @param value {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration.) * @param value {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.)
*/ */
public MedicationPrescriptionDosageInstructionComponent setMethod(CodeableConcept value) { public MedicationPrescriptionDosageInstructionComponent setMethod(CodeableConcept value) {
this.method = value; this.method = value;
@ -656,14 +662,17 @@ public class MedicationPrescription extends DomainResource {
protected Medication medicationTarget; protected Medication medicationTarget;
/** /**
* Design Comments: This indicates the validity period of a prescription (stale dating the Prescription) It reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations. Rationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription. * Design Comments: This indicates the validity period of a prescription (stale dating the Prescription)
It reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations.
Rationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription.
*/ */
@Child(name="validityPeriod", type={Period.class}, order=2, min=0, max=1) @Child(name="validityPeriod", type={Period.class}, order=2, min=0, max=1)
@Description(shortDefinition="Time period supply is authorized for", formalDefinition="Design Comments: This indicates the validity period of a prescription (stale dating the Prescription) \rIt reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations. \rRationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription." ) @Description(shortDefinition="Time period supply is authorized for", formalDefinition="Design Comments: This indicates the validity period of a prescription (stale dating the Prescription) \rIt reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations. \rRationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription." )
protected Period validityPeriod; protected Period validityPeriod;
/** /**
* An integer indicating the number of repeats of the Dispense. UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill. * An integer indicating the number of repeats of the Dispense.
UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill.
*/ */
@Child(name="numberOfRepeatsAllowed", type={IntegerType.class}, order=3, min=0, max=1) @Child(name="numberOfRepeatsAllowed", type={IntegerType.class}, order=3, min=0, max=1)
@Description(shortDefinition="# of refills authorized", formalDefinition="An integer indicating the number of repeats of the Dispense. \rUsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill." ) @Description(shortDefinition="# of refills authorized", formalDefinition="An integer indicating the number of repeats of the Dispense. \rUsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill." )
@ -677,7 +686,8 @@ public class MedicationPrescription extends DomainResource {
protected Quantity quantity; protected Quantity quantity;
/** /**
* Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors. * Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.
In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors.
*/ */
@Child(name="expectedSupplyDuration", type={Duration.class}, order=5, min=0, max=1) @Child(name="expectedSupplyDuration", type={Duration.class}, order=5, min=0, max=1)
@Description(shortDefinition="Days supply per dispense", formalDefinition="Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. \rIn some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors." ) @Description(shortDefinition="Days supply per dispense", formalDefinition="Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. \rIn some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors." )
@ -734,7 +744,9 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @return {@link #validityPeriod} (Design Comments: This indicates the validity period of a prescription (stale dating the Prescription) It reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations. Rationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription.) * @return {@link #validityPeriod} (Design Comments: This indicates the validity period of a prescription (stale dating the Prescription)
It reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations.
Rationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription.)
*/ */
public Period getValidityPeriod() { public Period getValidityPeriod() {
if (this.validityPeriod == null) if (this.validityPeriod == null)
@ -750,7 +762,9 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @param value {@link #validityPeriod} (Design Comments: This indicates the validity period of a prescription (stale dating the Prescription) It reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations. Rationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription.) * @param value {@link #validityPeriod} (Design Comments: This indicates the validity period of a prescription (stale dating the Prescription)
It reflects the prescriber perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations.
Rationale: Indicates when the Prescription becomes valid, and when it ceases to be a dispensable Prescription.)
*/ */
public MedicationPrescriptionDispenseComponent setValidityPeriod(Period value) { public MedicationPrescriptionDispenseComponent setValidityPeriod(Period value) {
this.validityPeriod = value; this.validityPeriod = value;
@ -758,7 +772,8 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @return {@link #numberOfRepeatsAllowed} (An integer indicating the number of repeats of the Dispense. UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value * @return {@link #numberOfRepeatsAllowed} (An integer indicating the number of repeats of the Dispense.
UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value
*/ */
public IntegerType getNumberOfRepeatsAllowedElement() { public IntegerType getNumberOfRepeatsAllowedElement() {
if (this.numberOfRepeatsAllowed == null) if (this.numberOfRepeatsAllowed == null)
@ -778,7 +793,8 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @param value {@link #numberOfRepeatsAllowed} (An integer indicating the number of repeats of the Dispense. UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value * @param value {@link #numberOfRepeatsAllowed} (An integer indicating the number of repeats of the Dispense.
UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value
*/ */
public MedicationPrescriptionDispenseComponent setNumberOfRepeatsAllowedElement(IntegerType value) { public MedicationPrescriptionDispenseComponent setNumberOfRepeatsAllowedElement(IntegerType value) {
this.numberOfRepeatsAllowed = value; this.numberOfRepeatsAllowed = value;
@ -786,14 +802,16 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @return An integer indicating the number of repeats of the Dispense. UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill. * @return An integer indicating the number of repeats of the Dispense.
UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill.
*/ */
public int getNumberOfRepeatsAllowed() { public int getNumberOfRepeatsAllowed() {
return this.numberOfRepeatsAllowed == null ? 0 : this.numberOfRepeatsAllowed.getValue(); return this.numberOfRepeatsAllowed == null ? 0 : this.numberOfRepeatsAllowed.getValue();
} }
/** /**
* @param value An integer indicating the number of repeats of the Dispense. UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill. * @param value An integer indicating the number of repeats of the Dispense.
UsageNotes: For example, the number of times the prescribed quantity is to be supplied including the initial standard fill.
*/ */
public MedicationPrescriptionDispenseComponent setNumberOfRepeatsAllowed(int value) { public MedicationPrescriptionDispenseComponent setNumberOfRepeatsAllowed(int value) {
if (this.numberOfRepeatsAllowed == null) if (this.numberOfRepeatsAllowed == null)
@ -827,7 +845,8 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @return {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors.) * @return {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.
In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors.)
*/ */
public Duration getExpectedSupplyDuration() { public Duration getExpectedSupplyDuration() {
if (this.expectedSupplyDuration == null) if (this.expectedSupplyDuration == null)
@ -843,7 +862,8 @@ public class MedicationPrescription extends DomainResource {
} }
/** /**
* @param value {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors.) * @param value {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.
In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors.)
*/ */
public MedicationPrescriptionDispenseComponent setExpectedSupplyDuration(Duration value) { public MedicationPrescriptionDispenseComponent setExpectedSupplyDuration(Duration value) {
this.expectedSupplyDuration = value; this.expectedSupplyDuration = value;

View File

@ -169,7 +169,9 @@ public class MedicationStatement extends DomainResource {
protected CodeableConcept route; protected CodeableConcept route;
/** /**
* A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration. * A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.
*/ */
@Child(name="method", type={CodeableConcept.class}, order=6, min=0, max=1) @Child(name="method", type={CodeableConcept.class}, order=6, min=0, max=1)
@Description(shortDefinition="Technique used to administer medication", formalDefinition="A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.\r\rTerminologies used often pre-coordinate this term with the route and or form of administration." ) @Description(shortDefinition="Technique used to administer medication", formalDefinition="A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.\r\rTerminologies used often pre-coordinate this term with the route and or form of administration." )
@ -361,7 +363,9 @@ public class MedicationStatement extends DomainResource {
} }
/** /**
* @return {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration.) * @return {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.)
*/ */
public CodeableConcept getMethod() { public CodeableConcept getMethod() {
if (this.method == null) if (this.method == null)
@ -377,7 +381,9 @@ public class MedicationStatement extends DomainResource {
} }
/** /**
* @param value {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV. Terminologies used often pre-coordinate this term with the route and or form of administration.) * @param value {@link #method} (A coded value indicating the method by which the medication is introduced into or onto the body. Most commonly used for injections. Examples: Slow Push; Deep IV.
Terminologies used often pre-coordinate this term with the route and or form of administration.)
*/ */
public MedicationStatementDosageComponent setMethod(CodeableConcept value) { public MedicationStatementDosageComponent setMethod(CodeableConcept value) {
this.method = value; this.method = value;

View File

@ -287,6 +287,7 @@ public class Narrative extends Element implements INarrative {
/** /**
* Sets the value of * Sets the value of
*
* @param theString * @param theString
* @throws Exception * @throws Exception
*/ */

View File

@ -99,8 +99,10 @@ public class NutritionOrder extends DomainResource {
} }
public String toCode() { public String toCode() {
switch (this) { switch (this) {
case PROPOSED: return "proposed"; case PROPOSED:
case PLANNED: return "planned"; return "proposed";
case PLANNED:
return "planned";
case REQUESTED: return "requested"; case REQUESTED: return "requested";
case ACTIVE: return "active"; case ACTIVE: return "active";
case INACTIVE: return "inactive"; case INACTIVE: return "inactive";
@ -111,8 +113,10 @@ public class NutritionOrder extends DomainResource {
} }
public String getSystem() { public String getSystem() {
switch (this) { switch (this) {
case PROPOSED: return ""; case PROPOSED:
case PLANNED: return ""; return "";
case PLANNED:
return "";
case REQUESTED: return ""; case REQUESTED: return "";
case ACTIVE: return ""; case ACTIVE: return "";
case INACTIVE: return ""; case INACTIVE: return "";
@ -123,25 +127,39 @@ public class NutritionOrder extends DomainResource {
} }
public String getDefinition() { public String getDefinition() {
switch (this) { switch (this) {
case PROPOSED: return "The request has been proposed."; case PROPOSED:
case PLANNED: return "The request has been planned."; return "The request has been proposed.";
case REQUESTED: return "The request has been placed."; case PLANNED:
case ACTIVE: return "The request is 'actionable', but not all actions that are implied by it have occurred yet."; return "The request has been planned.";
case INACTIVE: return "???."; case REQUESTED:
case HELD: return "Actions implied by the request have been temporarily halted, but are expected to continue later. May also be called 'suspended'."; return "The request has been placed.";
case CANCELLED: return "???."; case ACTIVE:
return "The request is 'actionable', but not all actions that are implied by it have occurred yet.";
case INACTIVE:
return "???.";
case HELD:
return "Actions implied by the request have been temporarily halted, but are expected to continue later. May also be called 'suspended'.";
case CANCELLED:
return "???.";
default: return "?"; default: return "?";
} }
} }
public String getDisplay() { public String getDisplay() {
switch (this) { switch (this) {
case PROPOSED: return "proposed"; case PROPOSED:
case PLANNED: return "planned"; return "proposed";
case REQUESTED: return "requested"; case PLANNED:
case ACTIVE: return "active"; return "planned";
case INACTIVE: return "inactive"; case REQUESTED:
case HELD: return "held"; return "requested";
case CANCELLED: return "cancelled"; case ACTIVE:
return "active";
case INACTIVE:
return "inactive";
case HELD:
return "held";
case CANCELLED:
return "cancelled";
default: return "?"; default: return "?";
} }
} }

View File

@ -372,6 +372,7 @@ public class Practitioner extends DomainResource {
} }
// syntactic sugar // syntactic sugar
/** /**
* @return {@link #location} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The location(s) at which this practitioner provides care.) * @return {@link #location} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The location(s) at which this practitioner provides care.)
*/ */
@ -423,6 +424,7 @@ public class Practitioner extends DomainResource {
} }
// syntactic sugar // syntactic sugar
/** /**
* @return {@link #healthcareService} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The list of healthcare services that this worker offers at this location of this organization.) * @return {@link #healthcareService} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The list of healthcare services that this worker offers at this location of this organization.)
*/ */
@ -453,18 +455,21 @@ public class Practitioner extends DomainResource {
dst.specialty = new ArrayList<CodeableConcept>(); dst.specialty = new ArrayList<CodeableConcept>();
for (CodeableConcept i : specialty) for (CodeableConcept i : specialty)
dst.specialty.add(i.copy()); dst.specialty.add(i.copy());
}; }
;
dst.period = period == null ? null : period.copy(); dst.period = period == null ? null : period.copy();
if (location != null) { if (location != null) {
dst.location = new ArrayList<Reference>(); dst.location = new ArrayList<Reference>();
for (Reference i : location) for (Reference i : location)
dst.location.add(i.copy()); dst.location.add(i.copy());
}; }
;
if (healthcareService != null) { if (healthcareService != null) {
dst.healthcareService = new ArrayList<Reference>(); dst.healthcareService = new ArrayList<Reference>();
for (Reference i : healthcareService) for (Reference i : healthcareService)
dst.healthcareService.add(i.copy()); dst.healthcareService.add(i.copy());
}; }
;
return dst; return dst;
} }
@ -1163,7 +1168,8 @@ public class Practitioner extends DomainResource {
dst.photo = new ArrayList<Attachment>(); dst.photo = new ArrayList<Attachment>();
for (Attachment i : photo) for (Attachment i : photo)
dst.photo.add(i.copy()); dst.photo.add(i.copy());
}; }
;
if (practitionerRole != null) { if (practitionerRole != null) {
dst.practitionerRole = new ArrayList<PractitionerPractitionerRoleComponent>(); dst.practitionerRole = new ArrayList<PractitionerPractitionerRoleComponent>();
for (PractitionerPractitionerRoleComponent i : practitionerRole) for (PractitionerPractitionerRoleComponent i : practitionerRole)

View File

@ -242,7 +242,8 @@ public class Questionnaire extends DomainResource {
case TIME: return "time"; case TIME: return "time";
case STRING: return "string"; case STRING: return "string";
case TEXT: return "text"; case TEXT: return "text";
case URL: return "url"; case URL:
return "url";
case CHOICE: return "choice"; case CHOICE: return "choice";
case OPENCHOICE: return "open-choice"; case OPENCHOICE: return "open-choice";
case ATTACHMENT: return "attachment"; case ATTACHMENT: return "attachment";
@ -262,7 +263,8 @@ public class Questionnaire extends DomainResource {
case TIME: return ""; case TIME: return "";
case STRING: return ""; case STRING: return "";
case TEXT: return ""; case TEXT: return "";
case URL: return ""; case URL:
return "";
case CHOICE: return ""; case CHOICE: return "";
case OPENCHOICE: return ""; case OPENCHOICE: return "";
case ATTACHMENT: return ""; case ATTACHMENT: return "";
@ -282,7 +284,8 @@ public class Questionnaire extends DomainResource {
case TIME: return "Answer is a time independent of date."; case TIME: return "Answer is a time independent of date.";
case STRING: return "Answer is a short (few words to short sentence) free-text entry."; case STRING: return "Answer is a short (few words to short sentence) free-text entry.";
case TEXT: return "Answer is a long (potentially multi-paragram) free-text entry."; case TEXT: return "Answer is a long (potentially multi-paragram) free-text entry.";
case URL: return "Answer is a url (website, FTP site, etc.)."; case URL:
return "Answer is a url (website, FTP site, etc.).";
case CHOICE: return "Answer is a choice from a list of options."; case CHOICE: return "Answer is a choice from a list of options.";
case OPENCHOICE: return "Answer is a choice from a list of options or a free-text entry."; case OPENCHOICE: return "Answer is a choice from a list of options or a free-text entry.";
case ATTACHMENT: return "Answer is binary content such as a image, PDF, etc."; case ATTACHMENT: return "Answer is binary content such as a image, PDF, etc.";
@ -302,7 +305,8 @@ public class Questionnaire extends DomainResource {
case TIME: return "time"; case TIME: return "time";
case STRING: return "string"; case STRING: return "string";
case TEXT: return "text"; case TEXT: return "text";
case URL: return "url"; case URL:
return "url";
case CHOICE: return "choice"; case CHOICE: return "choice";
case OPENCHOICE: return "open-choice"; case OPENCHOICE: return "open-choice";
case ATTACHMENT: return "attachment"; case ATTACHMENT: return "attachment";
@ -1686,7 +1690,8 @@ public class Questionnaire extends DomainResource {
dst.telecom = new ArrayList<ContactPoint>(); dst.telecom = new ArrayList<ContactPoint>();
for (ContactPoint i : telecom) for (ContactPoint i : telecom)
dst.telecom.add(i.copy()); dst.telecom.add(i.copy());
}; }
;
dst.group = group == null ? null : group.copy(); dst.group = group == null ? null : group.copy();
return dst; return dst;
} }

View File

@ -31,8 +31,10 @@ import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.IFhirVersion; import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.dev.composite.CodingDt;
import ca.uhn.fhir.model.dev.composite.ContainedDt; import ca.uhn.fhir.model.dev.composite.ContainedDt;
import ca.uhn.fhir.model.dev.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dev.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dev.resource.Profile; import ca.uhn.fhir.model.dev.resource.Profile;
@ -108,5 +110,10 @@ public class FhirDev implements IFhirVersion {
} }
@Override
public BaseCodingDt newCodingDt() {
return new CodingDt();
}
} }

View File

@ -20,8 +20,7 @@ package ca.uhn.fhir.model.dstu;
* #L% * #L%
*/ */
import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.join;
import java.io.InputStream; import java.io.InputStream;
import java.util.Collections; import java.util.Collections;
@ -35,7 +34,6 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils; import org.apache.commons.lang3.text.WordUtils;
import org.hl7.fhir.instance.model.IBaseResource; import org.hl7.fhir.instance.model.IBaseResource;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import ca.uhn.fhir.context.BaseRuntimeChildDefinition; import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition; import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
@ -62,6 +60,7 @@ import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.dstu.composite.ContainedDt; import ca.uhn.fhir.model.dstu.composite.ContainedDt;
@ -380,6 +379,9 @@ public class FhirDstu1 implements IFhirVersion {
return ContainedDt.class; return ContainedDt.class;
} }
@Override
public BaseCodingDt newCodingDt() {
return new ca.uhn.fhir.model.dstu.composite.CodingDt();
}
} }

View File

@ -23,13 +23,13 @@ package ca.uhn.fhir.model.dstu2;
import java.io.InputStream; import java.io.InputStream;
import org.hl7.fhir.instance.model.IBaseResource; import org.hl7.fhir.instance.model.IBaseResource;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.IFhirVersion; import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.dstu2.composite.ContainedDt; import ca.uhn.fhir.model.dstu2.composite.ContainedDt;
@ -94,4 +94,10 @@ public class FhirDstu2 implements IFhirVersion {
} }
@Override
public BaseCodingDt newCodingDt() {
return new ca.uhn.fhir.model.dstu2.composite.CodingDt();
}
} }

View File

@ -132,6 +132,11 @@
<id>esteban-aliverti</id> <id>esteban-aliverti</id>
<name>Esteban Aliverti</name> <name>Esteban Aliverti</name>
</developer> </developer>
<developer>
<id>mochaholic</id>
<name>Mohammad Jafari</name>
<organization>Edmond Scientific Company</organization>
</developer>
</developers> </developers>
<licenses> <licenses>

View File

@ -112,6 +112,10 @@
for users who have parsed a resource with contained resources and want to remove some for users who have parsed a resource with contained resources and want to remove some
before re-encoding. Thanks to Alexander Kley for reporting! before re-encoding. Thanks to Alexander Kley for reporting!
</action> </action>
<action type="fix" issue="110" due-to="mochaholic">
Add support for DSTU2 style security labels in the parser and encoder. Thanks to
Mohammad Jafari for the contribution!
</action>
</release> </release>
<release version="0.8" date="2014-Dec-17"> <release version="0.8" date="2014-Dec-17">
<action type="add"> <action type="add">

View File

@ -148,7 +148,8 @@
web address that a user can use to access the resource. web address that a user can use to access the resource.
</p> </p>
<p> <p>
For instance, if your server is hosted at <code>http://foo.com/fhir</code> For instance, if your server is hosted at
<code>http://foo.com/fhir</code>
and your resource provider returns a Patient resource with the ID "123", and your resource provider returns a Patient resource with the ID "123",
the server should translate that ID to "http://foo.com/fhir/Patient/123". the server should translate that ID to "http://foo.com/fhir/Patient/123".
</p> </p>