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; 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>(); TreeSet<Integer> orders = new TreeSet<Integer>();
orders.addAll(orderToElementDef.keySet()); orders.addAll(orderToElementDef.keySet());
orders.addAll(orderToExtensionDef.keySet()); orders.addAll(orderToExtensionDef.keySet());
@ -372,7 +360,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
def = new RuntimeChildDirectResource(nextField, childAnnotation, descriptionAnnotation, elementName); def = new RuntimeChildDirectResource(nextField, childAnnotation, descriptionAnnotation, elementName);
} else { } else {
childIsChoiceType |= choiceTypes.size() > 1; 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); def = new RuntimeChildChoiceDefinition(nextField, elementName, childAnnotation, descriptionAnnotation, choiceTypes);
} else if (extensionAttr != null) { } else if (extensionAttr != null) {
/* /*

View File

@ -38,6 +38,9 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
private String myReferenceSuffix; private String myReferenceSuffix;
private List<Class<? extends IBaseResource>> myResourceTypes; private List<Class<? extends IBaseResource>> myResourceTypes;
/**
* Constructor
*/
public RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, List<Class<? extends IBase>> theChoiceTypes) { public RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, List<Class<? extends IBase>> theChoiceTypes) {
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName); 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 * For extension, if myChoiceTypes will be set some other way
*/ */
RuntimeChildChoiceDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation) { 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)) { if (IBaseResource.class.isAssignableFrom(next) || IBaseReference.class.isAssignableFrom(next)) {
next = theContext.getVersion().getResourceReferenceType(); next = theContext.getVersion().getResourceReferenceType();
elementName = getElementName() + myReferenceSuffix; elementName = getElementName() + myReferenceSuffix;
myNameToChildDefinition.put(elementName, nextDef);
} }
myDatatypeToElementDefinition.put(next, 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 not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * 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 static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.hl7.fhir.instance.model.api.IBase; 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.Child;
import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Extension; 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 boolean myDefinedLocally;
private String myExtensionUrl; private String myExtensionUrl;
private boolean myModifier; private boolean myModifier;
private Map<String, RuntimeChildDeclaredExtensionDefinition> myUrlToChildExtension; private Map<String, RuntimeChildDeclaredExtensionDefinition> myUrlToChildExtension;
private volatile Object myInstanceConstructorArguments; private volatile Object myInstanceConstructorArguments;
private Class<?> myEnumerationType; private Class<?> myEnumerationType;
private Class<? extends IBase> myChildType;
private RuntimeResourceBlockDefinition myChildResourceBlock;
private BaseRuntimeElementDefinition<?> myChildDef;
/** /**
* @param theBoundTypeBinder * @param theBoundTypeBinder
* If the child is of a type that requires a constructor argument to instantiate, this is the argument to * If the child is of a type that requires a constructor argument to instantiate, this is the argument to
* use * use
* @param theDefinedLocally * @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 { throws ConfigurationException {
super(theField, theChild, theDescriptionAnnotation, theElementName); super(theField, theElementName, theChild, theDescriptionAnnotation);
assert isNotBlank(theExtensionUrl); assert isNotBlank(theExtensionUrl);
myExtensionUrl = theExtensionUrl; myExtensionUrl = theExtensionUrl;
myChildType = theChildType; myChildType = theChildType;
myDefinedLocally = theExtension.definedLocally(); myDefinedLocally = theExtension.definedLocally();
myModifier = theExtension.isModifier(); myModifier = theExtension.isModifier();
myInstanceConstructorArguments = theBoundTypeBinder; 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 @Override
@ -82,58 +99,66 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
} }
@Override @Override
public BaseRuntimeElementDefinition<?> getChildByName(String theName) { public String getChildNameByDatatype(Class<? extends IBase> theDatatype) {
if (myDatatypeChildName != null) {
if (myDatatypeChildName.equals(theName)) { String retVal = super.getChildNameByDatatype(theDatatype);
return myChildDef;
} else { if (retVal != null) {
return 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 @Override
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theType) { public BaseRuntimeElementDefinition<?> getChildByName(String theName) {
if (myChildType.equals(theType)) { String name = theName;
return myChildDef; 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) { public RuntimeChildDeclaredExtensionDefinition getChildExtensionForUrl(String theUrl) {
return myUrlToChildExtension.get(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 @Override
public String getExtensionUrl() { public String getExtensionUrl() {
return myExtensionUrl; return myExtensionUrl;
} }
@Override
public BaseRuntimeElementDefinition<?> getSingleChildOrThrow() {
return myChildDef;
}
@Override
public Set<String> getValidChildNames() {
return Collections.emptySet();
}
public boolean isDefinedLocally() { public boolean isDefinedLocally() {
return myDefinedLocally; return myDefinedLocally;
} }
@ -143,50 +168,52 @@ public class RuntimeChildDeclaredExtensionDefinition extends BaseRuntimeDeclared
return myModifier; 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 @Override
void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) { void sealAndInitialize(FhirContext theContext, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
myUrlToChildExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>(); myUrlToChildExtension = new HashMap<String, RuntimeChildDeclaredExtensionDefinition>();
BaseRuntimeElementDefinition<?> elementDef = theClassToElementDefinitions.get(myChildType); 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 * built-in types, e.g. custom structures or custom extensions
*/ */
if (elementDef == null) { if (elementDef == null) {
elementDef = theContext.getElementDefinition(myChildType); if (Modifier.isAbstract(myChildType.getModifiers()) == false) {
} 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;
} }
} 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); RuntimeResourceBlockDefinition extDef = ((RuntimeResourceBlockDefinition) elementDef);
for (RuntimeChildDeclaredExtensionDefinition next : extDef.getExtensions()) { for (RuntimeChildDeclaredExtensionDefinition next : extDef.getExtensions()) {
myUrlToChildExtension.put(next.getExtensionUrl(), next); myUrlToChildExtension.put(next.getExtensionUrl(), next);
} }
myChildDef = extDef; myChildResourceBlock = (RuntimeResourceBlockDefinition) elementDef;
} }
myUrlToChildExtension = Collections.unmodifiableMap(myUrlToChildExtension); 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; package ca.uhn.fhir.model.primitive;
import static org.apache.commons.lang3.StringUtils.defaultString;
/* /*
* #%L * #%L
* HAPI FHIR - Core Library * 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 not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * 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} * regex: [a-z-Z0-9\-\.]{1,36}
* </p> * </p>
*/ */
@DatatypeDef(name = "id", profileOf=StringDt.class) @DatatypeDef(name = "id", profileOf = StringDt.class)
public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType { public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
private String myBaseUrl; private String myBaseUrl;
@ -106,9 +107,9 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor * Constructor
* *
* @param theResourceType * @param theResourceType
* The resource type (e.g. "Patient") * The resource type (e.g. "Patient")
* @param theIdPart * @param theIdPart
* The ID (e.g. "123") * The ID (e.g. "123")
*/ */
public IdDt(String theResourceType, BigDecimal theIdPart) { public IdDt(String theResourceType, BigDecimal theIdPart) {
this(theResourceType, toPlainStringWithNpeThrowIfNeeded(theIdPart)); this(theResourceType, toPlainStringWithNpeThrowIfNeeded(theIdPart));
@ -118,9 +119,9 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor * Constructor
* *
* @param theResourceType * @param theResourceType
* The resource type (e.g. "Patient") * The resource type (e.g. "Patient")
* @param theIdPart * @param theIdPart
* The ID (e.g. "123") * The ID (e.g. "123")
*/ */
public IdDt(String theResourceType, Long theIdPart) { public IdDt(String theResourceType, Long theIdPart) {
this(theResourceType, toPlainStringWithNpeThrowIfNeeded(theIdPart)); this(theResourceType, toPlainStringWithNpeThrowIfNeeded(theIdPart));
@ -130,9 +131,9 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor * Constructor
* *
* @param theResourceType * @param theResourceType
* The resource type (e.g. "Patient") * The resource type (e.g. "Patient")
* @param theId * @param theId
* The ID (e.g. "123") * The ID (e.g. "123")
*/ */
public IdDt(String theResourceType, String theId) { public IdDt(String theResourceType, String theId) {
this(theResourceType, theId, null); this(theResourceType, theId, null);
@ -142,11 +143,11 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor * Constructor
* *
* @param theResourceType * @param theResourceType
* The resource type (e.g. "Patient") * The resource type (e.g. "Patient")
* @param theId * @param theId
* The ID (e.g. "123") * The ID (e.g. "123")
* @param theVersionId * @param theVersionId
* The version ID ("e.g. "456") * The version ID ("e.g. "456")
*/ */
public IdDt(String theResourceType, String theId, String theVersionId) { public IdDt(String theResourceType, String theId, String theVersionId) {
this(null, theResourceType, theId, theVersionId); this(null, theResourceType, theId, theVersionId);
@ -156,13 +157,13 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
* Constructor * Constructor
* *
* @param theBaseUrl * @param theBaseUrl
* The server base URL (e.g. "http://example.com/fhir") * The server base URL (e.g. "http://example.com/fhir")
* @param theResourceType * @param theResourceType
* The resource type (e.g. "Patient") * The resource type (e.g. "Patient")
* @param theId * @param theId
* The ID (e.g. "123") * The ID (e.g. "123")
* @param theVersionId * @param theVersionId
* The version ID ("e.g. "456") * The version ID ("e.g. "456")
*/ */
public IdDt(String theBaseUrl, String theResourceType, String theId, String theVersionId) { public IdDt(String theBaseUrl, String theResourceType, String theId, String theVersionId) {
myBaseUrl = theBaseUrl; myBaseUrl = theBaseUrl;
@ -202,34 +203,6 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
return getIdPartAsBigDecimal(); 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 @Override
public boolean equals(Object theArg0) { public boolean equals(Object theArg0) {
if (!(theArg0 instanceof IdDt)) { 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 * Returns the unqualified portion of this ID as a big decimal, or <code>null</code> if the value is null
* *
* @throws NumberFormatException * @throws NumberFormatException
* If the value is not a valid BigDecimal * If the value is not a valid BigDecimal
*/ */
public BigDecimal getIdPartAsBigDecimal() { public BigDecimal getIdPartAsBigDecimal() {
String val = getIdPart(); 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 * Returns the unqualified portion of this ID as a {@link Long}, or <code>null</code> if the value is null
* *
* @throws NumberFormatException * @throws NumberFormatException
* If the value is not a valid Long * If the value is not a valid Long
*/ */
@Override @Override
public Long getIdPartAsLong() { public Long getIdPartAsLong() {
@ -315,11 +288,11 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
@Override @Override
public String getValue() { public String getValue() {
if (super.getValue() == null && myHaveComponentParts) { if (super.getValue() == null && myHaveComponentParts) {
if (determineLocalPrefix(myBaseUrl) != null && myResourceType == null && myUnqualifiedVersionId == null) { if (isLocal() || isUrn()) {
return myBaseUrl + myUnqualifiedId; return myUnqualifiedId;
} }
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
if (isNotBlank(myBaseUrl)) { if (isNotBlank(myBaseUrl)) {
b.append(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 @Override
public boolean isLocal() { public boolean isLocal() {
return "#".equals(myBaseUrl); return defaultString(myUnqualifiedId).startsWith("#");
}
private boolean isUrn() {
return defaultString(myUnqualifiedId).startsWith("urn:");
} }
@Override @Override
public boolean isVersionIdPartValidLong() { public boolean isVersionIdPartValidLong() {
return isValidLong(getVersionIdPart()); 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. * 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()); 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 * Set the value
* *
@ -484,9 +483,7 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
// TODO: add validation // TODO: add validation
super.setValue(theValue); super.setValue(theValue);
myHaveComponentParts = false; myHaveComponentParts = false;
String localPrefix = determineLocalPrefix(theValue);
if (StringUtils.isBlank(theValue)) { if (StringUtils.isBlank(theValue)) {
myBaseUrl = null; myBaseUrl = null;
super.setValue(null); super.setValue(null);
@ -495,14 +492,14 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
myResourceType = null; myResourceType = null;
} else if (theValue.charAt(0) == '#' && theValue.length() > 1) { } else if (theValue.charAt(0) == '#' && theValue.length() > 1) {
super.setValue(theValue); super.setValue(theValue);
myBaseUrl = "#"; myBaseUrl = null;
myUnqualifiedId = theValue.substring(1); myUnqualifiedId = theValue;
myUnqualifiedVersionId = null; myUnqualifiedVersionId = null;
myResourceType = null; myResourceType = null;
myHaveComponentParts = true; myHaveComponentParts = true;
} else if (localPrefix != null) { } else if (theValue.startsWith("urn:")) {
myBaseUrl = localPrefix; myBaseUrl = null;
myUnqualifiedId = theValue.substring(localPrefix.length()); myUnqualifiedId = theValue;
myUnqualifiedVersionId = null; myUnqualifiedVersionId = null;
myResourceType = null; myResourceType = null;
myHaveComponentParts = true; myHaveComponentParts = true;
@ -567,24 +564,33 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
*/ */
@Override @Override
public IdDt toUnqualified() { public IdDt toUnqualified() {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(getResourceType(), getIdPart(), getVersionIdPart()); return new IdDt(getResourceType(), getIdPart(), getVersionIdPart());
} }
@Override @Override
public IdDt toUnqualifiedVersionless() { public IdDt toUnqualifiedVersionless() {
if (isLocal()) { if (isLocal() || isUrn()) {
return toVersionless(); return new IdDt(getValueAsString());
} }
return new IdDt(getResourceType(), getIdPart()); return new IdDt(getResourceType(), getIdPart());
} }
@Override @Override
public IdDt toVersionless() { public IdDt toVersionless() {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(getBaseUrl(), getResourceType(), getIdPart(), null); return new IdDt(getBaseUrl(), getResourceType(), getIdPart(), null);
} }
@Override @Override
public IdDt withResourceType(String theResourceName) { public IdDt withResourceType(String theResourceName) {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(theResourceName, getIdPart(), getVersionIdPart()); 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. * 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 * @param theServerBase
* The server base (e.g. "http://example.com/fhir") * The server base (e.g. "http://example.com/fhir")
* @param theResourceType * @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") * @return A fully qualified URL for this ID (e.g. "http://example.com/fhir/Patient/1")
*/ */
@Override @Override
public IdDt withServerBase(String theServerBase, String theResourceType) { public IdDt withServerBase(String theServerBase, String theResourceType) {
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
return new IdDt(theServerBase, theResourceType, getIdPart(), getVersionIdPart()); 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. * 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 * @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. * @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) { public IdDt withVersion(String theVersion) {
Validate.notBlank(theVersion, "Version may not be null or empty"); Validate.notBlank(theVersion, "Version may not be null or empty");
if (isLocal() || isUrn()) {
return new IdDt(getValueAsString());
}
String existingValue = getValue(); String existingValue = getValue();
int i = existingValue.indexOf(Constants.PARAM_HISTORY); int i = existingValue.indexOf(Constants.PARAM_HISTORY);
@ -678,25 +692,4 @@ public class IdDt extends UriDt implements IPrimitiveDatatype<String>, IIdType {
return theIdPart.toString(); 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()) { for (BundleEntry nextEntry : theBundle.getEntries()) {
theEventWriter.beginObject(); 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()); writeOptionalTagWithTextNode(theEventWriter, "fullUrl", nextEntry.getResource().getId().getValue());
} }

View File

@ -721,7 +721,6 @@ class ParserState<T> {
myInstance = theInstance; myInstance = theInstance;
} }
@SuppressWarnings("unchecked")
@Override @Override
public void wereBack() { public void wereBack() {
@ -2090,17 +2089,32 @@ class ParserState<T> {
final boolean bundle = "Bundle".equals(myContext.getResourceDefinition(myInstance).getName()); final boolean bundle = "Bundle".equals(myContext.getResourceDefinition(myInstance).getName());
if (bundle) { 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 * Stitch together resource references
*/ */
Map<IIdType, IBaseResource> idToResource = new HashMap<IIdType, IBaseResource>();
FhirTerser t = myContext.newTerser();
List<IBaseResource> resources = t.getAllPopulatedChildElementsOfType(myInstance, IBaseResource.class); List<IBaseResource> resources = t.getAllPopulatedChildElementsOfType(myInstance, IBaseResource.class);
for (IBaseResource next : resources) { for (IBaseResource next : resources) {
IIdType id = next.getIdElement(); IIdType id = next.getIdElement();
if (id != null && id.isEmpty() == false) { if (id != null && id.isEmpty() == false) {
String resName = myContext.getResourceDefinition(next).getName(); 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); List<IBaseReference> refs = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IBaseReference.class);
for (IBaseReference nextRef : refs) { for (IBaseReference nextRef : refs) {
if (nextRef.isEmpty() == false && nextRef.getReferenceElement() != null) { 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) { if (target != null) {
nextRef.setResource(target); nextRef.setResource(target);
} }

View File

@ -446,7 +446,7 @@ public class XmlParser extends BaseParser implements IParser {
writeBundleResourceLink(theEventWriter, "alternate", nextEntry.getLinkAlternate()); 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()); 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.BaseServerResponseException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.NotModifiedException; 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.ExceptionHandlingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
@ -253,7 +254,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
} else { } else {
resourceBinding = myResourceNameToBinding.get(resourceName); resourceBinding = myResourceNameToBinding.get(resourceName);
if (resourceBinding == null) { 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; 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 { 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 not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * 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 = "_raw";
public static final String PARAM_RAW_TRUE = "true"; public static final String PARAM_RAW_TRUE = "true";
public static final String PARAM_TRUE = "true"; public static final String PARAM_TRUE = "true";
private String format(String theResultBody, EncodingEnum theEncodingEnum) { private String format(String theResultBody, EncodingEnum theEncodingEnum) {
String str = StringEscapeUtils.escapeHtml4(theResultBody); String str = StringEscapeUtils.escapeHtml4(theResultBody);
if (str == null || theEncodingEnum == null) { if (str == null || theEncodingEnum == null) {
@ -181,7 +182,8 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
} }
@Override @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... * It's not a browser...
*/ */
@ -209,13 +211,14 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse); return super.handleException(theRequestDetails, theException, theServletRequest, theServletResponse);
} }
streamResponse(theRequestDetails, theServletResponse, theException.getOperationOutcome(), theServletRequest); streamResponse(theRequestDetails, theServletResponse, theException.getOperationOutcome(), theServletRequest, theException.getStatusCode());
return false; return false;
} }
@Override @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 * 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"); 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); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
} }
boolean force = false; boolean force = false;
String[] formatParams = theRequestDetails.getParameters().get(Constants.PARAM_FORMAT); String[] formatParams = theRequestDetails.getParameters().get(Constants.PARAM_FORMAT);
if (formatParams != null && formatParams.length > 0) { if (formatParams != null && formatParams.length > 0) {
@ -242,7 +245,7 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
} }
} }
/* /*
* It's not a browser... * It's not a browser...
*/ */
@ -263,7 +266,6 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
if (!force && isNotBlank(theServletRequest.getHeader(Constants.HEADER_ORIGIN))) { if (!force && isNotBlank(theServletRequest.getHeader(Constants.HEADER_ORIGIN))) {
return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
} }
/* /*
* Not a GET * Not a GET
@ -279,12 +281,12 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse); return super.outgoingResponse(theRequestDetails, theResponseObject, theServletRequest, theServletResponse);
} }
streamResponse(theRequestDetails, theServletResponse, theResponseObject, theServletRequest); streamResponse(theRequestDetails, theServletResponse, theResponseObject, theServletRequest, 200);
return false; 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; IParser p;
Map<String, String[]> parameters = theRequestDetails.getParameters(); Map<String, String[]> parameters = theRequestDetails.getParameters();
if (parameters.containsKey(Constants.PARAM_FORMAT)) { if (parameters.containsKey(Constants.PARAM_FORMAT)) {
@ -307,110 +309,112 @@ public class ResponseHighlighterInterceptor extends InterceptorAdapter {
if (prettyPrintResponse) { if (prettyPrintResponse) {
p.setPrettyPrint(prettyPrintResponse); p.setPrettyPrint(prettyPrintResponse);
} }
EncodingEnum encoding = p.getEncoding(); EncodingEnum encoding = p.getEncoding();
String encoded = p.encodeResourceToString(resource); String encoded = p.encodeResourceToString(resource);
theServletResponse.setContentType(Constants.CT_HTML_WITH_UTF8); try {
StringBuilder b = new StringBuilder(); if (theStatusCode > 299) {
b.append("<html lang=\"en\">\n"); theServletResponse.setStatus(theStatusCode);
b.append(" <head>\n"); }
b.append(" <meta charset=\"utf-8\" />\n"); theServletResponse.setContentType(Constants.CT_HTML_WITH_UTF8);
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 ");
b.append("<a href=\""); StringBuilder b = new StringBuilder();
b.append(createLinkHref(parameters, Constants.FORMAT_XML)); b.append("<html lang=\"en\">\n");
b.append("\">Raw XML</a>, "); 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("<p>");
b.append("This result is being rendered in HTML for easy viewing. ");
b.append("<a href=\""); b.append("You may access this content as ");
b.append(createLinkHref(parameters, Constants.FORMATS_HTML_JSON));
b.append("\">HTML JSON</a> ");
b.append("or "); b.append("<a href=\"");
b.append("<a href=\""); b.append(createLinkHref(parameters, Constants.FORMAT_JSON));
b.append(createLinkHref(parameters, Constants.FORMATS_HTML_XML)); b.append("\">Raw JSON</a> or ");
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("</p>"); b.append(createLinkHref(parameters, Constants.FORMAT_XML));
b.append("\">Raw XML</a>, ");
b.append("\n");
b.append(" or view this content in ");
// if (isEncodeHeaders()) {
// b.append("<h1>Request Headers</h1>"); b.append("<a href=\"");
// b.append("<div class=\"headersDiv\">"); b.append(createLinkHref(parameters, Constants.FORMATS_HTML_JSON));
// for (int next : theRequestDetails.get) b.append("\">HTML JSON</a> ");
// b.append("</div>");
// b.append("<h1>Response Headers</h1>"); b.append("or ");
// b.append("<div class=\"headersDiv\">"); b.append("<a href=\"");
// b.append("</div>"); b.append(createLinkHref(parameters, Constants.FORMATS_HTML_XML));
// b.append("<h1>Response Body</h1>"); b.append("\">HTML XML</a>.");
// }
b.append("<pre>"); Date startTime = (Date) theServletRequest.getAttribute(RestfulServer.REQUEST_START_TIME);
b.append(format(encoded, encoding)); if (startTime != null) {
b.append("</pre>"); long time = System.currentTimeMillis() - startTime.getTime();
b.append(" </body>"); b.append(" Response generated in ");
b.append("</html>"); 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 //@formatter:off
String out = b.toString(); String out = b.toString();
//@formatter:on //@formatter:on
try {
theServletResponse.getWriter().append(out); theServletResponse.getWriter().append(out);
theServletResponse.getWriter().close(); theServletResponse.getWriter().close();
} catch (IOException e) { } 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(); 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); 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); 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); IIdType withVersion(String theVersion);
/** /**

View File

@ -15,7 +15,7 @@ import org.hl7.fhir.instance.model.api.IBaseBinary;
* #%L * #%L
* HAPI FHIR OkHttp Client * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR OkHttp Client * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR OkHttp Client * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR OkHttp Client * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR OkHttp Client * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JAX-RS Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; 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 javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -8,7 +8,7 @@ import org.hl7.fhir.dstu3.validation.IResourceValidator.BestPracticeWarningLevel
* #%L * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; 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 javax.annotation.PostConstruct;
import org.hl7.fhir.dstu3.model.Subscription; import org.hl7.fhir.dstu3.model.Subscription;

View File

@ -5,7 +5,7 @@ import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
* #%L * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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) { 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) { 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) { public String parseContentTextIntoWords(IBaseResource theResource) {
@ -1427,6 +1431,8 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
for (ResourceLink next : links) { for (ResourceLink next : links) {
myEntityManager.persist(next); myEntityManager.persist(next);
} }
// make sure links are indexed
theEntity.setResourceLinks(links);
theEntity.toString(); theEntity.toString();

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 long myExpireSearchResultsAfterMillis = DateUtils.MILLIS_PER_HOUR;
private int myHardSearchLimit = 1000;
private int myHardTagListLimit = 1000; private int myHardTagListLimit = 1000;
private int myIncludeLimit = 2000; private int myIncludeLimit = 2000;
@ -325,8 +323,17 @@ public class DaoConfig {
myExpireSearchResultsAfterMillis = theExpireSearchResultsAfterMillis; 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 = toEntity(nextResource);
entity.setUpdated(updateTime); entity.setUpdated(updateTime);
entity.setPublished(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()); ourLog.debug("Resource in transaction has ID[{}], will replace with server assigned ID", nextId.getIdPart());
} else if (nextResouceOperationIn == BundleEntryTransactionMethodEnum.POST) { } else if (nextResouceOperationIn == BundleEntryTransactionMethodEnum.POST) {
if (nextId.isEmpty() == false) { if (nextId.isEmpty() == false) {
@ -282,7 +282,7 @@ public class FhirSystemDaoDstu1 extends BaseHapiFhirSystemDao<List<IResource>, M
} }
private static boolean isPlaceholder(IdDt theId) { private static boolean isPlaceholder(IdDt theId) {
if ("cid:".equals(theId.getBaseUrl())) { if (theId.getIdPart() != null && theId.getIdPart().startsWith("cid:")) {
return true; return true;
} }
return false; return false;

View File

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

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao;
* #%L * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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(); system = theSystem.getValue();
} }
// CodeValidationResult validateOutcome = myJpaValidationSupport.validateCode(getContext(), system, code, null); ourLog.info("Looking up {} / {}", system, code);
//
// 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;
if (myValidationSupport.isCodeSystemSupported(getContext(), system)) { if (myValidationSupport.isCodeSystemSupported(getContext(), system)) {
ourLog.info("Code system {} is supported", system);
CodeValidationResult result = myValidationSupport.validateCode(getContext(), system, code, null); CodeValidationResult result = myValidationSupport.validateCode(getContext(), system, code, null);
if (result != null) { if (result != null) {
if (result.isOk()) { if (result.isOk()) {

View File

@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.dao.dstu3;
* #%L * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 * #%L
* HAPI FHIR JPA Server * 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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