Merge branch 'master' of https://github.com/jamesagnew/hapi-fhir into jaxrs-sever-evolution

# Conflicts:
#	hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
This commit is contained in:
Sebastien Riviere 2017-01-27 10:16:43 +01:00
commit dabb3ea2c5
259 changed files with 1936 additions and 1107 deletions

View File

@ -216,18 +216,6 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
orderToElementDef = newOrderToExtensionDef;
}
// while (orderToElementDef.size() > 0 && orderToElementDef.firstKey() <
// 0) {
// BaseRuntimeDeclaredChildDefinition elementDef =
// orderToElementDef.remove(orderToElementDef.firstKey());
// if (elementDef.getElementName().equals("identifier")) {
// orderToElementDef.put(theIdentifierOrder, elementDef);
// } else {
// throw new ConfigurationException("Don't know how to handle element: "
// + elementDef.getElementName());
// }
// }
TreeSet<Integer> orders = new TreeSet<Integer>();
orders.addAll(orderToElementDef.keySet());
orders.addAll(orderToExtensionDef.keySet());
@ -372,7 +360,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
def = new RuntimeChildDirectResource(nextField, childAnnotation, descriptionAnnotation, elementName);
} else {
childIsChoiceType |= choiceTypes.size() > 1;
if (childIsChoiceType && !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) && !IBaseReference.class.isAssignableFrom(nextElementType)) {
if (extensionAttr == null && childIsChoiceType && !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType) && !IBaseReference.class.isAssignableFrom(nextElementType)) {
def = new RuntimeChildChoiceDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, choiceTypes);
} else if (extensionAttr != null) {
/*

View File

@ -38,6 +38,9 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
private String myReferenceSuffix;
private List<Class<? extends IBaseResource>> myResourceTypes;
/**
* Constructor
*/
public RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, List<Class<? extends IBase>> theChoiceTypes) {
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
@ -45,6 +48,8 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
}
/**
* Constructor
*
* For extension, if myChoiceTypes will be set some other way
*/
RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) {
@ -143,6 +148,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
if (IBaseResource.class.isAssignableFrom(next) || IBaseReference.class.isAssignableFrom(next)) {
next = theContext.getVersion().getResourceReferenceType();
elementName = getElementName() + myReferenceSuffix;
myNameToChildDefinition.put(elementName, nextDef);
}
myDatatypeToElementDefinition.put(next, nextDef);

View File

@ -10,7 +10,7 @@ package ca.uhn.fhir.context;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -22,49 +22,66 @@ package ca.uhn.fhir.context;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Extension;
import ca.uhn.fhir.util.ReflectionUtil;
public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclaredChildDefinition {
public class RuntimeChildDeclaredExtensionDefinition extends RuntimeChildChoiceDefinition {
private BaseRuntimeElementDefinition<?> myChildDef;
private Class<? extends IBase> myChildType;
private String myDatatypeChildName;
private boolean myDefinedLocally;
private String myExtensionUrl;
private boolean myModifier;
private Map<String, RuntimeChildDeclaredExtensionDefinition> myUrlToChildExtension;
private volatile Object myInstanceConstructorArguments;
private Class<?> myEnumerationType;
private Class<? extends IBase> myChildType;
private RuntimeResourceBlockDefinition myChildResourceBlock;
private BaseRuntimeElementDefinition<?> myChildDef;
/**
* @param theBoundTypeBinder
* If the child is of a type that requires a constructor argument to instantiate, this is the argument to
* use
* If the child is of a type that requires a constructor argument to instantiate, this is the argument to
* use
* @param theDefinedLocally
* See {@link Extension#definedLocally()}
* See {@link Extension#definedLocally()}
*/
RuntimeChildDeclaredExtensionDefinition(Field theField, Child theChild, Description theDescriptionAnnotation, Extension theExtension, String theElementName, String theExtensionUrl, Class<? extends IBase> theChildType, Object theBoundTypeBinder)
RuntimeChildDeclaredExtensionDefinition(Field theField, Child theChild, Description theDescriptionAnnotation, Extension theExtension, String theElementName, String theExtensionUrl,
Class<? extends IBase> theChildType, Object theBoundTypeBinder)
throws ConfigurationException {
super(theField, theChild, theDescriptionAnnotation, theElementName);
super(theField, theElementName, theChild, theDescriptionAnnotation);
assert isNotBlank(theExtensionUrl);
myExtensionUrl = theExtensionUrl;
myChildType = theChildType;
myDefinedLocally = theExtension.definedLocally();
myModifier = theExtension.isModifier();
myInstanceConstructorArguments = theBoundTypeBinder;
List<Class<? extends IBase>> choiceTypes = new ArrayList<Class<? extends IBase>>();
for (Class<? extends IElement> next : theChild.type()) {
choiceTypes.add(next);
}
if (Modifier.isAbstract(theChildType.getModifiers()) == false) {
choiceTypes.add(theChildType);
}
setChoiceTypes(choiceTypes);
}
@Override
public String getElementName() {
return "value";
}
@Override
@ -82,58 +99,66 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
}
@Override
public BaseRuntimeElementDefinition<?> getChildByName(String theName) {
if (myDatatypeChildName != null) {
if (myDatatypeChildName.equals(theName)) {
return myChildDef;
} else {
return null;
public String getChildNameByDatatype(Class<? extends IBase> theDatatype) {
String retVal = super.getChildNameByDatatype(theDatatype);
if (retVal != null) {
BaseRuntimeElementDefinition<?> childDef = super.getChildElementDefinitionByDatatype(theDatatype);
if (childDef instanceof RuntimeResourceBlockDefinition) {
// Child is a newted extension
retVal = null;
}
} else {
return null;
}
if (retVal == null) {
if (myModifier) {
return "modifierExtension";
} else {
return "extension";
}
}
return retVal;
}
@Override
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theType) {
if (myChildType.equals(theType)) {
return myChildDef;
public BaseRuntimeElementDefinition<?> getChildByName(String theName) {
String name = theName;
if ("extension".equals(name)||"modifierExtension".equals(name)) {
if (myChildResourceBlock != null) {
return myChildResourceBlock;
}
if (myChildDef != null) {
return myChildDef;
}
}
return null;
if (getValidChildNames().contains(name) == false) {
return null;
}
return super.getChildByName(name);
}
@Override
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theDatatype) {
if (myChildResourceBlock != null) {
if (myChildResourceBlock.getImplementingClass().equals(theDatatype)) {
return myChildResourceBlock;
}
}
return super.getChildElementDefinitionByDatatype(theDatatype);
}
public RuntimeChildDeclaredExtensionDefinition getChildExtensionForUrl(String theUrl) {
return myUrlToChildExtension.get(theUrl);
}
@Override
public String getChildNameByDatatype(Class<? extends IBase> theDatatype) {
if (myChildType.equals(theDatatype) && myDatatypeChildName != null) {
return myDatatypeChildName;
} else {
return "extension";
}
}
public Class<? extends IBase> getChildType() {
return myChildType;
}
@Override
public String getExtensionUrl() {
return myExtensionUrl;
}
@Override
public BaseRuntimeElementDefinition<?> getSingleChildOrThrow() {
return myChildDef;
}
@Override
public Set<String> getValidChildNames() {
return Collections.emptySet();
}
public boolean isDefinedLocally() {
return myDefinedLocally;
}
@ -143,50 +168,52 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
return myModifier;
}
public IBase newInstance() {
try {
return myChildType.newInstance();
} catch (InstantiationException e) {
throw new ConfigurationException("Failed to instantiate type:" + myChildType.getName(), e);
} catch (IllegalAccessException e) {
throw new ConfigurationException("Failed to instantiate type:" + myChildType.getName(), e);
}
}
@Override
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
myUrlToChildExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>();
BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(myChildType);
/*
* This will happen for any type that isn't defined in the base set of
* This will happen for any type that isn't defined in the base set of
* built-in types, e.g. custom structures or custom extensions
*/
if (elementDef == null) {
elementDef = theContext.getElementDefinition(myChildType);
}
if (elementDef instanceof RuntimePrimitiveDatatypeDefinition || elementDef instanceof RuntimeCompositeDatatypeDefinition) {
myDatatypeChildName = "value" + elementDef.getName().substring(0, 1).toUpperCase() + elementDef.getName().substring(1);
if ("valueResourceReference".equals(myDatatypeChildName)) {
// Per one of the examples here: http://hl7.org/implement/standards/fhir/extensibility.html#extension
myDatatypeChildName = "valueResource";
List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
types.add(IResource.class);
myChildDef = findResourceReferenceDefinition(theClassToElementDefinitions);
} else {
myChildDef = elementDef;
if (Modifier.isAbstract(myChildType.getModifiers()) == false) {
elementDef = theContext.getElementDefinition(myChildType);
}
} else {
}
if (elementDef instanceof RuntimePrimitiveDatatypeDefinition || elementDef instanceof RuntimeCompositeDatatypeDefinition) {
// myDatatypeChildName = "value" + elementDef.getName().substring(0, 1).toUpperCase() + elementDef.getName().substring(1);
// if ("valueResourceReference".equals(myDatatypeChildName)) {
// Per one of the examples here: http://hl7.org/implement/standards/fhir/extensibility.html#extension
// myDatatypeChildName = "valueResource";
// List<Class<? extends IBaseResource>> types = new ArrayList<Class<? extends IBaseResource>>();
// types.add(IBaseResource.class);
// myChildDef = findResourceReferenceDefinition(theClassToElementDefinitions);
// } else {
myChildDef = elementDef;
// }
} else if (elementDef instanceof RuntimeResourceBlockDefinition) {
RuntimeResourceBlockDefinition extDef = ((RuntimeResourceBlockDefinition) elementDef);
for (RuntimeChildDeclaredExtensionDefinition next : extDef.getExtensions()) {
myUrlToChildExtension.put(next.getExtensionUrl(), next);
}
myChildDef = extDef;
myChildResourceBlock = (RuntimeResourceBlockDefinition) elementDef;
}
myUrlToChildExtension = Collections.unmodifiableMap(myUrlToChildExtension);
super.sealAndInitialize(theContext, theClassToElementDefinitions);
}
public IBase newInstance() {
return ReflectionUtil.newInstance(myChildType);
}
public Class<? extends IBase> getChildType() {
return myChildType;
}
}

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.model.primitive;
import static org.apache.commons.lang3.StringUtils.defaultString;
/*
* #%L
* HAPI FHIR - Core Library
@ -10,7 +11,7 @@ package ca.uhn.fhir.model.primitive;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -52,7 +53,7 @@ import ca.uhn.fhir.util.UrlUtil;
* regex: [a-z-Z0-9\-\.]{1,36}
* </p>
*/
@DatatypeDef(name = "id", profileOf=StringDt.class)
@DatatypeDef(name = "id", profileOf = StringDt.class)
public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
private String myBaseUrl;
@ -106,9 +107,9 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor
*
* @param theResourceType
* The resource type (e.g. "Patient")
* The resource type (e.g. "Patient")
* @param theIdPart
* The ID (e.g. "123")
* The ID (e.g. "123")
*/
public IdDt(String theResourceType, BigDecimal theIdPart) {
this(theResourceType, toPlainStringWithNpeThrowIfNeeded(theIdPart));
@ -118,9 +119,9 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor
*
* @param theResourceType
* The resource type (e.g. "Patient")
* The resource type (e.g. "Patient")
* @param theIdPart
* The ID (e.g. "123")
* The ID (e.g. "123")
*/
public IdDt(String theResourceType, Long theIdPart) {
this(theResourceType, toPlainStringWithNpeThrowIfNeeded(theIdPart));
@ -130,9 +131,9 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor
*
* @param theResourceType
* The resource type (e.g. "Patient")
* The resource type (e.g. "Patient")
* @param theId
* The ID (e.g. "123")
* The ID (e.g. "123")
*/
public IdDt(String theResourceType, String theId) {
this(theResourceType, theId, null);
@ -142,11 +143,11 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor
*
* @param theResourceType
* The resource type (e.g. "Patient")
* The resource type (e.g. "Patient")
* @param theId
* The ID (e.g. "123")
* The ID (e.g. "123")
* @param theVersionId
* The version ID ("e.g. "456")
* The version ID ("e.g. "456")
*/
public IdDt(String theResourceType, String theId, String theVersionId) {
this(null, theResourceType, theId, theVersionId);
@ -156,13 +157,13 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor
*
* @param theBaseUrl
* The server base URL (e.g. "http://example.com/fhir")
* The server base URL (e.g. "http://example.com/fhir")
* @param theResourceType
* The resource type (e.g. "Patient")
* The resource type (e.g. "Patient")
* @param theId
* The ID (e.g. "123")
* The ID (e.g. "123")
* @param theVersionId
* The version ID ("e.g. "456")
* The version ID ("e.g. "456")
*/
public IdDt(String theBaseUrl, String theResourceType, String theId, String theVersionId) {
myBaseUrl = theBaseUrl;
@ -202,34 +203,6 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
return getIdPartAsBigDecimal();
}
private String determineLocalPrefix(String theValue) {
if (theValue == null || theValue.isEmpty()) {
return null;
}
if (theValue.startsWith("#")) {
return "#";
}
int lastPrefix = -1;
for (int i = 0; i < theValue.length(); i++) {
char nextChar = theValue.charAt(i);
if (nextChar == ':') {
lastPrefix = i;
} else if (!Character.isLetter(nextChar) || !Character.isLowerCase(nextChar)) {
break;
}
}
if (lastPrefix != -1) {
String candidate = theValue.substring(0, lastPrefix + 1);
if (candidate.startsWith("cid:") || candidate.startsWith("urn:")) {
return candidate;
} else {
return null;
}
} else {
return null;
}
}
@Override
public boolean equals(Object theArg0) {
if (!(theArg0 instanceof IdDt)) {
@ -277,7 +250,7 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Returns the unqualified portion of this ID as a big decimal, or <code>null</code> if the value is null
*
* @throws NumberFormatException
* If the value is not a valid BigDecimal
* If the value is not a valid BigDecimal
*/
public BigDecimal getIdPartAsBigDecimal() {
String val = getIdPart();
@ -291,7 +264,7 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Returns the unqualified portion of this ID as a {@link Long}, or <code>null</code> if the value is null
*
* @throws NumberFormatException
* If the value is not a valid Long
* If the value is not a valid Long
*/
@Override
public Long getIdPartAsLong() {
@ -315,11 +288,11 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
@Override
public String getValue() {
if (super.getValue() == null && myHaveComponentParts) {
if (determineLocalPrefix(myBaseUrl) != null && myResourceType == null && myUnqualifiedVersionId == null) {
return myBaseUrl + myUnqualifiedId;
if (isLocal() || isUrn()) {
return myUnqualifiedId;
}
StringBuilder b = new StringBuilder();
if (isNotBlank(myBaseUrl)) {
b.append(myBaseUrl);
@ -448,18 +421,23 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
}
/**
* Returns <code>true</code> if the ID is a local reference (in other words, it begins with the '#' character)
* Returns <code>true</code> if the ID is a local reference (in other words,
* it begins with the '#' character)
*/
@Override
public boolean isLocal() {
return "#".equals(myBaseUrl);
return defaultString(myUnqualifiedId).startsWith("#");
}
private boolean isUrn() {
return defaultString(myUnqualifiedId).startsWith("urn:");
}
@Override
public boolean isVersionIdPartValidLong() {
return isValidLong(getVersionIdPart());
}
/**
* Copies the value from the given IdDt to <code>this</code> IdDt. It is generally not neccesary to use this method but it is provided for consistency with the rest of the API.
*/
@ -468,6 +446,27 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
setValue(theId.getValue());
}
@Override
public IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart) {
if (isNotBlank(theVersionIdPart)) {
Validate.notBlank(theResourceType, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated");
Validate.notBlank(theIdPart, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated");
}
if (isNotBlank(theBaseUrl) && isNotBlank(theIdPart)) {
Validate.notBlank(theResourceType, "If theBaseUrl is populated and theIdPart is populated, theResourceType must be populated");
}
setValue(null);
myBaseUrl = theBaseUrl;
myResourceType = theResourceType;
myUnqualifiedId = theIdPart;
myUnqualifiedVersionId = StringUtils.defaultIfBlank(theVersionIdPart, null);
myHaveComponentParts = true;
return this;
}
/**
* Set the value
*
@ -484,9 +483,7 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
// TODO: add validation
super.setValue(theValue);
myHaveComponentParts = false;
String localPrefix = determineLocalPrefix(theValue);
if (StringUtils.isBlank(theValue)) {
myBaseUrl = null;
super.setValue(null);
@ -495,14 +492,14 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
myResourceType = null;
} else if (theValue.charAt(0) == '#' && theValue.length() > 1) {
super.setValue(theValue);
myBaseUrl = "#";
myUnqualifiedId = theValue.substring(1);
myBaseUrl = null;
myUnqualifiedId = theValue;
myUnqualifiedVersionId = null;
myResourceType = null;
myHaveComponentParts = true;
} else if (localPrefix != null) {
myBaseUrl = localPrefix;
myUnqualifiedId = theValue.substring(localPrefix.length());
} else if (theValue.startsWith("urn:")) {
myBaseUrl = null;
myUnqualifiedId = theValue;
myUnqualifiedVersionId = null;
myResourceType = null;
myHaveComponentParts = true;
@ -567,24 +564,33 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
*/
@Override
public IdDt toUnqualified() {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(getResourceType(), getIdPart(), getVersionIdPart());
}
@Override
public IdDt toUnqualifiedVersionless() {
if (isLocal()) {
return toVersionless();
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(getResourceType(), getIdPart());
}
@Override
public IdDt toVersionless() {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(getBaseUrl(), getResourceType(), getIdPart(), null);
}
@Override
public IdDt withResourceType(String theResourceName) {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(theResourceName, getIdPart(), getVersionIdPart());
}
@ -593,13 +599,16 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* because IdDt can contain either a complete URL or a partial one (or even jut a simple ID), this method may be used to translate into a complete URL.
*
* @param theServerBase
* The server base (e.g. "http://example.com/fhir")
* The server base (e.g. "http://example.com/fhir")
* @param theResourceType
* The resource name (e.g. "Patient")
* The resource name (e.g. "Patient")
* @return A fully qualified URL for this ID (e.g. "http://example.com/fhir/Patient/1")
*/
@Override
public IdDt withServerBase(String theServerBase, String theResourceType) {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(theServerBase, theResourceType, getIdPart(), getVersionIdPart());
}
@ -607,12 +616,17 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Creates a new instance of this ID which is identical, but refers to the specific version of this resource ID noted by theVersion.
*
* @param theVersion
* The actual version string, e.g. "1"
* The actual version string, e.g. "1"
* @return A new instance of IdDt which is identical, but refers to the specific version of this resource ID noted by theVersion.
*/
@Override
public IdDt withVersion(String theVersion) {
Validate.notBlank(theVersion, "Version may not be null or empty");
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
String existingValue = getValue();
int i = existingValue.indexOf(Constants.PARAM_HISTORY);
@ -678,25 +692,4 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
return theIdPart.toString();
}
@Override
public IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart) {
if (isNotBlank(theVersionIdPart)) {
Validate.notBlank(theResourceType, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated");
Validate.notBlank(theIdPart, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated");
}
if (isNotBlank(theBaseUrl) && isNotBlank(theIdPart)) {
Validate.notBlank(theResourceType, "If theBaseUrl is populated and theIdPart is populated, theResourceType must be populated");
}
setValue(null);
myBaseUrl = theBaseUrl;
myResourceType = theResourceType;
myUnqualifiedId = theIdPart;
myUnqualifiedVersionId = StringUtils.defaultIfBlank(theVersionIdPart, null);
myHaveComponentParts = true;
return this;
}
}

View File

@ -347,7 +347,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
for (BundleEntry nextEntry : theBundle.getEntries()) {
theEventWriter.beginObject();
if (nextEntry.getResource() != null && nextEntry.getResource().getId().getBaseUrl() != null) {
if (nextEntry.getResource() != null && isNotBlank(nextEntry.getResource().getIdElement().getValue()) && (nextEntry.getResource().getId().getBaseUrl() != null || nextEntry.getResource().getId().getValueAsString().startsWith("urn:"))) {
writeOptionalTagWithTextNode(theEventWriter, "fullUrl", nextEntry.getResource().getId().getValue());
}

View File

@ -721,7 +721,6 @@ class ParserState<T> {
myInstance = theInstance;
}
@SuppressWarnings("unchecked")
@Override
public void wereBack() {
@ -2090,17 +2089,32 @@ class ParserState<T> {
final boolean bundle = "Bundle".equals(myContext.getResourceDefinition(myInstance).getName());
if (bundle) {
FhirTerser t = myContext.newTerser();
Map<String, IBaseResource> idToResource = new HashMap<String, IBaseResource>();
if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
List<IBase> entries = t.getValues(myInstance, "Bundle.entry", IBase.class);
for (IBase nextEntry : entries) {
IPrimitiveType<?> fullUrl = t.getSingleValueOrNull(nextEntry, "fullUrl", IPrimitiveType.class);
if (fullUrl != null && isNotBlank(fullUrl.getValueAsString())) {
IBaseResource resource = t.getSingleValueOrNull(nextEntry, "resource", IBaseResource.class);
if (resource != null) {
idToResource.put(fullUrl.getValueAsString(), resource);
}
}
}
}
/*
* Stitch together resource references
*/
Map<IIdType, IBaseResource> idToResource = new HashMap<IIdType, IBaseResource>();
FhirTerser t = myContext.newTerser();
List<IBaseResource> resources = t.getAllPopulatedChildElementsOfType(myInstance, IBaseResource.class);
for (IBaseResource next : resources) {
IIdType id = next.getIdElement();
if (id != null && id.isEmpty() == false) {
String resName = myContext.getResourceDefinition(next).getName();
idToResource.put(id.withResourceType(resName).toUnqualifiedVersionless(), next);
IIdType idType = id.withResourceType(resName).toUnqualifiedVersionless();
idToResource.put(idType.getValueAsString(), next);
}
}
@ -2108,7 +2122,8 @@ class ParserState<T> {
List<IBaseReference> refs = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IBaseReference.class);
for (IBaseReference nextRef : refs) {
if (nextRef.isEmpty() == false && nextRef.getReferenceElement() != null) {
IBaseResource target = idToResource.get(nextRef.getReferenceElement().toUnqualifiedVersionless());
IIdType unqualifiedVersionless = nextRef.getReferenceElement().toUnqualifiedVersionless();
IBaseResource target = idToResource.get(unqualifiedVersionless.getValueAsString());
if (target != null) {
nextRef.setResource(target);
}

View File

@ -446,7 +446,7 @@ public class XmlParser extends BaseParser implements IParser {
writeBundleResourceLink(theEventWriter, "alternate", nextEntry.getLinkAlternate());
if (nextEntry.getResource() != null && nextEntry.getResource().getId().getBaseUrl() != null) {
if (nextEntry.getResource() != null && isNotBlank(nextEntry.getResource().getIdElement().getValue()) && (nextEntry.getResource().getId().getBaseUrl() != null || nextEntry.getResource().getId().getValueAsString().startsWith("urn:"))) {
writeOptionalTagWithValue(theEventWriter, "fullUrl", nextEntry.getResource().getId().getValue());
}

View File

@ -75,6 +75,7 @@ import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.NotModifiedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.interceptor.ExceptionHandlingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
@ -253,7 +254,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
} else {
resourceBinding = myResourceNameToBinding.get(resourceName);
if (resourceBinding == null) {
throw new InvalidRequestException("Unknown resource type '" + resourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
throw new ResourceNotFoundException("Unknown resource type '" + resourceName + "' - Server knows how to handle: " + myResourceNameToBinding.keySet());
}
}

View File

@ -24,6 +24,13 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.rest.method.RequestDetails;
/**
* Server interceptor with added methods which can be called within the lifecycle of
* write operations (create/update/delete) or within transaction and batch
* operations that call these sub-operations.
*
* @see ServerOperationInterceptorAdapter
*/
public interface IServerOperationInterceptor extends IServerInterceptor {
/**

View File

@ -13,7 +13,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -67,8 +67,9 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
public static final String PARAM_RAW = "_raw";
public static final String PARAM_RAW_TRUE = "true";
public static final String PARAM_TRUE = "true";
private String format(String theResultBody, EncodingEnum theEncodingEnum) {
String str = StringEscapeUtils.escapeHtml4(theResultBody);
if (str == null || theEncodingEnum == null) {
@ -181,7 +182,8 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
}
@Override
public boolean handleException(RequestDetails theRequestDetails, BaseServerResponseException theException, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws ServletException, IOException {
public boolean handleException(RequestDetails theRequestDetails, BaseServerResponseException theException, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse)
throws ServletException, IOException {
/*
* It's not a browser...
*/
@ -209,13 +211,14 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse);
}
streamResponse(theRequestDetails, theServletResponse, theException.getOperationOutcome(), theServletRequest);
streamResponse(theRequestDetails, theServletResponse, theException.getOperationOutcome(), theServletRequest, theException.getStatusCode());
return false;
}
@Override
public boolean outgoingResponse(RequestDetails theRequestDetails, IBaseResource theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException {
public boolean outgoingResponse(RequestDetails theRequestDetails, IBaseResource theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse)
throws AuthenticationException {
/*
* Request for _raw
@ -225,7 +228,7 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
ourLog.warn("Client is using non-standard/legacy _raw parameter - Use _format=json or _format=xml instead, as this parmameter will be removed at some point");
return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
}
boolean force = false;
String[] formatParams = theRequestDetails.getParameters().get(Constants.PARAM_FORMAT);
if (formatParams != null && formatParams.length > 0) {
@ -242,7 +245,7 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
}
}
/*
* It's not a browser...
*/
@ -263,7 +266,6 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
if (!force && isNotBlank(theServletRequest.getHeader(Constants.HEADER_ORIGIN))) {
return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
}
/*
* Not a GET
@ -279,12 +281,12 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
}
streamResponse(theRequestDetails, theServletResponse, theResponseObject, theServletRequest);
streamResponse(theRequestDetails, theServletResponse, theResponseObject, theServletRequest, 200);
return false;
}
private void streamResponse(RequestDetails theRequestDetails, HttpServletResponse theServletResponse, IBaseResource resource, ServletRequest theServletRequest) {
private void streamResponse(RequestDetails theRequestDetails, HttpServletResponse theServletResponse, IBaseResource resource, ServletRequest theServletRequest, int theStatusCode) {
IParser p;
Map<String, String[]> parameters = theRequestDetails.getParameters();
if (parameters.containsKey(Constants.PARAM_FORMAT)) {
@ -307,110 +309,112 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
if (prettyPrintResponse) {
p.setPrettyPrint(prettyPrintResponse);
}
EncodingEnum encoding = p.getEncoding();
String encoded = p.encodeResourceToString(resource);
theServletResponse.setContentType(Constants.CT_HTML_WITH_UTF8);
try {
StringBuilder b = new StringBuilder();
b.append("<html lang=\"en\">\n");
b.append(" <head>\n");
b.append(" <meta charset=\"utf-8\" />\n");
b.append(" <style>\n");
b.append(".hlQuot {\n");
b.append(" color: #88F;\n");
b.append("}\n");
b.append(".hlAttr {\n");
b.append(" color: #888;\n");
b.append("}\n");
b.append(".hlTagName {\n");
b.append(" color: #006699;\n");
b.append("}\n");
b.append(".hlControl {\n");
b.append(" color: #660000;\n");
b.append("}\n");
b.append(".hlText {\n");
b.append(" color: #000000;\n");
b.append("}\n");
b.append(".hlUrlBase {\n");
b.append("}");
b.append(".headersDiv {\n");
b.append(" background: #EEE;");
b.append("}");
b.append(".headerName {\n");
b.append(" color: #888;\n");
b.append(" font-family: monospace;\n");
b.append("}");
b.append(".headerValue {\n");
b.append(" color: #88F;\n");
b.append(" font-family: monospace;\n");
b.append("}");
b.append("BODY {\n");
b.append(" font-family: Arial;\n");
b.append("}");
b.append(" </style>\n");
b.append(" </head>\n");
b.append("\n");
b.append(" <body>");
b.append("<p>");
b.append("This result is being rendered in HTML for easy viewing. ");
b.append("You may access this content as ");
b.append("<a href=\"");
b.append(createLinkHref(parameters, Constants.FORMAT_JSON));
b.append("\">Raw JSON</a> or ");
if (theStatusCode > 299) {
theServletResponse.setStatus(theStatusCode);
}
theServletResponse.setContentType(Constants.CT_HTML_WITH_UTF8);
b.append("<a href=\"");
b.append(createLinkHref(parameters, Constants.FORMAT_XML));
b.append("\">Raw XML</a>, ");
StringBuilder b = new StringBuilder();
b.append("<html lang=\"en\">\n");
b.append(" <head>\n");
b.append(" <meta charset=\"utf-8\" />\n");
b.append(" <style>\n");
b.append(".hlQuot {\n");
b.append(" color: #88F;\n");
b.append("}\n");
b.append(".hlAttr {\n");
b.append(" color: #888;\n");
b.append("}\n");
b.append(".hlTagName {\n");
b.append(" color: #006699;\n");
b.append("}\n");
b.append(".hlControl {\n");
b.append(" color: #660000;\n");
b.append("}\n");
b.append(".hlText {\n");
b.append(" color: #000000;\n");
b.append("}\n");
b.append(".hlUrlBase {\n");
b.append("}");
b.append(".headersDiv {\n");
b.append(" background: #EEE;");
b.append("}");
b.append(".headerName {\n");
b.append(" color: #888;\n");
b.append(" font-family: monospace;\n");
b.append("}");
b.append(".headerValue {\n");
b.append(" color: #88F;\n");
b.append(" font-family: monospace;\n");
b.append("}");
b.append("BODY {\n");
b.append(" font-family: Arial;\n");
b.append("}");
b.append(" </style>\n");
b.append(" </head>\n");
b.append("\n");
b.append(" <body>");
b.append(" or view this content in ");
b.append("<a href=\"");
b.append(createLinkHref(parameters, Constants.FORMATS_HTML_JSON));
b.append("\">HTML JSON</a> ");
b.append("<p>");
b.append("This result is being rendered in HTML for easy viewing. ");
b.append("You may access this content as ");
b.append("or ");
b.append("<a href=\"");
b.append(createLinkHref(parameters, Constants.FORMATS_HTML_XML));
b.append("\">HTML XML</a>.");
Date startTime = (Date) theServletRequest.getAttribute(RestfulServer.REQUEST_START_TIME);
if (startTime != null) {
long time = System.currentTimeMillis() - startTime.getTime();
b.append(" Response generated in ");
b.append(time);
b.append("ms.");
}
b.append("<a href=\"");
b.append(createLinkHref(parameters, Constants.FORMAT_JSON));
b.append("\">Raw JSON</a> or ");
b.append("</p>");
b.append("\n");
// if (isEncodeHeaders()) {
// b.append("<h1>Request Headers</h1>");
// b.append("<div class=\"headersDiv\">");
// for (int next : theRequestDetails.get)
// b.append("</div>");
// b.append("<h1>Response Headers</h1>");
// b.append("<div class=\"headersDiv\">");
// b.append("</div>");
// b.append("<h1>Response Body</h1>");
// }
b.append("<pre>");
b.append(format(encoded, encoding));
b.append("</pre>");
b.append(" </body>");
b.append("</html>");
b.append("<a href=\"");
b.append(createLinkHref(parameters, Constants.FORMAT_XML));
b.append("\">Raw XML</a>, ");
b.append(" or view this content in ");
b.append("<a href=\"");
b.append(createLinkHref(parameters, Constants.FORMATS_HTML_JSON));
b.append("\">HTML JSON</a> ");
b.append("or ");
b.append("<a href=\"");
b.append(createLinkHref(parameters, Constants.FORMATS_HTML_XML));
b.append("\">HTML XML</a>.");
Date startTime = (Date) theServletRequest.getAttribute(RestfulServer.REQUEST_START_TIME);
if (startTime != null) {
long time = System.currentTimeMillis() - startTime.getTime();
b.append(" Response generated in ");
b.append(time);
b.append("ms.");
}
b.append("</p>");
b.append("\n");
// if (isEncodeHeaders()) {
// b.append("<h1>Request Headers</h1>");
// b.append("<div class=\"headersDiv\">");
// for (int next : theRequestDetails.get)
// b.append("</div>");
// b.append("<h1>Response Headers</h1>");
// b.append("<div class=\"headersDiv\">");
// b.append("</div>");
// b.append("<h1>Response Body</h1>");
// }
b.append("<pre>");
b.append(format(encoded, encoding));
b.append("</pre>");
b.append(" </body>");
b.append("</html>");
//@formatter:off
String out = b.toString();
//@formatter:on
try {
theServletResponse.getWriter().append(out);
theServletResponse.getWriter().close();
} catch (IOException e) {

View File

@ -0,0 +1,47 @@
package ca.uhn.fhir.rest.server.interceptor;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.rest.method.RequestDetails;
/**
* NOP implementation of {@link IServerOperationInterceptor}
*/
public class ServerOperationInterceptorAdapter extends InterceptorAdapter implements IServerOperationInterceptor {
@Override
public void resourceDeleted(RequestDetails theRequest, IBaseResource theResource) {
// nothing
}
@Override
public void resourceCreated(RequestDetails theRequest, IBaseResource theResource) {
// nothing
}
@Override
public void resourceUpdated(RequestDetails theRequest, IBaseResource theResource) {
// nothing
}
}

View File

@ -130,10 +130,41 @@ public interface IIdType extends IPrimitiveType<String> {
IIdType toVersionless();
/**
* Returns a copy of this object, but with a different {@link #getResourceType() resource type}
* (or if this object does not have a resource type currently, returns a copy of this object with
* the given resource type).
* <p>
* Note that if this object represents a local reference (e.g. <code>#foo</code>) or
* a URN (e.g. <code>urn:oid:1.2.3.4</code>) this method will simply return a copy
* of this object with no modifications.
* </p>
*/
IIdType withResourceType(String theResName);
/**
* Returns a copy of this object, but with a different {@link #getResourceType() resource type}
* and {@link #getBaseUrl() base URL}
* (or if this object does not have a resource type currently, returns a copy of this object with
* the given server base and resource type).
* <p>
* Note that if this object represents a local reference (e.g. <code>#foo</code>) or
* a URN (e.g. <code>urn:oid:1.2.3.4</code>) this method will simply return a copy
* of this object with no modifications.
* </p>
*/
IIdType withServerBase(String theServerBase, String theResourceName);
/**
* Returns a copy of this object, but with a different {@link #getVersionIdPart() version ID}
* (or if this object does not have a resource type currently, returns a copy of this object with
* the given version).
* <p>
* Note that if this object represents a local reference (e.g. <code>#foo</code>) or
* a URN (e.g. <code>urn:oid:1.2.3.4</code>) this method will simply return a copy
* of this object with no modifications.
* </p>
*/
IIdType withVersion(String theVersion);
/**

View File

@ -15,7 +15,7 @@ import org.hl7.fhir.instance.model.api.IBaseBinary;
* #%L
* HAPI FHIR OkHttp Client
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.okhttp.client;
* #%L
* HAPI FHIR OkHttp Client
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -8,7 +8,7 @@ import java.util.Map;
* #%L
* HAPI FHIR OkHttp Client
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.okhttp.client;
* #%L
* HAPI FHIR OkHttp Client
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.okhttp.utils;
* #%L
* HAPI FHIR OkHttp Client
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.client;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.client;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.io.IOException;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.client;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.server;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.server;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.server;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -5,7 +5,7 @@ import java.io.IOException;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.server;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.server.interceptor;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.server.interceptor;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.server.util;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jaxrs.server.util;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
* #%L
* HAPI FHIR JAX-RS Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.config;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.config;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.config;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.config;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.config;
/*
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -8,7 +8,7 @@ import org.hl7.fhir.dstu3.validation.IResourceValidator.BestPracticeWarningLevel
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.config.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.config.dstu3;
/*
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import javax.annotation.PostConstruct;
import org.hl7.fhir.dstu3.model.Subscription;

View File

@ -5,7 +5,7 @@ import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -667,11 +667,15 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
}
protected void markRequestAsProcessingSubRequest(ServletRequestDetails theRequestDetails) {
theRequestDetails.getUserData().put(PROCESSING_SUB_REQUEST, Boolean.TRUE);
if (theRequestDetails != null) {
theRequestDetails.getUserData().put(PROCESSING_SUB_REQUEST, Boolean.TRUE);
}
}
protected void clearRequestAsProcessingSubRequest(ServletRequestDetails theRequestDetails) {
theRequestDetails.getUserData().remove(PROCESSING_SUB_REQUEST);
if (theRequestDetails != null) {
theRequestDetails.getUserData().remove(PROCESSING_SUB_REQUEST);
}
}
public String parseContentTextIntoWords(IBaseResource theResource) {
@ -1427,6 +1431,8 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
for (ResourceLink next : links) {
myEntityManager.persist(next);
}
// make sure links are indexed
theEntity.setResourceLinks(links);
theEntity.toString();

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -10,7 +10,7 @@ import org.apache.commons.lang3.time.DateUtils;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -53,8 +53,6 @@ public class DaoConfig {
// ***
private long myExpireSearchResultsAfterMillis = DateUtils.MILLIS_PER_HOUR;
private int myHardSearchLimit = 1000;
private int myHardTagListLimit = 1000;
private int myIncludeLimit = 2000;
@ -325,8 +323,17 @@ public class DaoConfig {
myExpireSearchResultsAfterMillis = theExpireSearchResultsAfterMillis;
}
public void setHardSearchLimit(int theHardSearchLimit) {
myHardSearchLimit = theHardSearchLimit;
/**
* Do not call this method, it exists only for legacy reasons. It
* will be removed in a future version. Configure the page size on your
* paging provider instead.
*
* @deprecated This method does not do anything. Configure the page size on your
* paging provider instead. Deprecated in HAPI FHIR 2.3 (Jan 2017)
*/
@Deprecated
public void setHardSearchLimit(@SuppressWarnings("unused") int theHardSearchLimit) {
// this method does nothing
}
/**

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -8,7 +8,7 @@ import java.util.ArrayList;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -164,7 +164,7 @@ public class FhirSystemDaoDstu1 extends BaseHapiFhirSystemDao<List<IResource>, M
entity = toEntity(nextResource);
entity.setUpdated(updateTime);
entity.setPublished(updateTime);
if (nextId.isEmpty() == false && "cid:".equals(nextId.getBaseUrl())) {
if (nextId.getIdPart() != null && nextId.getIdPart().startsWith("cid:")) {
ourLog.debug("Resource in transaction has ID[{}], will replace with server assigned ID", nextId.getIdPart());
} else if (nextResouceOperationIn == BundleEntryTransactionMethodEnum.POST) {
if (nextId.isEmpty() == false) {
@ -282,7 +282,7 @@ public class FhirSystemDaoDstu1 extends BaseHapiFhirSystemDao<List<IResource>, M
}
private static boolean isPlaceholder(IdDt theId) {
if ("cid:".equals(theId.getBaseUrl())) {
if (theId.getIdPart() != null && theId.getIdPart().startsWith("cid:")) {
return true;
}
return false;

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -40,7 +40,6 @@ import java.util.Set;
import javax.persistence.TypedQuery;
import org.apache.http.NameValuePair;
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.springframework.beans.factory.annotation.Autowired;
@ -634,8 +633,10 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle, MetaDt> {
}
private static boolean isPlaceholder(IdDt theId) {
if ("urn:oid:".equals(theId.getBaseUrl()) || "urn:uuid:".equals(theId.getBaseUrl())) {
return true;
if (theId.getValue() != null) {
if (theId.getValue().startsWith("urn:oid:") || theId.getValue().startsWith("urn:uuid:")) {
return true;
}
}
return false;
}

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -16,7 +16,7 @@ import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum.ResourceMetadataKeySupporti
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.util.List;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletRequest;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletRequest;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.util.List;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.util.List;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import static org.apache.commons.lang3.StringUtils.defaultString;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.util.List;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -8,7 +8,7 @@ import javax.persistence.TemporalType;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.util.Collection;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.data;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -7,7 +7,7 @@ import java.util.Date;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.data;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -9,7 +9,7 @@ import org.springframework.data.domain.Pageable;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.data;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.data;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.data;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -6,7 +6,7 @@ import java.util.List;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -9,7 +9,7 @@ import org.springframework.data.domain.Pageable;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.data;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -7,7 +7,7 @@ import org.hl7.fhir.dstu3.model.Bundle.BundleType;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -119,21 +119,12 @@ public class FhirResourceDaoCodeSystemDstu3 extends FhirResourceDaoDstu3<CodeSys
system = theSystem.getValue();
}
// CodeValidationResult validateOutcome = myJpaValidationSupport.validateCode(getContext(), system, code, null);
//
// LookupCodeResult result = new LookupCodeResult();
// result.setSearchedForCode(code);
// result.setSearchedForSystem(system);
// result.setFound(false);
// if (validateOutcome.isOk()) {
// result.setFound(true);
// result.setCodeIsAbstract(validateOutcome.asConceptDefinition().getAbstract());
// result.setCodeDisplay(validateOutcome.asConceptDefinition().getDisplay());
// }
// return result;
ourLog.info("Looking up {} / {}", system, code);
if (myValidationSupport.isCodeSystemSupported(getContext(), system)) {
ourLog.info("Code system {} is supported", system);
CodeValidationResult result = myValidationSupport.validateCode(getContext(), system, code, null);
if (result != null) {
if (result.isOk()) {

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2016 University Health Network
* Copyright (C) 2014 - 2017 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

Some files were not shown because too many files have changed in this diff Show More