Clean up ResourceMetadataKeyEnum (#4425)
* Clean up ResourceMetadataKeyEnum * Compile fix * Test fix * Test fix * Change * Test fixes
This commit is contained in:
parent
7a31860376
commit
d0a77f4322
|
@ -27,19 +27,13 @@ import ca.uhn.fhir.model.primitive.InstantDt;
|
|||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
/**
|
||||
* Keys in this map refer to <b>resource metadata keys</b>, which are keys used to access information about specific resource instances that live outside of the resource body. Typically, these are
|
||||
|
@ -65,23 +59,6 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|||
*/
|
||||
public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
||||
|
||||
// TODO: JA - Replace all of the various other get/put methods in subclasses with just using the two that are here
|
||||
public T get(IBaseResource theResource) {
|
||||
if (theResource instanceof IAnyResource) {
|
||||
return (T) theResource.getUserData(name());
|
||||
} else {
|
||||
return (T) ((IResource)theResource).getResourceMetadata().get(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void put(IBaseResource theResource, T theValue) {
|
||||
if (theResource instanceof IAnyResource) {
|
||||
theResource.setUserData(name(), theValue);
|
||||
} else {
|
||||
((IResource)theResource).getResourceMetadata().put(this, theValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If present and populated with a date/time (as an instance of {@link InstantDt}), this value is an indication that the resource is in the deleted state. This key is only used in a limited number
|
||||
* of scenarios, such as POSTing transaction bundles to a server, or returning resource history.
|
||||
|
@ -89,21 +66,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
* Values for this key are of type <b>{@link InstantDt}</b>
|
||||
* </p>
|
||||
*/
|
||||
public static final ResourceMetadataKeyEnum<IPrimitiveType<Date>> DELETED_AT = new ResourceMetadataKeyEnum<>("DELETED_AT") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public IPrimitiveType<Date> get(IResource theResource) {
|
||||
return (IPrimitiveType<Date>) theResource.getResourceMetadata().get(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, IPrimitiveType<Date> theObject) {
|
||||
theResource.getResourceMetadata().put(this, theObject);
|
||||
}
|
||||
|
||||
public static final ResourceMetadataKeyEnum<IPrimitiveType<Date>> DELETED_AT = new ResourceMetadataKeyEnum<>("DELETED_AT", IPrimitiveType.class) {
|
||||
};
|
||||
|
||||
/**
|
||||
* If present and populated with a {@link BundleEntrySearchModeEnum}, contains the "bundle entry search mode", which is the value of the status field in the Bundle entry containing this resource.
|
||||
* The value for this key corresponds to field <code>Bundle.entry.search.mode</code>. This value can be set to provide a status value of "include" for included resources being returned by a
|
||||
|
@ -115,28 +79,7 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
* Values for this key are of type <b>{@link BundleEntrySearchModeEnum}</b>
|
||||
* </p>
|
||||
*/
|
||||
public static final ResourceMetadataKeySupportingAnyResource<BundleEntrySearchModeEnum, String> ENTRY_SEARCH_MODE = new ResourceMetadataKeySupportingAnyResource<BundleEntrySearchModeEnum, String>("ENTRY_SEARCH_MODE") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public BundleEntrySearchModeEnum get(IResource theResource) {
|
||||
return getEnumFromMetadataOrNullIfNone(theResource.getResourceMetadata(), ENTRY_SEARCH_MODE, BundleEntrySearchModeEnum.class, BundleEntrySearchModeEnum.VALUESET_BINDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(IAnyResource theResource) {
|
||||
return (String) theResource.getUserData(ENTRY_SEARCH_MODE.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, BundleEntrySearchModeEnum theObject) {
|
||||
theResource.getResourceMetadata().put(ENTRY_SEARCH_MODE, theObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IAnyResource theResource, String theObject) {
|
||||
theResource.setUserData(ENTRY_SEARCH_MODE.name(), theObject);
|
||||
}
|
||||
public static final ResourceMetadataKeyEnum<BundleEntrySearchModeEnum> ENTRY_SEARCH_MODE = new ResourceMetadataKeyEnum<>("ENTRY_SEARCH_MODE", BundleEntrySearchModeEnum.class) {
|
||||
};
|
||||
/**
|
||||
* If present and populated with a {@link BundleEntryTransactionMethodEnum}, contains the "bundle entry transaction operation", which is the value of the status field in the Bundle entry
|
||||
|
@ -150,33 +93,8 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
* Values for this key are of type <b>{@link BundleEntryTransactionMethodEnum}</b>
|
||||
* </p>
|
||||
*/
|
||||
public static final ResourceMetadataKeySupportingAnyResource<BundleEntryTransactionMethodEnum, String> ENTRY_TRANSACTION_METHOD = new ResourceMetadataKeySupportingAnyResource<BundleEntryTransactionMethodEnum, String>(
|
||||
"ENTRY_TRANSACTION_OPERATION") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public BundleEntryTransactionMethodEnum get(IResource theResource) {
|
||||
return getEnumFromMetadataOrNullIfNone(theResource.getResourceMetadata(), ENTRY_TRANSACTION_METHOD, BundleEntryTransactionMethodEnum.class,
|
||||
BundleEntryTransactionMethodEnum.VALUESET_BINDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(IAnyResource theResource) {
|
||||
return (String) theResource.getUserData(ENTRY_TRANSACTION_METHOD.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, BundleEntryTransactionMethodEnum theObject) {
|
||||
theResource.getResourceMetadata().put(ENTRY_TRANSACTION_METHOD, theObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IAnyResource theResource, String theObject) {
|
||||
theResource.setUserData(ENTRY_TRANSACTION_METHOD.name(), theObject);
|
||||
}
|
||||
|
||||
public static final ResourceMetadataKeyEnum<BundleEntryTransactionMethodEnum> ENTRY_TRANSACTION_METHOD = new ResourceMetadataKeyEnum<>("ENTRY_TRANSACTION_OPERATION", BundleEntryTransactionMethodEnum.class) {
|
||||
};
|
||||
|
||||
/**
|
||||
* The value for this key represents a {@link List} of profile IDs that this resource claims to conform to.
|
||||
* <p>
|
||||
|
@ -184,18 +102,7 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
* Values for this key are of type <b>List<IdDt></b>. Note that the returned list is <i>unmodifiable</i>, so you need to create a new list and call <code>put</code> to change its value.
|
||||
* </p>
|
||||
*/
|
||||
public static final ResourceMetadataKeyEnum<List<IdDt>> PROFILES = new ResourceMetadataKeyEnum<List<IdDt>>("PROFILES") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public List<IdDt> get(IResource theResource) {
|
||||
return getIdListFromMetadataOrNullIfNone(theResource.getResourceMetadata(), PROFILES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, List<IdDt> theObject) {
|
||||
theResource.getResourceMetadata().put(PROFILES, theObject);
|
||||
}
|
||||
public static final ResourceMetadataKeyEnum<List<IdDt>> PROFILES = new ResourceMetadataKeyEnum<>("PROFILES", List.class) {
|
||||
};
|
||||
/**
|
||||
* The value for this key is the bundle entry <b>Published</b> time. This is defined by FHIR as "Time resource copied into the feed", which is generally best left to the current time.
|
||||
|
@ -208,37 +115,9 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
*
|
||||
* @see InstantDt
|
||||
*/
|
||||
public static final ResourceMetadataKeyEnum<InstantDt> PUBLISHED = new ResourceMetadataKeyEnum<InstantDt>("PUBLISHED") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public InstantDt get(IResource theResource) {
|
||||
return getInstantFromMetadataOrNullIfNone(theResource.getResourceMetadata(), PUBLISHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, InstantDt theObject) {
|
||||
theResource.getResourceMetadata().put(PUBLISHED, theObject);
|
||||
}
|
||||
public static final ResourceMetadataKeyEnum<InstantDt> PUBLISHED = new ResourceMetadataKeyEnum<>("PUBLISHED", InstantDt.class) {
|
||||
};
|
||||
public static final ResourceMetadataKeyEnum<List<BaseCodingDt>> SECURITY_LABELS = new ResourceMetadataKeyEnum<List<BaseCodingDt>>("SECURITY_LABELS") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public List<BaseCodingDt> get(IResource resource) {
|
||||
Object obj = resource.getResourceMetadata().get(SECURITY_LABELS);
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
//noinspection unchecked
|
||||
return (List<BaseCodingDt>) obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource iResource, List<BaseCodingDt> labels) {
|
||||
iResource.getResourceMetadata().put(SECURITY_LABELS, labels);
|
||||
}
|
||||
|
||||
public static final ResourceMetadataKeyEnum<List<BaseCodingDt>> SECURITY_LABELS = new ResourceMetadataKeyEnum<>("SECURITY_LABELS", List.class) {
|
||||
};
|
||||
/**
|
||||
* The value for this key is the list of tags associated with this resource
|
||||
|
@ -248,23 +127,7 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
*
|
||||
* @see TagList
|
||||
*/
|
||||
public static final ResourceMetadataKeyEnum<TagList> TAG_LIST = new ResourceMetadataKeyEnum<TagList>("TAG_LIST") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public TagList get(IResource theResource) {
|
||||
Object retValObj = theResource.getResourceMetadata().get(TAG_LIST);
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
} else {
|
||||
return (TagList) retValObj;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, TagList theObject) {
|
||||
theResource.getResourceMetadata().put(TAG_LIST, theObject);
|
||||
}
|
||||
public static final ResourceMetadataKeyEnum<TagList> TAG_LIST = new ResourceMetadataKeyEnum<>("TAG_LIST", TagList.class) {
|
||||
};
|
||||
/**
|
||||
* The value for this key is the bundle entry <b>Updated</b> time. This is defined by FHIR as "Last Updated for resource". This value is also used for populating the "Last-Modified" header in the
|
||||
|
@ -275,18 +138,7 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
*
|
||||
* @see InstantDt
|
||||
*/
|
||||
public static final ResourceMetadataKeyEnum<InstantDt> UPDATED = new ResourceMetadataKeyEnum<InstantDt>("UPDATED") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public InstantDt get(IResource theResource) {
|
||||
return getInstantFromMetadataOrNullIfNone(theResource.getResourceMetadata(), UPDATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, InstantDt theObject) {
|
||||
theResource.getResourceMetadata().put(UPDATED, theObject);
|
||||
}
|
||||
public static final ResourceMetadataKeyEnum<InstantDt> UPDATED = new ResourceMetadataKeyEnum<>("UPDATED", InstantDt.class) {
|
||||
};
|
||||
/**
|
||||
* The value for this key is the version ID of the resource object.
|
||||
|
@ -297,18 +149,7 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
* @deprecated The {@link IResource#getId()} resource ID will now be populated with the version ID via the {@link IdDt#getVersionIdPart()} method
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ResourceMetadataKeyEnum<String> VERSION = new ResourceMetadataKeyEnum<String>("VERSION") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String get(IResource theResource) {
|
||||
return getStringFromMetadataOrNullIfNone(theResource.getResourceMetadata(), VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, String theObject) {
|
||||
theResource.getResourceMetadata().put(VERSION, theObject);
|
||||
}
|
||||
public static final ResourceMetadataKeyEnum<String> VERSION = new ResourceMetadataKeyEnum<>("VERSION", String.class) {
|
||||
};
|
||||
/**
|
||||
* The value for this key is the version ID of the resource object.
|
||||
|
@ -319,24 +160,48 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
* @deprecated The {@link IResource#getId()} resource ID will now be populated with the version ID via the {@link IdDt#getVersionIdPart()} method
|
||||
*/
|
||||
@Deprecated
|
||||
public static final ResourceMetadataKeyEnum<IdDt> VERSION_ID = new ResourceMetadataKeyEnum<IdDt>("VERSION_ID") {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public IdDt get(IResource theResource) {
|
||||
return getIdFromMetadataOrNullIfNone(theResource.getResourceMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, IdDt theObject) {
|
||||
theResource.getResourceMetadata().put(VERSION_ID, theObject);
|
||||
}
|
||||
public static final ResourceMetadataKeyEnum<IdDt> VERSION_ID = new ResourceMetadataKeyEnum<>("VERSION_ID", IdDt.class) {
|
||||
};
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final String myValue;
|
||||
private final Class<?> myType;
|
||||
|
||||
public ResourceMetadataKeyEnum(String theValue) {
|
||||
public ResourceMetadataKeyEnum(String theValue, Class<?> theType) {
|
||||
myValue = theValue;
|
||||
myType = theType;
|
||||
}
|
||||
|
||||
// TODO: JA - Replace all of the various other get/put methods in subclasses with just using the two that are here
|
||||
public T get(IBaseResource theResource) {
|
||||
Object retVal;
|
||||
if (theResource instanceof IAnyResource) {
|
||||
retVal = theResource.getUserData(name());
|
||||
} else {
|
||||
retVal = ((IResource) theResource).getResourceMetadata().get(this);
|
||||
}
|
||||
|
||||
if (retVal != null && !myType.isAssignableFrom(retVal.getClass())) {
|
||||
throw new InternalErrorException(Msg.code(1890) + "Found an object of type '" + retVal.getClass().getCanonicalName()
|
||||
+ "' in resource metadata for key " + this.name() + " - Expected "
|
||||
+ myType.getCanonicalName());
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
return (T) retVal;
|
||||
}
|
||||
|
||||
public void put(IBaseResource theResource, T theValue) {
|
||||
if (theValue != null && !myType.isAssignableFrom(theValue.getClass())) {
|
||||
throw new InternalErrorException(Msg.code(1891) + "Can not put object of type '" + theValue.getClass().getCanonicalName()
|
||||
+ "' in resource metadata for key " + this.name() + " - Expected "
|
||||
+ myType.getCanonicalName());
|
||||
}
|
||||
|
||||
if (theResource instanceof IAnyResource) {
|
||||
theResource.setUserData(name(), theValue);
|
||||
} else {
|
||||
((IResource) theResource).getResourceMetadata().put(this, theValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -349,15 +214,10 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
return false;
|
||||
ResourceMetadataKeyEnum<?> other = (ResourceMetadataKeyEnum<?>) obj;
|
||||
if (myValue == null) {
|
||||
if (other.myValue != null)
|
||||
return false;
|
||||
} else if (!myValue.equals(other.myValue))
|
||||
return false;
|
||||
return true;
|
||||
return other.myValue == null;
|
||||
} else return myValue.equals(other.myValue);
|
||||
}
|
||||
|
||||
public abstract T get(IResource theResource);
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
@ -370,138 +230,9 @@ public abstract class ResourceMetadataKeyEnum<T> implements Serializable {
|
|||
return myValue;
|
||||
}
|
||||
|
||||
public abstract void put(IResource theResource, T theObject);
|
||||
|
||||
public static abstract class ResourceMetadataKeySupportingAnyResource<T, T2> extends ResourceMetadataKeyEnum<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ResourceMetadataKeySupportingAnyResource(String theValue) {
|
||||
super(theValue);
|
||||
}
|
||||
|
||||
public abstract T2 get(IAnyResource theResource);
|
||||
|
||||
public abstract void put(IAnyResource theResource, T2 theObject);
|
||||
|
||||
}
|
||||
|
||||
public static final class ExtensionResourceMetadataKey extends ResourceMetadataKeyEnum<ExtensionDt> {
|
||||
public ExtensionResourceMetadataKey(String theUrl) {
|
||||
super(theUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExtensionDt get(IResource theResource) {
|
||||
Object retValObj = theResource.getResourceMetadata().get(this);
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
} else if (retValObj instanceof ExtensionDt) {
|
||||
return (ExtensionDt) retValObj;
|
||||
}
|
||||
throw new InternalErrorException(Msg.code(1890) + "Found an object of type '" + retValObj.getClass().getCanonicalName()
|
||||
+ "' in resource metadata for key " + this.name() + " - Expected "
|
||||
+ ExtensionDt.class.getCanonicalName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, ExtensionDt theObject) {
|
||||
theResource.getResourceMetadata().put(this, theObject);
|
||||
super(theUrl, ExtensionDt.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends Enum<?>> T getEnumFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<T> theKey, Class<T> theEnumType,
|
||||
IValueSetEnumBinder<T> theBinder) {
|
||||
Object retValObj = theResourceMetadata.get(theKey);
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
} else if (theEnumType.equals(retValObj.getClass())) {
|
||||
return (T) retValObj;
|
||||
} else if (retValObj instanceof String) {
|
||||
return theBinder.fromCodeString((String) retValObj);
|
||||
}
|
||||
throw new InternalErrorException(Msg.code(1891) + "Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected "
|
||||
+ InstantDt.class.getCanonicalName());
|
||||
}
|
||||
|
||||
private static IdDt getIdFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata) {
|
||||
return toId(ResourceMetadataKeyEnum.VERSION_ID, theResourceMetadata.get(ResourceMetadataKeyEnum.VERSION_ID));
|
||||
}
|
||||
|
||||
private static List<IdDt> getIdListFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<?> theKey) {
|
||||
Object retValObj = theResourceMetadata.get(theKey);
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
} else if (retValObj instanceof List) {
|
||||
List<?> retValList = (List<?>) retValObj;
|
||||
for (Object next : retValList) {
|
||||
if (!(next instanceof IdDt)) {
|
||||
List<IdDt> retVal = new ArrayList<IdDt>();
|
||||
for (Object nextVal : retValList) {
|
||||
retVal.add(toId(theKey, nextVal));
|
||||
}
|
||||
return Collections.unmodifiableList(retVal);
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
List<IdDt> retVal = (List<IdDt>) retValList;
|
||||
return Collections.unmodifiableList(retVal);
|
||||
} else {
|
||||
return Collections.singletonList(toId(theKey, retValObj));
|
||||
}
|
||||
}
|
||||
|
||||
private static InstantDt getInstantFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<InstantDt> theKey) {
|
||||
Object retValObj = theResourceMetadata.get(theKey);
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
} else if (retValObj instanceof Date) {
|
||||
return new InstantDt((Date) retValObj);
|
||||
} else if (retValObj instanceof InstantDt) {
|
||||
if (((InstantDt) retValObj).isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return (InstantDt) retValObj;
|
||||
}
|
||||
throw new InternalErrorException(Msg.code(1892) + "Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected "
|
||||
+ InstantDt.class.getCanonicalName());
|
||||
}
|
||||
|
||||
private static String getStringFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<String> theKey) {
|
||||
Object retValObj = theResourceMetadata.get(theKey);
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
} else if (retValObj instanceof String) {
|
||||
if (StringUtils.isBlank(((String) retValObj))) {
|
||||
return null;
|
||||
}
|
||||
return (String) retValObj;
|
||||
}
|
||||
throw new InternalErrorException(Msg.code(1893) + "Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected "
|
||||
+ String.class.getCanonicalName());
|
||||
}
|
||||
|
||||
private static IdDt toId(ResourceMetadataKeyEnum<?> theKey, Object retValObj) {
|
||||
if (retValObj == null) {
|
||||
return null;
|
||||
} else if (retValObj instanceof String) {
|
||||
if (isNotBlank((String) retValObj)) {
|
||||
return new IdDt((String) retValObj);
|
||||
}
|
||||
return null;
|
||||
} else if (retValObj instanceof IdDt) {
|
||||
if (((IdDt) retValObj).isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return (IdDt) retValObj;
|
||||
} else if (retValObj instanceof Number) {
|
||||
return new IdDt(retValObj.toString());
|
||||
}
|
||||
throw new InternalErrorException(Msg.code(1894) + "Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected "
|
||||
+ IdDt.class.getCanonicalName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2206,28 +2206,15 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
Validate.notNull(theResources, "theResources must not be null");
|
||||
|
||||
for (IBaseResource next : theResources) {
|
||||
String entryMethod = null;
|
||||
if (next instanceof IResource) {
|
||||
BundleEntryTransactionMethodEnum entryMethodEnum = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IResource) next);
|
||||
if (entryMethodEnum != null) {
|
||||
entryMethod = entryMethodEnum.getCode();
|
||||
}
|
||||
} else {
|
||||
entryMethod = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) next);
|
||||
}
|
||||
BundleEntryTransactionMethodEnum entryMethod = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(next);
|
||||
|
||||
if (isBlank(entryMethod)) {
|
||||
if (entryMethod == null) {
|
||||
if (isBlank(next.getIdElement().getValue())) {
|
||||
entryMethod = "POST";
|
||||
entryMethod = BundleEntryTransactionMethodEnum.POST;
|
||||
} else {
|
||||
entryMethod = "PUT";
|
||||
entryMethod = BundleEntryTransactionMethodEnum.PUT;
|
||||
}
|
||||
if (next instanceof IResource) {
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put((IResource) next, BundleEntryTransactionMethodEnum.valueOf(entryMethod));
|
||||
} else {
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put((IAnyResource) next, entryMethod);
|
||||
}
|
||||
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(next, entryMethod);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2305,7 +2292,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
|
||||
OutcomeResponseHandler binding = new OutcomeResponseHandler(myPrefer);
|
||||
|
||||
Map<String, List<String>> params = new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> params = new HashMap<>();
|
||||
return invoke(params, binding, invocation);
|
||||
|
||||
}
|
||||
|
@ -2362,7 +2349,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
@Override
|
||||
public MethodOutcome execute() {
|
||||
BaseHttpClientInvocation invocation = ValidateMethodBindingDstu2Plus.createValidateInvocation(myContext, myResource);
|
||||
ResourceResponseHandler<BaseOperationOutcome> handler = new ResourceResponseHandler<BaseOperationOutcome>(null, null);
|
||||
ResourceResponseHandler<BaseOperationOutcome> handler = new ResourceResponseHandler<>(null, null);
|
||||
IBaseOperationOutcome outcome = invoke(null, handler, invocation);
|
||||
MethodOutcome retVal = new MethodOutcome();
|
||||
retVal.setOperationOutcome(outcome);
|
||||
|
@ -2486,7 +2473,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
|
||||
private static void addParam(Map<String, List<String>> params, String parameterName, String parameterValue) {
|
||||
if (!params.containsKey(parameterName)) {
|
||||
params.put(parameterName, new ArrayList<String>());
|
||||
params.put(parameterName, new ArrayList<>());
|
||||
}
|
||||
params.get(parameterName).add(parameterValue);
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser {
|
|||
retVal = (R) res;
|
||||
ResourceMetadataKeyEnum.DELETED_AT.put(res, new InstantDt(theEntity.getDeleted()));
|
||||
if (theForHistoryOperation) {
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, Bundle.HTTPVerb.DELETE.toCode());
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, BundleEntryTransactionMethodEnum.DELETE);
|
||||
}
|
||||
} else if (theForHistoryOperation) {
|
||||
/*
|
||||
|
@ -396,9 +396,9 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser {
|
|||
Date published = theEntity.getPublished().getValue();
|
||||
Date updated = theEntity.getUpdated().getValue();
|
||||
if (published.equals(updated)) {
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, Bundle.HTTPVerb.POST.toCode());
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, BundleEntryTransactionMethodEnum.POST);
|
||||
} else {
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, Bundle.HTTPVerb.PUT.toCode());
|
||||
ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, BundleEntryTransactionMethodEnum.PUT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,9 @@ import java.util.stream.Collectors;
|
|||
|
||||
public class PersistedJpaSearchFirstPageBundleProvider extends PersistedJpaBundleProvider {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(PersistedJpaSearchFirstPageBundleProvider.class);
|
||||
private SearchTask mySearchTask;
|
||||
private ISearchBuilder mySearchBuilder;
|
||||
private Search mySearch;
|
||||
private final SearchTask mySearchTask;
|
||||
private final ISearchBuilder mySearchBuilder;
|
||||
private final Search mySearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -105,10 +105,7 @@ public class PersistedJpaSearchFirstPageBundleProvider extends PersistedJpaBundl
|
|||
}
|
||||
|
||||
private boolean isInclude(IBaseResource theResource) {
|
||||
if (theResource instanceof IAnyResource) {
|
||||
return "include".equals(ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(((IAnyResource) theResource)));
|
||||
}
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(((IResource) theResource));
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(theResource);
|
||||
return BundleEntrySearchModeEnum.INCLUDE.equals(searchMode);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
|||
import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
|
||||
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
|
||||
import ca.uhn.fhir.util.AsyncUtil;
|
||||
import ca.uhn.fhir.util.ICallable;
|
||||
import ca.uhn.fhir.util.StopWatch;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -293,7 +292,9 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc<JpaPid> {
|
|||
}
|
||||
}
|
||||
|
||||
AsyncUtil.sleep(500);
|
||||
if (!search.getStatus().isDone()) {
|
||||
AsyncUtil.sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
ourLog.trace("Finished looping");
|
||||
|
@ -444,7 +445,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc<JpaPid> {
|
|||
* In case there is no running search, if the total is listed as accurate we know one is coming
|
||||
* so let's wait a bit for it to show up
|
||||
*/
|
||||
Optional<Search> search = myTxService.withRequest(theRequestDetails).execute(()->mySearchCacheSvc.fetchByUuid(theUuid));
|
||||
Optional<Search> search = myTxService.withRequest(theRequestDetails).execute(() -> mySearchCacheSvc.fetchByUuid(theUuid));
|
||||
if (search.isPresent()) {
|
||||
Optional<SearchParameterMap> searchParameterMap = search.get().getSearchParameterMap();
|
||||
if (searchParameterMap.isPresent() && searchParameterMap.get().getSearchTotalMode() == SearchTotalModeEnum.ACCURATE) {
|
||||
|
|
|
@ -903,18 +903,10 @@ public class SearchBuilder implements ISearchBuilder<JpaPid> {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (resource instanceof IResource) {
|
||||
if (theIncludedPids.contains(resourceId)) {
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put((IResource) resource, BundleEntrySearchModeEnum.INCLUDE);
|
||||
} else {
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put((IResource) resource, BundleEntrySearchModeEnum.MATCH);
|
||||
}
|
||||
if (theIncludedPids.contains(resourceId)) {
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(resource, BundleEntrySearchModeEnum.INCLUDE);
|
||||
} else {
|
||||
if (theIncludedPids.contains(resourceId)) {
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put((IAnyResource) resource, BundleEntrySearchModeEnum.INCLUDE.getCode());
|
||||
} else {
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put((IAnyResource) resource, BundleEntrySearchModeEnum.MATCH.getCode());
|
||||
}
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(resource, BundleEntrySearchModeEnum.MATCH);
|
||||
}
|
||||
|
||||
theResourceListToPopulate.set(index, resource);
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package ca.uhn.fhir.jpa.util;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
|
||||
* %%
|
||||
* 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 ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.util.CoverageIgnore;
|
||||
|
||||
final class AllowStatusChangeMetadata extends ResourceMetadataKeyEnum<Object> {
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
AllowStatusChangeMetadata(String theValue) {
|
||||
super(theValue);
|
||||
}
|
||||
|
||||
@CoverageIgnore
|
||||
@Override
|
||||
public Object get(IResource theResource) {
|
||||
throw new UnsupportedOperationException(Msg.code(805));
|
||||
}
|
||||
|
||||
@CoverageIgnore
|
||||
@Override
|
||||
public void put(IResource theResource, Object theObject) {
|
||||
throw new UnsupportedOperationException(Msg.code(806));
|
||||
}
|
||||
}
|
|
@ -25,24 +25,36 @@ public enum SearchStatusEnum {
|
|||
/**
|
||||
* The search is currently actively working
|
||||
*/
|
||||
LOADING,
|
||||
LOADING(false),
|
||||
/**
|
||||
* The search has loaded a set of results and has stopped searching because it
|
||||
* reached an appropriate threshold
|
||||
*/
|
||||
PASSCMPLET,
|
||||
PASSCMPLET(false),
|
||||
/**
|
||||
* The search completed normally and loaded all of the results it as permitted to
|
||||
* load
|
||||
*/
|
||||
FINISHED,
|
||||
FINISHED(true),
|
||||
/**
|
||||
* The search failed and will not continue
|
||||
*/
|
||||
FAILED,
|
||||
FAILED(true),
|
||||
/**
|
||||
* The search has been expired and will be expunged shortly
|
||||
*/
|
||||
GONE
|
||||
GONE(true);
|
||||
|
||||
private final boolean myDone;
|
||||
|
||||
SearchStatusEnum(boolean theDone) {
|
||||
myDone = theDone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if no more work will happen for this search (finished, failed, gone)
|
||||
*/
|
||||
public boolean isDone() {
|
||||
return myDone;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -449,6 +449,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{
|
|||
search.setUuid(uuid);
|
||||
search.setSearchType(SearchTypeEnum.SEARCH);
|
||||
search.setResourceType("Patient");
|
||||
search.setStatus(SearchStatusEnum.LOADING);
|
||||
|
||||
when(mySearchCacheSvc.fetchByUuid(eq(uuid))).thenReturn(Optional.of(search));
|
||||
doAnswer(loadPids()).when(mySearchBuilder).loadResourcesByPid(any(Collection.class), any(Collection.class), any(List.class), anyBoolean(), any());
|
||||
|
|
|
@ -1055,7 +1055,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
IBundleProvider history = myPatientDao.history(null, null, null, mySrd);
|
||||
assertEquals(4 + initialHistory, history.size().intValue());
|
||||
List<IBaseResource> resources = history.getResources(0, 4);
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) resources.get(0)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get(resources.get(0)));
|
||||
|
||||
try {
|
||||
myPatientDao.delete(id2, mySrd);
|
||||
|
@ -1164,9 +1164,9 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
IBundleProvider history = myPatientDao.history(id, null, null, null, mySrd);
|
||||
assertEquals(2, history.size().intValue());
|
||||
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) history.getResources(0, 1).get(0)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) history.getResources(0, 1).get(0)).getValue());
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) history.getResources(1, 2).get(0)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get(history.getResources(0, 1).get(0)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get(history.getResources(0, 1).get(0)).getValue());
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get(history.getResources(1, 2).get(0)));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1386,7 +1386,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
}
|
||||
|
||||
List<Patient> patients = toList(myPatientDao.history(idv1.toVersionless(), null, null, null, mySrd));
|
||||
assertTrue(patients.size() == 2);
|
||||
assertEquals(2, patients.size());
|
||||
// Newest first
|
||||
assertEquals("Patient/testHistoryByForcedId/_history/2", patients.get(0).getIdElement().toUnqualified().getValue());
|
||||
assertEquals("Patient/testHistoryByForcedId/_history/1", patients.get(1).getIdElement().toUnqualified().getValue());
|
||||
|
@ -1622,14 +1622,14 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
assertEquals(id.withVersion("2"), entries.get(1).getIdElement());
|
||||
assertEquals(id.withVersion("1"), entries.get(2).getIdElement());
|
||||
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(0)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.PUT.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(0)));
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get(entries.get(0)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.PUT, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(entries.get(0)));
|
||||
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(1)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.DELETE.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(1)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get(entries.get(1)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.DELETE, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(entries.get(1)));
|
||||
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(2)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.POST.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(2)));
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get(entries.get(2)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.POST, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(entries.get(2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -2371,7 +2371,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
meta = myPatientDao.metaGetOperation(Meta.class, mySrd);
|
||||
List<Coding> published = meta.getTag();
|
||||
assertEquals(2, published.size());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -2472,7 +2472,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
meta = myPatientDao.metaGetOperation(Meta.class, mySrd);
|
||||
List<Coding> published = meta.getTag();
|
||||
assertEquals(2, published.size());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -2573,7 +2573,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
meta = myPatientDao.metaGetOperation(Meta.class, mySrd);
|
||||
List<Coding> published = meta.getTag();
|
||||
assertEquals(2, published.size());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -2649,9 +2649,9 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
|
||||
assertEquals(2, results.size());
|
||||
assertEquals(Organization.class, results.get(0).getClass());
|
||||
assertEquals(BundleEntrySearchModeEnum.MATCH.getCode(), ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IAnyResource) results.get(0)));
|
||||
assertEquals(BundleEntrySearchModeEnum.MATCH, ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(results.get(0)));
|
||||
assertEquals(Patient.class, results.get(1).getClass());
|
||||
assertEquals(BundleEntrySearchModeEnum.INCLUDE.getCode(), ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IAnyResource) results.get(1)));
|
||||
assertEquals(BundleEntrySearchModeEnum.INCLUDE, ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(results.get(1)));
|
||||
}
|
||||
|
||||
@Test()
|
||||
|
@ -3294,7 +3294,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
myOrganizationDao.create(org, mySrd);
|
||||
|
||||
val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam("P")), null);
|
||||
assertEquals(initial + 0, val.size());
|
||||
assertEquals(initial, val.size());
|
||||
|
||||
val = myOrganizationDao.searchForIds(new SearchParameterMap("name", new StringParam(str.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH))), null);
|
||||
assertEquals(initial + 1, val.size());
|
||||
|
@ -3340,7 +3340,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
assertEquals(2, published.size());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Cat", published.get(1).getCode());
|
||||
assertEquals("Kittens", published.get(1).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -3368,7 +3368,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
sort(published);
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Cat", published.get(1).getCode());
|
||||
assertEquals("Kittens", published.get(1).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -3398,7 +3398,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
assertEquals(3, published.size());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Cat", published.get(1).getCode());
|
||||
assertEquals("Kittens", published.get(1).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
|
|
@ -48,18 +48,15 @@ public class ClientThreadedCapabilitiesTest {
|
|||
private static final Logger ourLog = LoggerFactory.getLogger("ClientThreadedCapabilitiesTest");
|
||||
|
||||
private static final FhirContext fhirContext = FhirContext.forR4();
|
||||
private static final String SERVER_URL = "http://hapi.fhir.org/baseR4";
|
||||
private IGenericClient myClient;
|
||||
private static final IClientInterceptor myCountingMetaClientInterceptor = new CountingMetaClientInterceptor();
|
||||
private static final IClientInterceptor myCountingMetaClientInterceptor = new CountingMetaClientInterceptor();
|
||||
private static final Collection<String> lastNames = Lists.newArrayList("Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis",
|
||||
"Rodriguez", "Martinez", "Hernandez", "Lopez", "Gonzalez", "Wilson", "Anderson", "Thomas", "Taylor", "Moore", "Jackson", "Martin", "Lee");
|
||||
|
||||
@RegisterExtension
|
||||
public static RestfulServerExtension ourServer = new RestfulServerExtension(fhirContext)
|
||||
.registerProvider(new TestPatientResourceProvider())
|
||||
.withValidationMode(ServerValidationModeEnum.ONCE)
|
||||
.registerInterceptor(new SearchPreferHandlingInterceptor());
|
||||
|
||||
private IGenericClient myClient;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() throws Exception {
|
||||
|
@ -74,13 +71,13 @@ public class ClientThreadedCapabilitiesTest {
|
|||
factory.setSocketTimeout(300 * 1000);
|
||||
|
||||
Executor executor = Executors.newFixedThreadPool(lastNames.size(), r -> {
|
||||
Thread t = new Thread(r);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
});
|
||||
Thread t = new Thread(r);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
});
|
||||
|
||||
Collection<CompletableFuture<Object>> futures = lastNames.stream()
|
||||
.map(last -> CompletableFuture.supplyAsync(() -> searchPatient(last), executor)).collect(toList());
|
||||
.map(last -> CompletableFuture.supplyAsync(() -> searchPatient(last), executor)).collect(toList());
|
||||
|
||||
|
||||
final StopWatch sw = new StopWatch();
|
||||
|
@ -139,7 +136,7 @@ public class ClientThreadedCapabilitiesTest {
|
|||
public Patient search(@OptionalParam(name = Patient.SP_FAMILY) StringParam theFamilyName) {
|
||||
Patient patient = new Patient();
|
||||
patient.getIdElement().setValue("Patient/" + rand.nextInt() + "/_history/222");
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE.getCode());
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE);
|
||||
patient.addName(new HumanName().setFamily(theFamilyName.getValue()));
|
||||
patient.setActive(true);
|
||||
return patient;
|
||||
|
@ -148,5 +145,4 @@ public class ClientThreadedCapabilitiesTest {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
|||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
@ -837,7 +838,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
String name = "profiles-resources";
|
||||
ourLog.info("Uploading " + name);
|
||||
String vsContents;
|
||||
vsContents = IOUtils.toString(FhirResourceDaoR4Test.class.getResourceAsStream("/org/hl7/fhir/r4/model/profile/" + name + ".xml"), "UTF-8");
|
||||
vsContents = IOUtils.toString(FhirResourceDaoR4Test.class.getResourceAsStream("/org/hl7/fhir/r4/model/profile/" + name + ".xml"), StandardCharsets.UTF_8);
|
||||
|
||||
bundle = myFhirContext.newXmlParser().parseResource(org.hl7.fhir.r4.model.Bundle.class, vsContents);
|
||||
for (BundleEntryComponent i : bundle.getEntry()) {
|
||||
|
@ -1018,15 +1019,15 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
* If any of this ever fails, it means that one of the OperationOutcome issue severity codes has changed code value across versions. We store the string as a constant, so something will need to
|
||||
* be fixed.
|
||||
*/
|
||||
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR);
|
||||
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseStorageDao.OO_SEVERITY_ERROR);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseStorageDao.OO_SEVERITY_ERROR);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR);
|
||||
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseStorageDao.OO_SEVERITY_ERROR);
|
||||
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseStorageDao.OO_SEVERITY_INFO);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseStorageDao.OO_SEVERITY_INFO);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO);
|
||||
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseStorageDao.OO_SEVERITY_INFO);
|
||||
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseStorageDao.OO_SEVERITY_WARN);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseStorageDao.OO_SEVERITY_WARN);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseStorageDao.OO_SEVERITY_WARN);
|
||||
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1417,7 +1418,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
IBundleProvider history = myPatientDao.history(null, null, null, mySrd);
|
||||
assertEquals(4 + initialHistory, history.size().intValue());
|
||||
List<IBaseResource> resources = history.getResources(0, 4);
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) resources.get(0)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get(resources.get(0)));
|
||||
|
||||
try {
|
||||
myPatientDao.delete(id2, mySrd);
|
||||
|
@ -1518,7 +1519,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
assertEquals("3", id5.getVersionIdPart());
|
||||
|
||||
patient = myPatientDao.read(id.withVersion("1"));
|
||||
assertEquals(true, patient.getActive());
|
||||
assertTrue(patient.getActive());
|
||||
|
||||
try {
|
||||
myPatientDao.read(id.withVersion("2"));
|
||||
|
@ -1528,7 +1529,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
}
|
||||
|
||||
patient = myPatientDao.read(id.withVersion("3"));
|
||||
assertEquals(false, patient.getActive());
|
||||
assertFalse(patient.getActive());
|
||||
|
||||
}
|
||||
|
||||
|
@ -1592,9 +1593,9 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
IBundleProvider history = myPatientDao.history(id, null, null, null, mySrd);
|
||||
assertEquals(2, history.size().intValue());
|
||||
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) history.getResources(0, 1).get(0)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) history.getResources(0, 1).get(0)).getValue());
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) history.getResources(1, 2).get(0)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get(history.getResources(0, 1).get(0)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get(history.getResources(0, 1).get(0)).getValue());
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get(history.getResources(1, 2).get(0)));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1837,7 +1838,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
}
|
||||
|
||||
List<Patient> patients = toList(myPatientDao.history(idv1.toVersionless(), null, null, null, mySrd));
|
||||
assertTrue(patients.size() == 2);
|
||||
assertEquals(2, patients.size());
|
||||
// Newest first
|
||||
assertEquals("Patient/testHistoryByForcedId/_history/2", patients.get(0).getIdElement().toUnqualified().getValue());
|
||||
assertEquals("Patient/testHistoryByForcedId/_history/1", patients.get(1).getIdElement().toUnqualified().getValue());
|
||||
|
@ -2072,14 +2073,14 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
assertEquals(id.withVersion("2"), entries.get(1).getIdElement());
|
||||
assertEquals(id.withVersion("1"), entries.get(2).getIdElement());
|
||||
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(0)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.PUT.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(0)));
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get(entries.get(0)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.PUT, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(entries.get(0)));
|
||||
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(1)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.DELETE.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(1)));
|
||||
assertNotNull(ResourceMetadataKeyEnum.DELETED_AT.get(entries.get(1)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.DELETE, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(entries.get(1)));
|
||||
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get((IAnyResource) entries.get(2)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.POST.getCode(), ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get((IAnyResource) entries.get(2)));
|
||||
assertNull(ResourceMetadataKeyEnum.DELETED_AT.get(entries.get(2)));
|
||||
assertEquals(BundleEntryTransactionMethodEnum.POST, ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(entries.get(2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -2255,7 +2256,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
myConditionDao.create(c2, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
Condition c3 = new Condition();
|
||||
c3.setOnset(new Range().setLow((SimpleQuantity) new SimpleQuantity().setValue(200L)).setHigh((SimpleQuantity) new SimpleQuantity().setValue(300L)));
|
||||
c3.setOnset(new Range().setLow(new SimpleQuantity().setValue(200L)).setHigh(new SimpleQuantity().setValue(300L)));
|
||||
myConditionDao.create(c3, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
Condition c4 = new Condition();
|
||||
|
@ -2841,7 +2842,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
meta = myPatientDao.metaGetOperation(Meta.class, mySrd);
|
||||
List<Coding> published = meta.getTag();
|
||||
assertEquals(2, published.size());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -2972,7 +2973,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
meta = myPatientDao.metaGetOperation(Meta.class, mySrd);
|
||||
List<Coding> published = meta.getTag();
|
||||
assertEquals(2, published.size());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -3073,7 +3074,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
meta = myPatientDao.metaGetOperation(Meta.class, mySrd);
|
||||
List<Coding> published = meta.getTag();
|
||||
assertEquals(2, published.size());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -3149,9 +3150,9 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
|
||||
assertEquals(2, results.size());
|
||||
assertEquals(Organization.class, results.get(0).getClass());
|
||||
assertEquals(BundleEntrySearchModeEnum.MATCH.getCode(), ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IAnyResource) results.get(0)));
|
||||
assertEquals(BundleEntrySearchModeEnum.MATCH, ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(results.get(0)));
|
||||
assertEquals(Patient.class, results.get(1).getClass());
|
||||
assertEquals(BundleEntrySearchModeEnum.INCLUDE.getCode(), ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get((IAnyResource) results.get(1)));
|
||||
assertEquals(BundleEntrySearchModeEnum.INCLUDE, ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(results.get(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -4033,7 +4034,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
assertEquals(2, published.size());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Cat", published.get(1).getCode());
|
||||
assertEquals("Kittens", published.get(1).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -4061,7 +4062,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
sort(published);
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Cat", published.get(1).getCode());
|
||||
assertEquals("Kittens", published.get(1).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
@ -4091,7 +4092,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
|||
assertEquals(3, published.size());
|
||||
assertEquals("Dog", published.get(0).getCode());
|
||||
assertEquals("Puppies", published.get(0).getDisplay());
|
||||
assertEquals(null, published.get(0).getSystem());
|
||||
assertNull(published.get(0).getSystem());
|
||||
assertEquals("Cat", published.get(1).getCode());
|
||||
assertEquals("Kittens", published.get(1).getDisplay());
|
||||
assertEquals("http://foo", published.get(1).getSystem());
|
||||
|
|
|
@ -20,23 +20,13 @@ package ca.uhn.fhir.jpa.api.dao;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
|
||||
public final class MetadataKeyCurrentlyReindexing extends ResourceMetadataKeyEnum<Boolean> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 2L;
|
||||
|
||||
MetadataKeyCurrentlyReindexing(String theValue) {
|
||||
super(theValue);
|
||||
super(theValue, Boolean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean get(IResource theResource) {
|
||||
return (Boolean) theResource.getResourceMetadata().get(IDao.CURRENTLY_REINDEXING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, Boolean theObject) {
|
||||
theResource.getResourceMetadata().put(IDao.CURRENTLY_REINDEXING, theObject);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,34 +20,13 @@ package ca.uhn.fhir.jpa.api.dao;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum.ResourceMetadataKeySupportingAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
|
||||
public final class MetadataKeyResourcePid extends ResourceMetadataKeySupportingAnyResource<Long, Long> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public final class MetadataKeyResourcePid extends ResourceMetadataKeyEnum<Long> {
|
||||
private static final long serialVersionUID = 2L;
|
||||
|
||||
MetadataKeyResourcePid(String theValue) {
|
||||
super(theValue);
|
||||
super(theValue, Long.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long get(IAnyResource theResource) {
|
||||
return (Long) theResource.getUserData(IDao.RESOURCE_PID.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long get(IResource theResource) {
|
||||
return (Long) theResource.getResourceMetadata().get(IDao.RESOURCE_PID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IAnyResource theResource, Long theObject) {
|
||||
theResource.setUserData(IDao.RESOURCE_PID.name(), theObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(IResource theResource, Long theObject) {
|
||||
theResource.getResourceMetadata().put(IDao.RESOURCE_PID, theObject);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.context.api.BundleInclusionRule;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.BundleLinks;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
|
@ -131,17 +133,17 @@ public class Dstu2_1BundleFactory implements IVersionSpecificBundleFactory {
|
|||
BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next);
|
||||
Resource nextAsResource = (Resource) next;
|
||||
IIdType id = populateBundleEntryFullUrl(next, entry);
|
||||
String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
BundleEntryTransactionMethodEnum httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
if (httpVerb != null) {
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb);
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb.name());
|
||||
if (id != null) {
|
||||
entry.getRequest().setUrl(id.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
if (searchMode != null) {
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode);
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.context.api.BundleInclusionRule;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.BundleLinks;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
|
@ -132,14 +134,14 @@ public class Dstu3BundleFactory implements IVersionSpecificBundleFactory {
|
|||
BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next);
|
||||
Resource nextAsResource = (Resource) next;
|
||||
IIdType id = populateBundleEntryFullUrl(next, entry);
|
||||
String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
BundleEntryTransactionMethodEnum httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
if (httpVerb != null) {
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb);
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb.name());
|
||||
if (id != null) {
|
||||
entry.getRequest().setUrl(id.toUnqualified().getValue());
|
||||
}
|
||||
}
|
||||
if ("DELETE".equals(httpVerb)) {
|
||||
if (BundleEntryTransactionMethodEnum.DELETE.equals(httpVerb)) {
|
||||
entry.setResource(null);
|
||||
}
|
||||
|
||||
|
@ -161,9 +163,9 @@ public class Dstu3BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
|
||||
// Populate Bundle.entry.search
|
||||
String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
if (searchMode != null) {
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode);
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.context.api.BundleInclusionRule;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.BundleLinks;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
|
@ -135,14 +137,14 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
|
|||
BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next);
|
||||
Resource nextAsResource = (Resource) next;
|
||||
IIdType id = populateBundleEntryFullUrl(next, entry);
|
||||
String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
BundleEntryTransactionMethodEnum httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
if (httpVerb != null) {
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb);
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb.name());
|
||||
if (id != null) {
|
||||
entry.getRequest().setUrl(id.getValue());
|
||||
}
|
||||
}
|
||||
if ("DELETE".equals(httpVerb)) {
|
||||
if (BundleEntryTransactionMethodEnum.DELETE.equals(httpVerb)) {
|
||||
entry.setResource(null);
|
||||
}
|
||||
|
||||
|
@ -166,9 +168,9 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
|
||||
// Populate Bundle.entry.search
|
||||
String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
if (searchMode != null) {
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode);
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.context.api.BundleInclusionRule;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.BundleLinks;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
|
@ -134,14 +136,14 @@ public class R4BundleFactory implements IVersionSpecificBundleFactory {
|
|||
IIdType id = populateBundleEntryFullUrl(next, entry);
|
||||
|
||||
// Populate Request
|
||||
String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
BundleEntryTransactionMethodEnum httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
if (httpVerb != null) {
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb);
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb.name());
|
||||
if (id != null) {
|
||||
entry.getRequest().setUrl(id.toUnqualified().getValue());
|
||||
}
|
||||
}
|
||||
if ("DELETE".equals(httpVerb)) {
|
||||
if (BundleEntryTransactionMethodEnum.DELETE.equals(httpVerb)) {
|
||||
entry.setResource(null);
|
||||
}
|
||||
|
||||
|
@ -164,9 +166,9 @@ public class R4BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
|
||||
// Populate Bundle.entry.search
|
||||
String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
if (searchMode != null) {
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode);
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ public class SearchPreferHandlingInterceptorTest {
|
|||
for (int i = 0; i < 200; i++) {
|
||||
Patient patient = new Patient();
|
||||
patient.getIdElement().setValue("Patient/" + i + "/_history/222");
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE.getCode());
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE);
|
||||
patient.addName(new HumanName().setFamily("FAMILY"));
|
||||
patient.setActive(true);
|
||||
retVal.add(patient);
|
||||
|
|
|
@ -517,7 +517,7 @@ public class SearchR4Test {
|
|||
for (int i = 0; i < 200; i++) {
|
||||
Patient patient = new Patient();
|
||||
patient.getIdElement().setValue("Patient/" + i + "/_history/222");
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE.getCode());
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE);
|
||||
patient.addName(new HumanName().setFamily("FAMILY"));
|
||||
patient.setActive(true);
|
||||
retVal.add(patient);
|
||||
|
@ -534,7 +534,6 @@ public class SearchR4Test {
|
|||
return MedicationRequest.class;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Search()
|
||||
public List<IBaseResource> search(
|
||||
@IncludeParam Set<Include> theIncludes
|
||||
|
|
|
@ -24,6 +24,8 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.context.api.BundleInclusionRule;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.BundleLinks;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
|
@ -134,14 +136,14 @@ public class R4BBundleFactory implements IVersionSpecificBundleFactory {
|
|||
IIdType id = populateBundleEntryFullUrl(next, entry);
|
||||
|
||||
// Populate Request
|
||||
String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
BundleEntryTransactionMethodEnum httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
if (httpVerb != null) {
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb);
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb.name());
|
||||
if (id != null) {
|
||||
entry.getRequest().setUrl(id.toUnqualified().getValue());
|
||||
}
|
||||
}
|
||||
if ("DELETE".equals(httpVerb)) {
|
||||
if (BundleEntryTransactionMethodEnum.DELETE.equals(httpVerb)) {
|
||||
entry.setResource(null);
|
||||
}
|
||||
|
||||
|
@ -164,9 +166,9 @@ public class R4BBundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
|
||||
// Populate Bundle.entry.search
|
||||
String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
if (searchMode != null) {
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode);
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ import ca.uhn.fhir.rest.api.EncodingEnum;
|
|||
import ca.uhn.fhir.rest.param.TokenAndListParam;
|
||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
import ca.uhn.fhir.validation.FhirValidator;
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
|
@ -34,13 +32,12 @@ import java.util.List;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class SearchR4BTest {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchR4BTest.class);
|
||||
private static final FhirContext ourCtx = FhirContext.forR4BCached();
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static FhirContext ourCtx = FhirContext.forR4BCached();
|
||||
private static TokenAndListParam ourIdentifiers;
|
||||
private static String ourLastMethod;
|
||||
private static int ourPort;
|
||||
|
@ -60,7 +57,6 @@ public class SearchR4BTest {
|
|||
try (CloseableHttpResponse status = ourClient.execute(httpGet)) {
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||
ourLog.info(responseContent);
|
||||
// validate(ourCtx.newJsonParser().parseResource(responseContent));
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals("search", ourLastMethod);
|
||||
|
@ -72,15 +68,6 @@ public class SearchR4BTest {
|
|||
}
|
||||
|
||||
|
||||
private void validate(IBaseResource theResource) {
|
||||
FhirValidator validatorModule = ourCtx.newValidator();
|
||||
ValidationResult result = validatorModule.validateWithResult(theResource);
|
||||
if (!result.isSuccessful()) {
|
||||
fail(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(result.toOperationOutcome()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class DummyPatientResourceProvider implements IResourceProvider {
|
||||
|
||||
@Override
|
||||
|
@ -99,7 +86,7 @@ public class SearchR4BTest {
|
|||
for (int i = 0; i < 200; i++) {
|
||||
Patient patient = new Patient();
|
||||
patient.getIdElement().setValue("Patient/" + i + "/_history/222");
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE.getCode());
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE);
|
||||
patient.addName(new HumanName().setFamily("FAMILY"));
|
||||
patient.setActive(true);
|
||||
retVal.add(patient);
|
||||
|
@ -132,7 +119,7 @@ public class SearchR4BTest {
|
|||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||
ourServer.setHandler(proxyHandler);
|
||||
JettyUtil.startServer(ourServer);
|
||||
ourPort = JettyUtil.getPortForStartedServer(ourServer);
|
||||
ourPort = JettyUtil.getPortForStartedServer(ourServer);
|
||||
|
||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||
|
|
|
@ -24,6 +24,8 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.context.api.BundleInclusionRule;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.BundleLinks;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
|
@ -134,14 +136,14 @@ public class R5BundleFactory implements IVersionSpecificBundleFactory {
|
|||
IIdType id = populateBundleEntryFullUrl(next, entry);
|
||||
|
||||
// Populate Request
|
||||
String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
BundleEntryTransactionMethodEnum httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
|
||||
if (httpVerb != null) {
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb);
|
||||
entry.getRequest().getMethodElement().setValueAsString(httpVerb.name());
|
||||
if (id != null) {
|
||||
entry.getRequest().setUrl(id.toUnqualified().getValue());
|
||||
}
|
||||
}
|
||||
if ("DELETE".equals(httpVerb)) {
|
||||
if (BundleEntryTransactionMethodEnum.DELETE.equals(httpVerb)) {
|
||||
entry.setResource(null);
|
||||
}
|
||||
|
||||
|
@ -164,9 +166,9 @@ public class R5BundleFactory implements IVersionSpecificBundleFactory {
|
|||
}
|
||||
|
||||
// Populate Bundle.entry.search
|
||||
String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
BundleEntrySearchModeEnum searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
|
||||
if (searchMode != null) {
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode);
|
||||
entry.getSearch().getModeElement().setValueAsString(searchMode.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ import ca.uhn.fhir.rest.api.EncodingEnum;
|
|||
import ca.uhn.fhir.rest.param.TokenAndListParam;
|
||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
import ca.uhn.fhir.validation.FhirValidator;
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
|
@ -34,13 +32,12 @@ import java.util.List;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class SearchR5Test {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchR5Test.class);
|
||||
private static final FhirContext ourCtx = FhirContext.forR5Cached();
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static FhirContext ourCtx = FhirContext.forR5();
|
||||
private static TokenAndListParam ourIdentifiers;
|
||||
private static String ourLastMethod;
|
||||
private static int ourPort;
|
||||
|
@ -60,7 +57,6 @@ public class SearchR5Test {
|
|||
try (CloseableHttpResponse status = ourClient.execute(httpGet)) {
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||
ourLog.info(responseContent);
|
||||
// validate(ourCtx.newJsonParser().parseResource(responseContent));
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals("search", ourLastMethod);
|
||||
|
@ -72,15 +68,6 @@ public class SearchR5Test {
|
|||
}
|
||||
|
||||
|
||||
private void validate(IBaseResource theResource) {
|
||||
FhirValidator validatorModule = ourCtx.newValidator();
|
||||
ValidationResult result = validatorModule.validateWithResult(theResource);
|
||||
if (!result.isSuccessful()) {
|
||||
fail(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(result.toOperationOutcome()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class DummyPatientResourceProvider implements IResourceProvider {
|
||||
|
||||
@Override
|
||||
|
@ -99,7 +86,7 @@ public class SearchR5Test {
|
|||
for (int i = 0; i < 200; i++) {
|
||||
Patient patient = new Patient();
|
||||
patient.getIdElement().setValue("Patient/" + i + "/_history/222");
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE.getCode());
|
||||
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(patient, BundleEntrySearchModeEnum.INCLUDE);
|
||||
patient.addName(new HumanName().setFamily("FAMILY"));
|
||||
patient.setActive(true);
|
||||
retVal.add(patient);
|
||||
|
@ -132,7 +119,7 @@ public class SearchR5Test {
|
|||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||
ourServer.setHandler(proxyHandler);
|
||||
JettyUtil.startServer(ourServer);
|
||||
ourPort = JettyUtil.getPortForStartedServer(ourServer);
|
||||
ourPort = JettyUtil.getPortForStartedServer(ourServer);
|
||||
|
||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||
|
|
Loading…
Reference in New Issue