Address review comments

This commit is contained in:
jamesagnew 2020-06-30 14:29:24 -04:00
parent 11c4f9defb
commit f820135996
32 changed files with 234 additions and 214 deletions

View File

@ -252,15 +252,6 @@ public class Constants {
* Operation name for the $lastn operation * Operation name for the $lastn operation
*/ */
public static final String OPERATION_LASTN = "$lastn"; public static final String OPERATION_LASTN = "$lastn";
/**
* <p>
* This extension represents the equivalent of the
* <code>Resource.meta.source</code> field within R4+ resources, and is for
* use in DSTU3 resources. It should contain a value of type <code>uri</code>
* and will be located on the Resource.meta
* </p>
*/
public static final String EXT_META_SOURCE = "http://hapifhir.io/fhir/StructureDefinition/resource-meta-source";
public static final String PARAM_FHIRPATH = "_fhirpath"; public static final String PARAM_FHIRPATH = "_fhirpath";
public static final String PARAM_TYPE = "_type"; public static final String PARAM_TYPE = "_type";

View File

@ -0,0 +1,91 @@
package ca.uhn.fhir.util;
public class HapiExtensions {
/**
* <p>
* This extension should be of type <code>string</code> and should be
* placed on the <code>Subscription.channel</code> element
* </p>
*/
public static final String EXT_SUBSCRIPTION_SUBJECT_TEMPLATE = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-subject-template";
/**
* This extension URL indicates whether a REST HOOK delivery should
* include the version ID when delivering.
* <p>
* This extension should be of type <code>boolean</code> and should be
* placed on the <code>Subscription.channel</code> element.
* </p>
*/
public static final String EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS = "http://hapifhir.io/fhir/StructureDefinition/subscription-resthook-strip-version-ids";
/**
* This extension URL indicates whether a REST HOOK delivery should
* reload the resource and deliver the latest version always. This
* could be useful for example if a resource which triggers a
* subscription gets updated many times in short succession and there
* is no value in delivering the older versions.
* <p>
* Note that if the resource is now deleted, this may cause
* the delivery to be cancelled altogether.
* </p>
*
* <p>
* This extension should be of type <code>boolean</code> and should be
* placed on the <code>Subscription.channel</code> element.
* </p>
*/
public static final String EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION = "http://hapifhir.io/fhir/StructureDefinition/subscription-resthook-deliver-latest-version";
/**
* Indicate which strategy will be used to match this subscription
*/
public static final String EXT_SUBSCRIPTION_MATCHING_STRATEGY = "http://hapifhir.io/fhir/StructureDefinition/subscription-matching-strategy";
/**
* <p>
* This extension should be of type <code>string</code> and should be
* placed on the <code>Subscription.channel</code> element
* </p>
*/
public static final String EXT_SUBSCRIPTION_EMAIL_FROM = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-from";
/**
* Extension ID for external binary references
*/
public static final String EXT_EXTERNALIZED_BINARY_ID = "http://hapifhir.io/fhir/StructureDefinition/externalized-binary-id";
/**
* For subscription, deliver a bundle containing a search result instead of just a single resource
*/
public static final String EXT_SUBSCRIPTION_PAYLOAD_SEARCH_CRITERIA = "http://hapifhir.io/fhir/StructureDefinition/subscription-payload-search-criteria";
/**
* Message added to expansion valueset
*/
public static final String EXT_VALUESET_EXPANSION_MESSAGE = "http://hapifhir.io/fhir/StructureDefinition/valueset-expansion-message";
/**
* Extension URL for extension on a SearchParameter indicating that text values should not be indexed
*/
public static final String EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING = "http://hapifhir.io/fhir/StructureDefinition/searchparameter-token-suppress-text-index";
/**
* <p>
* This extension represents the equivalent of the
* <code>Resource.meta.source</code> field within R4+ resources, and is for
* use in DSTU3 resources. It should contain a value of type <code>uri</code>
* and will be located on the Resource.meta
* </p>
*/
public static final String EXT_META_SOURCE = "http://hapifhir.io/fhir/StructureDefinition/resource-meta-source";
public static final String EXT_SP_UNIQUE = "http://hapifhir.io/fhir/StructureDefinition/sp-unique";
/**
* Non instantiable
*/
private HapiExtensions() {
}
}

View File

@ -24,7 +24,6 @@ import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition; import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.rest.api.Constants;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseExtension; import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions; import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
@ -58,7 +57,7 @@ public class MetaUtil {
IBaseHasExtensions metaWithExtensions = theMeta; IBaseHasExtensions metaWithExtensions = theMeta;
List<? extends IBaseExtension<?, ?>> extensions = metaWithExtensions.getExtension(); List<? extends IBaseExtension<?, ?>> extensions = metaWithExtensions.getExtension();
for (IBaseExtension extension : extensions) { for (IBaseExtension extension : extensions) {
if (Constants.EXT_META_SOURCE.equals(extension.getUrl())) { if (HapiExtensions.EXT_META_SOURCE.equals(extension.getUrl())) {
IPrimitiveType<String> value = (IPrimitiveType<String>) extension.getValue(); IPrimitiveType<String> value = (IPrimitiveType<String>) extension.getValue();
return value.getValueAsString(); return value.getValueAsString();
} }
@ -96,7 +95,7 @@ public class MetaUtil {
MetaUtil.setSource(theContext, theResource.getMeta(), theValue); MetaUtil.setSource(theContext, theResource.getMeta(), theValue);
} else if (theContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU3)) { } else if (theContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU3)) {
IBaseExtension<?, ?> sourceExtension = ((IBaseHasExtensions) theResource.getMeta()).addExtension(); IBaseExtension<?, ?> sourceExtension = ((IBaseHasExtensions) theResource.getMeta()).addExtension();
sourceExtension.setUrl(Constants.EXT_META_SOURCE); sourceExtension.setUrl(HapiExtensions.EXT_META_SOURCE);
IPrimitiveType<String> value = (IPrimitiveType<String>) theContext.getElementDefinition("uri").newInstance(); IPrimitiveType<String> value = (IPrimitiveType<String>) theContext.getElementDefinition("uri").newInstance();
value.setValue(theValue); value.setValue(theValue);
sourceExtension.setValue(value); sourceExtension.setValue(value);

View File

@ -4,8 +4,8 @@ import ca.uhn.fhir.jpa.api.model.WarmCacheEntry;
import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.entity.ResourceEncodingEnum; import ca.uhn.fhir.jpa.model.entity.ResourceEncodingEnum;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate;
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
import ca.uhn.fhir.rest.api.SearchTotalModeEnum; import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
import ca.uhn.fhir.util.HapiExtensions;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
@ -1417,7 +1417,7 @@ public class DaoConfig {
/** /**
* If set to <code>true</code> (default is <code>true</code>), indexes will be * If set to <code>true</code> (default is <code>true</code>), indexes will be
* created for search parameters marked as {@link SearchParamConstants#EXT_SP_UNIQUE}. * created for search parameters marked as {@link HapiExtensions#EXT_SP_UNIQUE}.
* This is a HAPI FHIR specific extension which can be used to specify that no more than one * This is a HAPI FHIR specific extension which can be used to specify that no more than one
* resource can exist which matches a given criteria, using a database constraint to * resource can exist which matches a given criteria, using a database constraint to
* enforce this. * enforce this.
@ -1428,7 +1428,7 @@ public class DaoConfig {
/** /**
* If set to <code>true</code> (default is <code>true</code>), indexes will be * If set to <code>true</code> (default is <code>true</code>), indexes will be
* created for search parameters marked as {@link SearchParamConstants#EXT_SP_UNIQUE}. * created for search parameters marked as {@link HapiExtensions#EXT_SP_UNIQUE}.
* This is a HAPI FHIR specific extension which can be used to specify that no more than one * This is a HAPI FHIR specific extension which can be used to specify that no more than one
* resource can exist which matches a given criteria, using a database constraint to * resource can exist which matches a given criteria, using a database constraint to
* enforce this. * enforce this.

View File

@ -37,6 +37,7 @@ import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.util.AttachmentUtil; import ca.uhn.fhir.util.AttachmentUtil;
import ca.uhn.fhir.util.BinaryUtil; import ca.uhn.fhir.util.BinaryUtil;
import ca.uhn.fhir.util.DateUtils; import ca.uhn.fhir.util.DateUtils;
import ca.uhn.fhir.util.HapiExtensions;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
@ -209,11 +210,11 @@ public class BinaryAccessProvider {
theTarget theTarget
.getTarget() .getTarget()
.getExtension() .getExtension()
.removeIf(t -> JpaConstants.EXT_EXTERNALIZED_BINARY_ID.equals(t.getUrl())); .removeIf(t -> HapiExtensions.EXT_EXTERNALIZED_BINARY_ID.equals(t.getUrl()));
theTarget.setData(null); theTarget.setData(null);
IBaseExtension<?, ?> ext = theTarget.getTarget().addExtension(); IBaseExtension<?, ?> ext = theTarget.getTarget().addExtension();
ext.setUrl(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); ext.setUrl(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
ext.setUserData(JpaConstants.EXTENSION_EXT_SYSTEMDEFINED, Boolean.TRUE); ext.setUserData(JpaConstants.EXTENSION_EXT_SYSTEMDEFINED, Boolean.TRUE);
IPrimitiveType<String> blobIdString = (IPrimitiveType<String>) myCtx.getElementDefinition("string").newInstance(); IPrimitiveType<String> blobIdString = (IPrimitiveType<String>) myCtx.getElementDefinition("string").newInstance();
blobIdString.setValueAsString(theBlobId); blobIdString.setValueAsString(theBlobId);

View File

@ -31,6 +31,7 @@ import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
import ca.uhn.fhir.rest.api.server.IPreResourceShowDetails; import ca.uhn.fhir.rest.api.server.IPreResourceShowDetails;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.IModelVisitor2; import ca.uhn.fhir.util.IModelVisitor2;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;
@ -56,7 +57,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static ca.uhn.fhir.jpa.model.util.JpaConstants.EXT_EXTERNALIZED_BINARY_ID; import static ca.uhn.fhir.util.HapiExtensions.EXT_EXTERNALIZED_BINARY_ID;
import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank;
@Interceptor @Interceptor
@ -106,7 +107,7 @@ public class BinaryStorageInterceptor {
List<String> attachmentIds = binaryElements List<String> attachmentIds = binaryElements
.stream() .stream()
.flatMap(t -> ((IBaseHasExtensions) t).getExtension().stream()) .flatMap(t -> ((IBaseHasExtensions) t).getExtension().stream())
.filter(t -> JpaConstants.EXT_EXTERNALIZED_BINARY_ID.equals(t.getUrl())) .filter(t -> HapiExtensions.EXT_EXTERNALIZED_BINARY_ID.equals(t.getUrl()))
.map(t -> ((IPrimitiveType<?>) t.getValue()).getValueAsString()) .map(t -> ((IPrimitiveType<?>) t.getValue()).getValueAsString())
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.binstore;
* #L% * #L%
*/ */
import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.util.HapiExtensions;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions; import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.instance.model.api.IPrimitiveType;
@ -51,7 +51,7 @@ interface IBinaryTarget {
return getTarget() return getTarget()
.getExtension() .getExtension()
.stream() .stream()
.filter(t -> JpaConstants.EXT_EXTERNALIZED_BINARY_ID.equals(t.getUrl())) .filter(t -> HapiExtensions.EXT_EXTERNALIZED_BINARY_ID.equals(t.getUrl()))
.filter(t -> t.getValue() instanceof IPrimitiveType) .filter(t -> t.getValue() instanceof IPrimitiveType)
.map(t -> (IPrimitiveType<String>) t.getValue()) .map(t -> (IPrimitiveType<String>) t.getValue())
.map(t -> t.getValue()) .map(t -> t.getValue())

View File

@ -83,6 +83,7 @@ import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.util.CoverageIgnore; import ca.uhn.fhir.util.CoverageIgnore;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.MetaUtil; import ca.uhn.fhir.util.MetaUtil;
import ca.uhn.fhir.util.XmlUtil; import ca.uhn.fhir.util.XmlUtil;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
@ -1130,7 +1131,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
source = ((IBaseHasExtensions) theResource.getMeta()) source = ((IBaseHasExtensions) theResource.getMeta())
.getExtension() .getExtension()
.stream() .stream()
.filter(t -> Constants.EXT_META_SOURCE.equals(t.getUrl())) .filter(t -> HapiExtensions.EXT_META_SOURCE.equals(t.getUrl()))
.filter(t -> t.getValue() instanceof IPrimitiveType) .filter(t -> t.getValue() instanceof IPrimitiveType)
.map(t -> ((IPrimitiveType<?>) t.getValue()).getValueAsString()) .map(t -> ((IPrimitiveType<?>) t.getValue()).getValueAsString())
.findFirst() .findFirst()

View File

@ -22,10 +22,10 @@ package ca.uhn.fhir.jpa.term;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.entity.TermConceptDesignation; import ca.uhn.fhir.jpa.entity.TermConceptDesignation;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.term.ex.ExpansionTooCostlyException; import ca.uhn.fhir.jpa.term.ex.ExpansionTooCostlyException;
import ca.uhn.fhir.model.api.annotation.Block; import ca.uhn.fhir.model.api.annotation.Block;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.util.HapiExtensions;
import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.ValueSet; import org.hl7.fhir.r4.model.ValueSet;
@ -59,7 +59,7 @@ public class ValueSetExpansionComponentWithConceptAccumulator extends ValueSet.V
@Override @Override
public void addMessage(String theMessage) { public void addMessage(String theMessage) {
addExtension() addExtension()
.setUrl(JpaConstants.EXT_VALUESET_EXPANSION_MESSAGE) .setUrl(HapiExtensions.EXT_VALUESET_EXPANSION_MESSAGE)
.setValue(new StringType(theMessage)); .setValue(new StringType(theMessage));
} }

View File

@ -10,6 +10,7 @@ import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException; import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
import ca.uhn.fhir.util.HapiExtensions;
import org.apache.commons.text.RandomStringGenerator; import org.apache.commons.text.RandomStringGenerator;
import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.dstu3.model.StringType; import org.hl7.fhir.dstu3.model.StringType;
@ -45,12 +46,12 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test {
when(mySrd.getRequestId()).thenReturn(requestId); when(mySrd.getRequestId()).thenReturn(requestId);
Patient pt0 = new Patient(); Patient pt0 = new Patient();
pt0.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:0")); pt0.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:0"));
pt0.setActive(true); pt0.setActive(true);
IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless(); IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless();
Patient pt1 = new Patient(); Patient pt1 = new Patient();
pt1.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:1")); pt1.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:1"));
pt1.setActive(true); pt1.setActive(true);
IIdType pt1id = myPatientDao.create(pt1, mySrd).getId().toUnqualifiedVersionless(); IIdType pt1id = myPatientDao.create(pt1, mySrd).getId().toUnqualifiedVersionless();
@ -61,7 +62,7 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test {
IBundleProvider result = myPatientDao.search(params); IBundleProvider result = myPatientDao.search(params);
assertThat(toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(pt0id.getValue())); assertThat(toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(pt0id.getValue()));
pt0 = (Patient) result.getResources(0, 1).get(0); pt0 = (Patient) result.getResources(0, 1).get(0);
assertEquals("urn:source:0#a_request_id", pt0.getMeta().getExtensionString(Constants.EXT_META_SOURCE)); assertEquals("urn:source:0#a_request_id", pt0.getMeta().getExtensionString(HapiExtensions.EXT_META_SOURCE));
// Search by request ID // Search by request ID
params = new SearchParameterMap(); params = new SearchParameterMap();
@ -86,17 +87,17 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test {
when(mySrd.getRequestId()).thenReturn(requestId); when(mySrd.getRequestId()).thenReturn(requestId);
Patient pt0 = new Patient(); Patient pt0 = new Patient();
pt0.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:0")); pt0.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:0"));
pt0.setActive(true); pt0.setActive(true);
IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless(); IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless();
Patient pt1 = new Patient(); Patient pt1 = new Patient();
pt1.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:1")); pt1.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:1"));
pt1.setActive(true); pt1.setActive(true);
IIdType pt1id = myPatientDao.create(pt1, mySrd).getId().toUnqualifiedVersionless(); IIdType pt1id = myPatientDao.create(pt1, mySrd).getId().toUnqualifiedVersionless();
Patient pt2 = new Patient(); Patient pt2 = new Patient();
pt2.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:2")); pt2.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:2"));
pt2.setActive(true); pt2.setActive(true);
myPatientDao.create(pt2, mySrd).getId().toUnqualifiedVersionless(); myPatientDao.create(pt2, mySrd).getId().toUnqualifiedVersionless();
@ -117,17 +118,17 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test {
when(mySrd.getRequestId()).thenReturn(requestId); when(mySrd.getRequestId()).thenReturn(requestId);
Patient pt0 = new Patient(); Patient pt0 = new Patient();
pt0.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:0")); pt0.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:0"));
pt0.setActive(true); pt0.setActive(true);
IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless(); IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless();
Patient pt1 = new Patient(); Patient pt1 = new Patient();
pt1.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:1")); pt1.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:1"));
pt1.setActive(true); pt1.setActive(true);
IIdType pt1id = myPatientDao.create(pt1, mySrd).getId().toUnqualifiedVersionless(); IIdType pt1id = myPatientDao.create(pt1, mySrd).getId().toUnqualifiedVersionless();
Patient pt2 = new Patient(); Patient pt2 = new Patient();
pt2.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:2")); pt2.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:2"));
pt2.setActive(true); pt2.setActive(true);
myPatientDao.create(pt2, mySrd).getId().toUnqualifiedVersionless(); myPatientDao.create(pt2, mySrd).getId().toUnqualifiedVersionless();
@ -147,7 +148,7 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test {
when(mySrd.getRequestId()).thenReturn(requestId); when(mySrd.getRequestId()).thenReturn(requestId);
Patient pt0 = new Patient(); Patient pt0 = new Patient();
pt0.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:0")); pt0.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:0"));
pt0.setActive(true); pt0.setActive(true);
IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless(); IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless();
@ -165,19 +166,19 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test {
public void testSourceNotPreservedAcrossUpdate() { public void testSourceNotPreservedAcrossUpdate() {
Patient pt0 = new Patient(); Patient pt0 = new Patient();
pt0.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:0")); pt0.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:0"));
pt0.setActive(true); pt0.setActive(true);
IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless(); IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless();
pt0 = myPatientDao.read(pt0id); pt0 = myPatientDao.read(pt0id);
assertEquals("urn:source:0", pt0.getMeta().getExtensionString(Constants.EXT_META_SOURCE)); assertEquals("urn:source:0", pt0.getMeta().getExtensionString(HapiExtensions.EXT_META_SOURCE));
pt0.getMeta().getExtension().clear(); pt0.getMeta().getExtension().clear();
pt0.setActive(false); pt0.setActive(false);
myPatientDao.update(pt0); myPatientDao.update(pt0);
pt0 = myPatientDao.read(pt0id.withVersion("2")); pt0 = myPatientDao.read(pt0id.withVersion("2"));
assertEquals(null, pt0.getMeta().getExtensionString(Constants.EXT_META_SOURCE)); assertEquals(null, pt0.getMeta().getExtensionString(HapiExtensions.EXT_META_SOURCE));
} }
@ -187,19 +188,19 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test {
when(mySrd.getRequestId()).thenReturn("0000000000000000"); when(mySrd.getRequestId()).thenReturn("0000000000000000");
Patient pt0 = new Patient(); Patient pt0 = new Patient();
pt0.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:0")); pt0.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:0"));
pt0.setActive(true); pt0.setActive(true);
IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless(); IIdType pt0id = myPatientDao.create(pt0, mySrd).getId().toUnqualifiedVersionless();
pt0 = myPatientDao.read(pt0id); pt0 = myPatientDao.read(pt0id);
assertEquals(null, pt0.getMeta().getExtensionString(Constants.EXT_META_SOURCE)); assertEquals(null, pt0.getMeta().getExtensionString(HapiExtensions.EXT_META_SOURCE));
pt0.getMeta().addExtension(Constants.EXT_META_SOURCE, new StringType("urn:source:1")); pt0.getMeta().addExtension(HapiExtensions.EXT_META_SOURCE, new StringType("urn:source:1"));
pt0.setActive(false); pt0.setActive(false);
myPatientDao.update(pt0); myPatientDao.update(pt0);
pt0 = myPatientDao.read(pt0id.withVersion("2")); pt0 = myPatientDao.read(pt0id.withVersion("2"));
assertEquals(null, pt0.getMeta().getExtensionString(Constants.EXT_META_SOURCE)); assertEquals(null, pt0.getMeta().getExtensionString(HapiExtensions.EXT_META_SOURCE));
// Search without source param // Search without source param
SearchParameterMap params = new SearchParameterMap(); SearchParameterMap params = new SearchParameterMap();

View File

@ -17,7 +17,6 @@ import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri;
import ca.uhn.fhir.jpa.model.entity.ResourceLink; import ca.uhn.fhir.jpa.model.entity.ResourceLink;
import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
@ -51,6 +50,7 @@ import ca.uhn.fhir.rest.param.UriParam;
import ca.uhn.fhir.rest.param.UriParamQualifierEnum; import ca.uhn.fhir.rest.param.UriParamQualifierEnum;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException; import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
import ca.uhn.fhir.util.HapiExtensions;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -4842,7 +4842,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
sp.setCode("code"); sp.setCode("code");
sp.setExpression("Observation.code"); sp.setExpression("Observation.code");
sp.addExtension() sp.addExtension()
.setUrl(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING) .setUrl(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
ourLog.info("SP:\n{}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(sp)); ourLog.info("SP:\n{}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(sp));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);

View File

@ -11,7 +11,6 @@ import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl; import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl;
import ca.uhn.fhir.jpa.searchparam.JpaRuntimeSearchParam; import ca.uhn.fhir.jpa.searchparam.JpaRuntimeSearchParam;
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.jpa.util.SpringObjectCaster; import ca.uhn.fhir.jpa.util.SpringObjectCaster;
@ -22,6 +21,7 @@ import ca.uhn.fhir.rest.param.TokenAndListParam;
import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException; import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.*; import org.hl7.fhir.r4.model.*;
@ -140,7 +140,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
.setExpression("Patient") .setExpression("Patient")
.setDefinition("SearchParameter/patient-birthdate"); .setDefinition("SearchParameter/patient-birthdate");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);
@ -182,7 +182,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
.setExpression("Coverage") .setExpression("Coverage")
.setDefinition("/SearchParameter/coverage-identifier"); .setDefinition("/SearchParameter/coverage-identifier");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);
mySearchParamRegistry.forceRefresh(); mySearchParamRegistry.forceRefresh();
@ -210,7 +210,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
.setExpression("Observation") .setExpression("Observation")
.setDefinition("/SearchParameter/observation-subject"); .setDefinition("/SearchParameter/observation-subject");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);
mySearchParamRegistry.forceRefresh(); mySearchParamRegistry.forceRefresh();
@ -238,7 +238,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
.setExpression("Patient") .setExpression("Patient")
.setDefinition("/SearchParameter/patient-identifier"); .setDefinition("/SearchParameter/patient-identifier");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);
mySearchParamRegistry.forceRefresh(); mySearchParamRegistry.forceRefresh();
@ -266,7 +266,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
.setExpression("Patient") .setExpression("Patient")
.setDefinition("/SearchParameter/patient-identifier"); .setDefinition("/SearchParameter/patient-identifier");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);
mySearchParamRegistry.forceRefresh(); mySearchParamRegistry.forceRefresh();
@ -303,7 +303,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
.setExpression("Patient") .setExpression("Patient")
.setDefinition("SearchParameter/patient-organization"); .setDefinition("SearchParameter/patient-organization");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);
@ -355,7 +355,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
.setExpression("Observation") .setExpression("Observation")
.setDefinition("SearchParameter/obs-code"); .setDefinition("SearchParameter/obs-code");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);
@ -487,7 +487,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
.setExpression("ServiceRequest") .setExpression("ServiceRequest")
.setDefinition(identifierParamId); // SearchParameter?base=ServiceRequest&name=identifier .setDefinition(identifierParamId); // SearchParameter?base=ServiceRequest&name=identifier
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.create(sp); mySearchParameterDao.create(sp);
mySearchParamRegistry.forceRefresh(); mySearchParamRegistry.forceRefresh();

View File

@ -1,6 +1,5 @@
package ca.uhn.fhir.jpa.dao.r4; package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.Hook;
import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor;
@ -8,7 +7,6 @@ import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.entity.PartitionEntity; import ca.uhn.fhir.jpa.entity.PartitionEntity;
import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ForcedId; import ca.uhn.fhir.jpa.model.entity.ForcedId;
@ -22,7 +20,6 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.entity.ResourceTag; import ca.uhn.fhir.jpa.model.entity.ResourceTag;
import ca.uhn.fhir.jpa.model.entity.SearchParamPresent; import ca.uhn.fhir.jpa.model.entity.SearchParamPresent;
import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc; import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc;
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.util.SqlQuery; import ca.uhn.fhir.jpa.util.SqlQuery;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
@ -40,7 +37,7 @@ import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.test.utilities.ITestDataBuilder; import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
@ -69,7 +66,6 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collector;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static ca.uhn.fhir.jpa.util.TestUtil.sleepAtLeast; import static ca.uhn.fhir.jpa.util.TestUtil.sleepAtLeast;
@ -2397,7 +2393,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
.setExpression("Patient") .setExpression("Patient")
.setDefinition("SearchParameter/patient-birthdate"); .setDefinition("SearchParameter/patient-birthdate");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);

View File

@ -11,13 +11,13 @@ import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.searchparam.JpaRuntimeSearchParam; import ca.uhn.fhir.jpa.searchparam.JpaRuntimeSearchParam;
import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor; import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor;
import ca.uhn.fhir.jpa.searchparam.extractor.PathAndRef; import ca.uhn.fhir.jpa.searchparam.extractor.PathAndRef;
import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorR4; import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorR4;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.BooleanType;
@ -123,7 +123,7 @@ public class SearchParamExtractorR4Test {
public void testTokenText_DisabledInSearchParam_Coding() { public void testTokenText_DisabledInSearchParam_Coding() {
RuntimeSearchParam existingCodeSp = mySearchParamRegistry.getActiveSearchParams("Observation").get("code"); RuntimeSearchParam existingCodeSp = mySearchParamRegistry.getActiveSearchParams("Observation").get("code");
RuntimeSearchParam codeSearchParam = new RuntimeSearchParam(existingCodeSp); RuntimeSearchParam codeSearchParam = new RuntimeSearchParam(existingCodeSp);
codeSearchParam.addExtension(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new Extension(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new BooleanType(true))); codeSearchParam.addExtension(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new Extension(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new BooleanType(true)));
mySearchParamRegistry.addSearchParam(codeSearchParam); mySearchParamRegistry.addSearchParam(codeSearchParam);
Observation obs = new Observation(); Observation obs = new Observation();
@ -176,7 +176,7 @@ public class SearchParamExtractorR4Test {
RuntimeSearchParam existingCodeSp = mySearchParamRegistry.getActiveSearchParams("Observation").get("code"); RuntimeSearchParam existingCodeSp = mySearchParamRegistry.getActiveSearchParams("Observation").get("code");
RuntimeSearchParam codeSearchParam = new RuntimeSearchParam(existingCodeSp); RuntimeSearchParam codeSearchParam = new RuntimeSearchParam(existingCodeSp);
codeSearchParam.addExtension(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new Extension(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new BooleanType(false))); codeSearchParam.addExtension(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new Extension(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new BooleanType(false)));
mySearchParamRegistry.addSearchParam(codeSearchParam); mySearchParamRegistry.addSearchParam(codeSearchParam);
Observation obs = new Observation(); Observation obs = new Observation();
@ -230,7 +230,7 @@ public class SearchParamExtractorR4Test {
public void testTokenText_DisabledInSearchParam_Identifier() { public void testTokenText_DisabledInSearchParam_Identifier() {
RuntimeSearchParam existingCodeSp = mySearchParamRegistry.getActiveSearchParams("Observation").get("identifier"); RuntimeSearchParam existingCodeSp = mySearchParamRegistry.getActiveSearchParams("Observation").get("identifier");
RuntimeSearchParam codeSearchParam = new RuntimeSearchParam(existingCodeSp); RuntimeSearchParam codeSearchParam = new RuntimeSearchParam(existingCodeSp);
codeSearchParam.addExtension(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new Extension(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new BooleanType(true))); codeSearchParam.addExtension(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new Extension(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING, new BooleanType(true)));
mySearchParamRegistry.addSearchParam(codeSearchParam); mySearchParamRegistry.addSearchParam(codeSearchParam);

View File

@ -32,6 +32,7 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.rest.server.interceptor.BaseValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.BaseValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.util.UrlUtil; import ca.uhn.fhir.util.UrlUtil;
import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.IValidatorModule;
@ -4042,7 +4043,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
{ {
Patient readPatient = (Patient) ourClient.read().resource("Patient").withId(patientid).execute(); Patient readPatient = (Patient) ourClient.read().resource("Patient").withId(patientid).execute();
assertThat(readPatient.getMeta().getExtensionString(Constants.EXT_META_SOURCE), matchesPattern("#[a-zA-Z0-9]+")); assertThat(readPatient.getMeta().getExtensionString(HapiExtensions.EXT_META_SOURCE), matchesPattern("#[a-zA-Z0-9]+"));
} }
patient.setId(patientid); patient.setId(patientid);
@ -4050,12 +4051,12 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
ourClient.update().resource(patient).execute(); ourClient.update().resource(patient).execute();
{ {
Patient readPatient = (Patient) ourClient.read().resource("Patient").withId(patientid).execute(); Patient readPatient = (Patient) ourClient.read().resource("Patient").withId(patientid).execute();
assertThat(readPatient.getMeta().getExtensionString(Constants.EXT_META_SOURCE), matchesPattern("#[a-zA-Z0-9]+")); assertThat(readPatient.getMeta().getExtensionString(HapiExtensions.EXT_META_SOURCE), matchesPattern("#[a-zA-Z0-9]+"));
readPatient.addName().setFamily("testUpdateWithSource"); readPatient.addName().setFamily("testUpdateWithSource");
ourClient.update().resource(readPatient).execute(); ourClient.update().resource(readPatient).execute();
readPatient = (Patient) ourClient.read().resource("Patient").withId(patientid).execute(); readPatient = (Patient) ourClient.read().resource("Patient").withId(patientid).execute();
assertThat(readPatient.getMeta().getExtensionString(Constants.EXT_META_SOURCE), matchesPattern("#[a-zA-Z0-9]+")); assertThat(readPatient.getMeta().getExtensionString(HapiExtensions.EXT_META_SOURCE), matchesPattern("#[a-zA-Z0-9]+"));
} }
} }

View File

@ -10,6 +10,7 @@ import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.util.HapiExtensions;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
@ -208,7 +209,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(15, attachment.getSize()); assertEquals(15, attachment.getSize());
assertEquals(null, attachment.getData()); assertEquals(null, attachment.getData());
assertEquals("2", ref.getMeta().getVersionId()); assertEquals("2", ref.getMeta().getVersionId());
attachmentId = attachment.getDataElement().getExtensionString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); attachmentId = attachment.getDataElement().getExtensionString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}")); assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}"));
} }
@ -266,7 +267,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(15, attachment.getSize()); assertEquals(15, attachment.getSize());
assertEquals(null, attachment.getData()); assertEquals(null, attachment.getData());
assertEquals("2", ref.getMeta().getVersionId()); assertEquals("2", ref.getMeta().getVersionId());
attachmentId = attachment.getDataElement().getExtensionString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); attachmentId = attachment.getDataElement().getExtensionString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}")); assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}"));
} }
@ -301,7 +302,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
dr.addContent() dr.addContent()
.getAttachment() .getAttachment()
.getDataElement() .getDataElement()
.addExtension(JpaConstants.EXT_EXTERNALIZED_BINARY_ID, new StringType("0000-1111") ); .addExtension(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID, new StringType("0000-1111") );
try { try {
ourClient.create().resource(dr).execute(); ourClient.create().resource(dr).execute();
@ -347,7 +348,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(4, attachment.getSize()); assertEquals(4, attachment.getSize());
assertArrayEquals(SOME_BYTES_2, attachment.getData()); assertArrayEquals(SOME_BYTES_2, attachment.getData());
assertEquals("2", ref.getMeta().getVersionId()); assertEquals("2", ref.getMeta().getVersionId());
attachmentId = attachment.getExtensionString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); attachmentId = attachment.getExtensionString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
assertEquals(null, attachmentId); assertEquals(null, attachmentId);
} }
@ -397,7 +398,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(ContentType.IMAGE_JPEG.getMimeType(), target.getContentType()); assertEquals(ContentType.IMAGE_JPEG.getMimeType(), target.getContentType());
assertEquals(null, target.getData()); assertEquals(null, target.getData());
assertEquals("2", target.getMeta().getVersionId()); assertEquals("2", target.getMeta().getVersionId());
attachmentId = target.getDataElement().getExtensionString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); attachmentId = target.getDataElement().getExtensionString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}")); assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}"));
} }
@ -458,7 +459,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(ContentType.IMAGE_JPEG.getMimeType(), target.getContentType()); assertEquals(ContentType.IMAGE_JPEG.getMimeType(), target.getContentType());
assertEquals(null, target.getData()); assertEquals(null, target.getData());
assertEquals("2", target.getMeta().getVersionId()); assertEquals("2", target.getMeta().getVersionId());
attachmentId = target.getDataElement().getExtensionString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); attachmentId = target.getDataElement().getExtensionString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}")); assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}"));
} }
@ -522,7 +523,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
String response = IOUtils.toString(resp.getEntity().getContent(), Constants.CHARSET_UTF8); String response = IOUtils.toString(resp.getEntity().getContent(), Constants.CHARSET_UTF8);
DocumentReference ref = myFhirCtx.newJsonParser().parseResource(DocumentReference.class, response); DocumentReference ref = myFhirCtx.newJsonParser().parseResource(DocumentReference.class, response);
Attachment attachment = ref.getContentFirstRep().getAttachment(); Attachment attachment = ref.getContentFirstRep().getAttachment();
attachmentId = attachment.getDataElement().getExtensionString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); attachmentId = attachment.getDataElement().getExtensionString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}")); assertThat(attachmentId, matchesPattern("[a-zA-Z0-9]{100}"));
} }

View File

@ -5,8 +5,8 @@ import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor; import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc;
import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.util.HapiExtensions;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.DocumentReference; import org.hl7.fhir.r4.model.DocumentReference;
@ -74,7 +74,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
IIdType id = outcome.getId().toUnqualifiedVersionless(); IIdType id = outcome.getId().toUnqualifiedVersionless();
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource()); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource());
ourLog.info("Encoded: {}", encoded); ourLog.info("Encoded: {}", encoded);
assertThat(encoded, containsString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID)); assertThat(encoded, containsString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID));
assertThat(encoded, not(containsString("\"data\""))); assertThat(encoded, not(containsString("\"data\"")));
// Now read it back and make sure it was de-externalized // Now read it back and make sure it was de-externalized
@ -98,7 +98,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
IIdType id = outcome.getId().toUnqualifiedVersionless(); IIdType id = outcome.getId().toUnqualifiedVersionless();
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource()); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource());
ourLog.info("Encoded: {}", encoded); ourLog.info("Encoded: {}", encoded);
assertThat(encoded, containsString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID)); assertThat(encoded, containsString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID));
assertThat(encoded, not(containsString("\"data\""))); assertThat(encoded, not(containsString("\"data\"")));
// Now read it back and make sure it was de-externalized // Now read it back and make sure it was de-externalized
@ -123,7 +123,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource()); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource());
ourLog.info("Encoded: {}", encoded); ourLog.info("Encoded: {}", encoded);
assertThat(encoded, containsString("\"data\": \"BAMCAQ==\"")); assertThat(encoded, containsString("\"data\": \"BAMCAQ==\""));
assertThat(encoded, not(containsString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID))); assertThat(encoded, not(containsString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID)));
// Now read it back and make sure it was de-externalized // Now read it back and make sure it was de-externalized
Binary output = myBinaryDao.read(id, mySrd); Binary output = myBinaryDao.read(id, mySrd);
@ -146,14 +146,14 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
IIdType id = outcome.getId().toUnqualifiedVersionless(); IIdType id = outcome.getId().toUnqualifiedVersionless();
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource()); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource());
ourLog.info("Encoded: {}", encoded); ourLog.info("Encoded: {}", encoded);
assertThat(encoded, containsString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID)); assertThat(encoded, containsString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID));
assertThat(encoded, not(containsString("\"data\""))); assertThat(encoded, not(containsString("\"data\"")));
// Now read it back and make sure it was de-externalized // Now read it back and make sure it was de-externalized
Binary output = myBinaryDao.read(id, mySrd); Binary output = myBinaryDao.read(id, mySrd);
assertEquals("application/octet-stream", output.getContentType()); assertEquals("application/octet-stream", output.getContentType());
assertArrayEquals(SOME_BYTES, output.getData()); assertArrayEquals(SOME_BYTES, output.getData());
assertNotNull(output.getDataElement().getExtensionByUrl(JpaConstants.EXT_EXTERNALIZED_BINARY_ID).getValue()); assertNotNull(output.getDataElement().getExtensionByUrl(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID).getValue());
} }
@ -171,7 +171,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
IIdType id = outcome.getId().toUnqualifiedVersionless(); IIdType id = outcome.getId().toUnqualifiedVersionless();
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource()); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource());
ourLog.info("Encoded: {}", encoded); ourLog.info("Encoded: {}", encoded);
assertThat(encoded, containsString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID)); assertThat(encoded, containsString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID));
assertThat(encoded, not(containsString("\"data\""))); assertThat(encoded, not(containsString("\"data\"")));
// Now update // Now update
@ -212,9 +212,9 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
IIdType id = outcome.getId().toUnqualifiedVersionless(); IIdType id = outcome.getId().toUnqualifiedVersionless();
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource()); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource());
ourLog.info("Encoded: {}", encoded); ourLog.info("Encoded: {}", encoded);
assertThat(encoded, containsString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID)); assertThat(encoded, containsString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID));
assertThat(encoded, not(containsString("\"data\""))); assertThat(encoded, not(containsString("\"data\"")));
String binaryId = docRef.getContentFirstRep().getAttachment().getDataElement().getExtensionString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); String binaryId = docRef.getContentFirstRep().getAttachment().getDataElement().getExtensionString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
assertThat(binaryId, not(blankOrNullString())); assertThat(binaryId, not(blankOrNullString()));
// Now update // Now update
@ -223,7 +223,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
docRef.setStatus(Enumerations.DocumentReferenceStatus.CURRENT); docRef.setStatus(Enumerations.DocumentReferenceStatus.CURRENT);
docRef.getContentFirstRep().getAttachment().setContentType("application/octet-stream"); docRef.getContentFirstRep().getAttachment().setContentType("application/octet-stream");
docRef.getContentFirstRep().getAttachment().getDataElement().addExtension( docRef.getContentFirstRep().getAttachment().getDataElement().addExtension(
JpaConstants.EXT_EXTERNALIZED_BINARY_ID, HapiExtensions.EXT_EXTERNALIZED_BINARY_ID,
new StringType(binaryId) new StringType(binaryId)
); );
outcome = myDocumentReferenceDao.update(docRef, mySrd); outcome = myDocumentReferenceDao.update(docRef, mySrd);
@ -259,9 +259,9 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
IIdType id = outcome.getId().toUnqualifiedVersionless(); IIdType id = outcome.getId().toUnqualifiedVersionless();
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource()); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource());
ourLog.info("Encoded: {}", encoded); ourLog.info("Encoded: {}", encoded);
assertThat(encoded, containsString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID)); assertThat(encoded, containsString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID));
assertThat(encoded, not(containsString("\"data\""))); assertThat(encoded, not(containsString("\"data\"")));
String binaryId = docRef.getContentFirstRep().getAttachment().getDataElement().getExtensionString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID); String binaryId = docRef.getContentFirstRep().getAttachment().getDataElement().getExtensionString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID);
assertThat(binaryId, not(blankOrNullString())); assertThat(binaryId, not(blankOrNullString()));
// Now update // Now update
@ -271,13 +271,13 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
content = docRef.addContent(); content = docRef.addContent();
content.getAttachment().setContentType("application/octet-stream"); content.getAttachment().setContentType("application/octet-stream");
content.getAttachment().getDataElement().addExtension( content.getAttachment().getDataElement().addExtension(
JpaConstants.EXT_EXTERNALIZED_BINARY_ID, HapiExtensions.EXT_EXTERNALIZED_BINARY_ID,
new StringType(binaryId) new StringType(binaryId)
); );
content2 = docRef.addContent(); content2 = docRef.addContent();
content2.getAttachment().setContentType("application/octet-stream"); content2.getAttachment().setContentType("application/octet-stream");
content2.getAttachment().getDataElement().addExtension( content2.getAttachment().getDataElement().addExtension(
JpaConstants.EXT_EXTERNALIZED_BINARY_ID, HapiExtensions.EXT_EXTERNALIZED_BINARY_ID,
new StringType("12345-67890") new StringType("12345-67890")
); );
@ -305,14 +305,14 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test {
IIdType id = outcome.getId().toUnqualifiedVersionless(); IIdType id = outcome.getId().toUnqualifiedVersionless();
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource()); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getResource());
ourLog.info("Encoded: {}", encoded); ourLog.info("Encoded: {}", encoded);
assertThat(encoded, containsString(JpaConstants.EXT_EXTERNALIZED_BINARY_ID)); assertThat(encoded, containsString(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID));
assertThat(encoded, not(containsString("\"data\""))); assertThat(encoded, not(containsString("\"data\"")));
// Now read it back and make sure it was de-externalized // Now read it back and make sure it was de-externalized
Binary output = myBinaryDao.read(id, mySrd); Binary output = myBinaryDao.read(id, mySrd);
assertEquals("application/octet-stream", output.getContentType()); assertEquals("application/octet-stream", output.getContentType());
assertEquals(null, output.getData()); assertEquals(null, output.getData());
assertNotNull(output.getDataElement().getExtensionByUrl(JpaConstants.EXT_EXTERNALIZED_BINARY_ID).getValue()); assertNotNull(output.getDataElement().getExtensionByUrl(HapiExtensions.EXT_EXTERNALIZED_BINARY_ID).getValue());
} }

View File

@ -6,12 +6,12 @@ import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.dao.data.ISearchDao;
import ca.uhn.fhir.jpa.dao.data.ISearchResultDao; import ca.uhn.fhir.jpa.dao.data.ISearchResultDao;
import ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider; import ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider;
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
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;
@ -104,7 +104,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
.setExpression("Patient") .setExpression("Patient")
.setDefinition("SearchParameter/patient-birthdate"); .setDefinition("SearchParameter/patient-birthdate");
sp.addExtension() sp.addExtension()
.setUrl(SearchParamConstants.EXT_SP_UNIQUE) .setUrl(HapiExtensions.EXT_SP_UNIQUE)
.setValue(new BooleanType(true)); .setValue(new BooleanType(true));
mySearchParameterDao.update(sp); mySearchParameterDao.update(sp);

View File

@ -1,10 +1,10 @@
package ca.uhn.fhir.jpa.subscription.email; package ca.uhn.fhir.jpa.subscription.email;
import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil; import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.util.HapiExtensions;
import com.icegreen.greenmail.store.FolderException; import com.icegreen.greenmail.store.FolderException;
import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.ServerSetup; import com.icegreen.greenmail.util.ServerSetup;
@ -166,10 +166,10 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
Assert.assertNotNull(subscriptionTemp); Assert.assertNotNull(subscriptionTemp);
subscriptionTemp.getChannel().addExtension() subscriptionTemp.getChannel().addExtension()
.setUrl(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM) .setUrl(HapiExtensions.EXT_SUBSCRIPTION_EMAIL_FROM)
.setValue(new StringType("mailto:myfrom@from.com")); .setValue(new StringType("mailto:myfrom@from.com"));
subscriptionTemp.getChannel().addExtension() subscriptionTemp.getChannel().addExtension()
.setUrl(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE) .setUrl(HapiExtensions.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE)
.setValue(new StringType("This is a subject")); .setValue(new StringType("This is a subject"));
subscriptionTemp.setIdElement(subscriptionTemp.getIdElement().toUnqualifiedVersionless()); subscriptionTemp.setIdElement(subscriptionTemp.getIdElement().toUnqualifiedVersionless());
@ -220,10 +220,10 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
Subscription subscriptionTemp = ourClient.read(Subscription.class, sub1.getId()); Subscription subscriptionTemp = ourClient.read(Subscription.class, sub1.getId());
Assert.assertNotNull(subscriptionTemp); Assert.assertNotNull(subscriptionTemp);
subscriptionTemp.getChannel().addExtension() subscriptionTemp.getChannel().addExtension()
.setUrl(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM) .setUrl(HapiExtensions.EXT_SUBSCRIPTION_EMAIL_FROM)
.setValue(new StringType("myfrom@from.com")); .setValue(new StringType("myfrom@from.com"));
subscriptionTemp.getChannel().addExtension() subscriptionTemp.getChannel().addExtension()
.setUrl(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE) .setUrl(HapiExtensions.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE)
.setValue(new StringType("This is a subject")); .setValue(new StringType("This is a subject"));
subscriptionTemp.setIdElement(subscriptionTemp.getIdElement().toUnqualifiedVersionless()); subscriptionTemp.setIdElement(subscriptionTemp.getIdElement().toUnqualifiedVersionless());

View File

@ -3,7 +3,6 @@ package ca.uhn.fhir.jpa.subscription.resthook;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
import ca.uhn.fhir.jpa.subscription.NotificationServlet; import ca.uhn.fhir.jpa.subscription.NotificationServlet;
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil; import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
@ -18,6 +17,7 @@ import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.fhir.test.utilities.JettyUtil;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.MetaUtil; import ca.uhn.fhir.util.MetaUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
@ -158,7 +158,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
String databaseCriteria = "Observation?code=17861-6&context.type=IHD"; String databaseCriteria = "Observation?code=17861-6&context.type=IHD";
Subscription subscription = createSubscription(databaseCriteria, null, ourNotificationListenerServer); Subscription subscription = createSubscription(databaseCriteria, null, ourNotificationListenerServer);
List<Coding> tag = subscription.getMeta().getTag(); List<Coding> tag = subscription.getMeta().getTag();
assertEquals(JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.get(0).getSystem()); assertEquals(HapiExtensions.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.get(0).getSystem());
assertEquals(SubscriptionMatchingStrategy.DATABASE.toString(), tag.get(0).getCode()); assertEquals(SubscriptionMatchingStrategy.DATABASE.toString(), tag.get(0).getCode());
} }
@ -168,7 +168,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
Subscription subscription = createSubscription(inMemoryCriteria, null, ourNotificationListenerServer); Subscription subscription = createSubscription(inMemoryCriteria, null, ourNotificationListenerServer);
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(subscription)); ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(subscription));
List<Coding> tag = subscription.getMeta().getTag(); List<Coding> tag = subscription.getMeta().getTag();
assertEquals(JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.get(0).getSystem()); assertEquals(HapiExtensions.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.get(0).getSystem());
assertEquals(SubscriptionMatchingStrategy.IN_MEMORY.toString(), tag.get(0).getCode()); assertEquals(SubscriptionMatchingStrategy.IN_MEMORY.toString(), tag.get(0).getCode());
} }
@ -497,7 +497,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
List<Coding> tags = subscriptionOrig.getMeta().getTag(); List<Coding> tags = subscriptionOrig.getMeta().getTag();
assertEquals(1, tags.size()); assertEquals(1, tags.size());
Coding tag = tags.get(0); Coding tag = tags.get(0);
assertEquals(JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.getSystem()); assertEquals(HapiExtensions.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.getSystem());
assertEquals(SubscriptionMatchingStrategy.IN_MEMORY.toString(), tag.getCode()); assertEquals(SubscriptionMatchingStrategy.IN_MEMORY.toString(), tag.getCode());
assertEquals("In-memory", tag.getDisplay()); assertEquals("In-memory", tag.getDisplay());
@ -515,7 +515,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
tags = theSubscription.getMeta().getTag(); tags = theSubscription.getMeta().getTag();
assertEquals(1, tags.size()); assertEquals(1, tags.size());
tag = tags.get(0); tag = tags.get(0);
assertEquals(JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.getSystem()); assertEquals(HapiExtensions.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.getSystem());
assertEquals(SubscriptionMatchingStrategy.IN_MEMORY.toString(), tag.getCode()); assertEquals(SubscriptionMatchingStrategy.IN_MEMORY.toString(), tag.getCode());
assertEquals("In-memory", tag.getDisplay()); assertEquals("In-memory", tag.getDisplay());
} }
@ -530,7 +530,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
List<Coding> tags = subscriptionOrig.getMeta().getTag(); List<Coding> tags = subscriptionOrig.getMeta().getTag();
assertEquals(1, tags.size()); assertEquals(1, tags.size());
Coding tag = tags.get(0); Coding tag = tags.get(0);
assertEquals(JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.getSystem()); assertEquals(HapiExtensions.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.getSystem());
assertEquals(SubscriptionMatchingStrategy.DATABASE.toString(), tag.getCode()); assertEquals(SubscriptionMatchingStrategy.DATABASE.toString(), tag.getCode());
assertEquals("Database", tag.getDisplay()); assertEquals("Database", tag.getDisplay());
@ -542,7 +542,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
tags = subscription.getMeta().getTag(); tags = subscription.getMeta().getTag();
assertEquals(1, tags.size()); assertEquals(1, tags.size());
tag = tags.get(0); tag = tags.get(0);
assertEquals(JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.getSystem()); assertEquals(HapiExtensions.EXT_SUBSCRIPTION_MATCHING_STRATEGY, tag.getSystem());
assertEquals(SubscriptionMatchingStrategy.DATABASE.toString(), tag.getCode()); assertEquals(SubscriptionMatchingStrategy.DATABASE.toString(), tag.getCode());
assertEquals("Database", tag.getDisplay()); assertEquals("Database", tag.getDisplay());
} }

View File

@ -1,12 +1,12 @@
package ca.uhn.fhir.jpa.subscription.resthook; package ca.uhn.fhir.jpa.subscription.resthook;
import ca.uhn.fhir.jpa.config.StoppableSubscriptionDeliveringRestHookSubscriber; import ca.uhn.fhir.jpa.config.StoppableSubscriptionDeliveringRestHookSubscriber;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test; import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test;
import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.util.HapiExtensions;
import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.*; import org.hl7.fhir.r4.model.*;
@ -337,7 +337,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
subscription1 subscription1
.getChannel() .getChannel()
.addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true")); .addExtension(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true"));
ourLog.info("** About to update subscription"); ourLog.info("** About to update subscription");
int modCount = (int) myCountingInterceptor.getSentCount("Subscription"); int modCount = (int) myCountingInterceptor.getSentCount("Subscription");
@ -413,7 +413,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
Subscription subscription = newSubscription(criteria1, payload); Subscription subscription = newSubscription(criteria1, payload);
subscription subscription
.getChannel() .getChannel()
.addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION, new BooleanType("true")); .addExtension(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION, new BooleanType("true"));
ourClient.create().resource(subscription).execute(); ourClient.create().resource(subscription).execute();
waitForActivatedSubscriptionCount(1); waitForActivatedSubscriptionCount(1);
@ -1017,7 +1017,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test {
public void testDeliverSearchResult() throws Exception { public void testDeliverSearchResult() throws Exception {
{ {
Subscription subscription = newSubscription("Observation?", "application/json"); Subscription subscription = newSubscription("Observation?", "application/json");
subscription.addExtension(JpaConstants.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_RESULT, new StringType("Observation?_id=${matched_resource_id}&_include=*")); subscription.addExtension(HapiExtensions.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_CRITERIA, new StringType("Observation?_id=${matched_resource_id}&_include=*"));
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(subscription)); ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(subscription));
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
mySubscriptionIds.add(methodOutcome.getId()); mySubscriptionIds.add(methodOutcome.getId());

View File

@ -1,12 +1,12 @@
package ca.uhn.fhir.jpa.subscription.resthook; package ca.uhn.fhir.jpa.subscription.resthook;
import ca.uhn.fhir.jpa.config.StoppableSubscriptionDeliveringRestHookSubscriber; import ca.uhn.fhir.jpa.config.StoppableSubscriptionDeliveringRestHookSubscriber;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR5Test; import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR5Test;
import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.util.HapiExtensions;
import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.r5.model.*; import org.hl7.fhir.r5.model.*;
import org.junit.After; import org.junit.After;
@ -299,7 +299,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
assertEquals(observation1.getIdElement().getVersionIdPart(), idElement.getVersionIdPart()); assertEquals(observation1.getIdElement().getVersionIdPart(), idElement.getVersionIdPart());
subscription1 subscription1
.addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true")); .addExtension(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS, new BooleanType("true"));
ourLog.info("** About to update subscription"); ourLog.info("** About to update subscription");
int modCount = myCountingInterceptor.getSentCount("Subscription"); int modCount = myCountingInterceptor.getSentCount("Subscription");
@ -375,7 +375,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscription = newSubscription(criteria1, payload); Subscription subscription = newSubscription(criteria1, payload);
subscription subscription
.addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION, new BooleanType("true")); .addExtension(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION, new BooleanType("true"));
ourClient.create().resource(subscription).execute(); ourClient.create().resource(subscription).execute();
waitForActivatedSubscriptionCount(1); waitForActivatedSubscriptionCount(1);

View File

@ -10,9 +10,9 @@ import ca.uhn.fhir.jpa.entity.TermValueSetConcept;
import ca.uhn.fhir.jpa.entity.TermValueSetConceptDesignation; import ca.uhn.fhir.jpa.entity.TermValueSetConceptDesignation;
import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum; import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum;
import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.term.custom.CustomTerminologySet; import ca.uhn.fhir.jpa.term.custom.CustomTerminologySet;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.util.HapiExtensions;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.CodeSystem; import org.hl7.fhir.r4.model.CodeSystem;
@ -796,7 +796,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test {
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info(encoded); ourLog.info(encoded);
Extension extensionByUrl = outcome.getExpansion().getExtensionByUrl(JpaConstants.EXT_VALUESET_EXPANSION_MESSAGE); Extension extensionByUrl = outcome.getExpansion().getExtensionByUrl(HapiExtensions.EXT_VALUESET_EXPANSION_MESSAGE);
assertEquals("Unknown CodeSystem URI \"http://unknown-system\" referenced from ValueSet", extensionByUrl.getValueAsPrimitive().getValueAsString()); assertEquals("Unknown CodeSystem URI \"http://unknown-system\" referenced from ValueSet", extensionByUrl.getValueAsPrimitive().getValueAsString());
} }

View File

@ -166,66 +166,6 @@ public class JpaConstants {
*/ */
public static final String OPERATION_LASTN = "$lastn"; public static final String OPERATION_LASTN = "$lastn";
/**
* <p>
* This extension should be of type <code>string</code> and should be
* placed on the <code>Subscription.channel</code> element
* </p>
*/
public static final String EXT_SUBSCRIPTION_SUBJECT_TEMPLATE = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-subject-template";
/**
* This extension URL indicates whether a REST HOOK delivery should
* include the version ID when delivering.
* <p>
* This extension should be of type <code>boolean</code> and should be
* placed on the <code>Subscription.channel</code> element.
* </p>
*/
public static final String EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS = "http://hapifhir.io/fhir/StructureDefinition/subscription-resthook-strip-version-ids";
/**
* This extension URL indicates whether a REST HOOK delivery should
* reload the resource and deliver the latest version always. This
* could be useful for example if a resource which triggers a
* subscription gets updated many times in short succession and there
* is no value in delivering the older versions.
* <p>
* Note that if the resource is now deleted, this may cause
* the delivery to be cancelled altogether.
* </p>
*
* <p>
* This extension should be of type <code>boolean</code> and should be
* placed on the <code>Subscription.channel</code> element.
* </p>
*/
public static final String EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION = "http://hapifhir.io/fhir/StructureDefinition/subscription-resthook-deliver-latest-version";
/**
* Indicate which strategy will be used to match this subscription
*/
public static final String EXT_SUBSCRIPTION_MATCHING_STRATEGY = "http://hapifhir.io/fhir/StructureDefinition/subscription-matching-strategy";
/**
* <p>
* This extension should be of type <code>string</code> and should be
* placed on the <code>Subscription.channel</code> element
* </p>
*/
public static final String EXT_SUBSCRIPTION_EMAIL_FROM = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-from";
/**
* Extension ID for external binary references
*/
public static final String EXT_EXTERNALIZED_BINARY_ID = "http://hapifhir.io/fhir/StructureDefinition/externalized-binary-id";
/**
* For subscription, deliver a bundle containing a search result instead of just a single resource
*/
public static final String EXT_SUBSCRIPTION_PAYLOAD_SEARCH_RESULT = "http://hapifhir.io/fhir/StructureDefinition/subscription-payload-search-result";
/**
* Placed in system-generated extensions
*/
public static final String EXTENSION_EXT_SYSTEMDEFINED = JpaConstants.class.getName() + "_EXTENSION_EXT_SYSTEMDEFINED";
/**
* Message added to expansion valueset
*/
public static final String EXT_VALUESET_EXPANSION_MESSAGE = "http://hapifhir.io/fhir/StructureDefinition/valueset-expansion-message";
/** /**
* Parameter for the $export operation * Parameter for the $export operation
*/ */
@ -246,11 +186,10 @@ public class JpaConstants {
* Parameter for the $export operation * Parameter for the $export operation
*/ */
public static final String PARAM_EXPORT_TYPE_FILTER = "_typeFilter"; public static final String PARAM_EXPORT_TYPE_FILTER = "_typeFilter";
/** /**
* Extension URL for extension on a SearchParameter indicating that text values should not be indexed * Placed in system-generated extensions
*/ */
public static final String EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING = "http://hapifhir.io/fhir/StructureDefinition/searchparameter-token-suppress-text-index"; public static final String EXTENSION_EXT_SYSTEMDEFINED = JpaConstants.class.getName() + "_EXTENSION_EXT_SYSTEMDEFINED";
/** /**
* Non-instantiable * Non-instantiable

View File

@ -81,7 +81,7 @@ public class MatchUrlService {
for (String nextParamName : nameToParamLists.keySet()) { for (String nextParamName : nameToParamLists.keySet()) {
List<QualifiedParamList> paramList = nameToParamLists.get(nextParamName); List<QualifiedParamList> paramList = nameToParamLists.get(nextParamName);
if (theFlags != null && theFlags.length > 0) { if (theFlags != null) {
for (Flag next : theFlags) { for (Flag next : theFlags) {
next.process(nextParamName, paramList, paramMap); next.process(nextParamName, paramList, paramMap);
} }

View File

@ -22,7 +22,5 @@ package ca.uhn.fhir.jpa.searchparam;
public class SearchParamConstants { public class SearchParamConstants {
public static final String EXT_SP_UNIQUE = "http://hapifhir.io/fhir/StructureDefinition/sp-unique";
public static final String UCUM_NS = "http://unitsofmeasure.org"; public static final String UCUM_NS = "http://unitsofmeasure.org";
} }

View File

@ -37,12 +37,12 @@ import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants; import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.model.primitive.BoundCodeDt; import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.StringUtil; import ca.uhn.fhir.util.StringUtil;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -1374,7 +1374,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
} }
public static boolean tokenTextIndexingEnabledForSearchParam(ModelConfig theModelConfig, RuntimeSearchParam theSearchParam) { public static boolean tokenTextIndexingEnabledForSearchParam(ModelConfig theModelConfig, RuntimeSearchParam theSearchParam) {
Optional<Boolean> noSuppressForSearchParam = theSearchParam.getExtensions(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING).stream() Optional<Boolean> noSuppressForSearchParam = theSearchParam.getExtensions(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING).stream()
.map(IBaseExtension::getValue) .map(IBaseExtension::getValue)
.map(val -> (IPrimitiveType<?>) val) .map(val -> (IPrimitiveType<?>) val)
.map(IPrimitiveType::getValueAsString) .map(IPrimitiveType::getValueAsString)

View File

@ -32,7 +32,6 @@ import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition; import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
import ca.uhn.fhir.jpa.searchparam.JpaRuntimeSearchParam; import ca.uhn.fhir.jpa.searchparam.JpaRuntimeSearchParam;
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.retry.Retrier; import ca.uhn.fhir.jpa.searchparam.retry.Retrier;
import ca.uhn.fhir.model.api.ExtensionDt; import ca.uhn.fhir.model.api.ExtensionDt;
@ -41,6 +40,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.util.DatatypeUtil; import ca.uhn.fhir.util.DatatypeUtil;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.SearchParameterUtil; import ca.uhn.fhir.util.SearchParameterUtil;
import ca.uhn.fhir.util.StopWatch; import ca.uhn.fhir.util.StopWatch;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
@ -412,7 +412,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry {
String uri = ""; String uri = "";
boolean unique = false; boolean unique = false;
List<ExtensionDt> uniqueExts = theNextSp.getUndeclaredExtensionsByUrl(SearchParamConstants.EXT_SP_UNIQUE); List<ExtensionDt> uniqueExts = theNextSp.getUndeclaredExtensionsByUrl(HapiExtensions.EXT_SP_UNIQUE);
if (uniqueExts.size() > 0) { if (uniqueExts.size() > 0) {
IPrimitiveType<?> uniqueExtsValuePrimitive = uniqueExts.get(0).getValueAsPrimitive(); IPrimitiveType<?> uniqueExtsValuePrimitive = uniqueExts.get(0).getValueAsPrimitive();
if (uniqueExtsValuePrimitive != null) { if (uniqueExtsValuePrimitive != null) {
@ -494,7 +494,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry {
String uri = ""; String uri = "";
boolean unique = false; boolean unique = false;
List<Extension> uniqueExts = theNextSp.getExtensionsByUrl(SearchParamConstants.EXT_SP_UNIQUE); List<Extension> uniqueExts = theNextSp.getExtensionsByUrl(HapiExtensions.EXT_SP_UNIQUE);
if (uniqueExts.size() > 0) { if (uniqueExts.size() > 0) {
IPrimitiveType<?> uniqueExtsValuePrimitive = uniqueExts.get(0).getValueAsPrimitive(); IPrimitiveType<?> uniqueExtsValuePrimitive = uniqueExts.get(0).getValueAsPrimitive();
if (uniqueExtsValuePrimitive != null) { if (uniqueExtsValuePrimitive != null) {
@ -582,7 +582,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry {
String uri = ""; String uri = "";
boolean unique = false; boolean unique = false;
List<org.hl7.fhir.r4.model.Extension> uniqueExts = theNextSp.getExtensionsByUrl(SearchParamConstants.EXT_SP_UNIQUE); List<org.hl7.fhir.r4.model.Extension> uniqueExts = theNextSp.getExtensionsByUrl(HapiExtensions.EXT_SP_UNIQUE);
if (uniqueExts.size() > 0) { if (uniqueExts.size() > 0) {
IPrimitiveType<?> uniqueExtsValuePrimitive = uniqueExts.get(0).getValueAsPrimitive(); IPrimitiveType<?> uniqueExtsValuePrimitive = uniqueExts.get(0).getValueAsPrimitive();
if (uniqueExtsValuePrimitive != null) { if (uniqueExtsValuePrimitive != null) {
@ -672,7 +672,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry {
String uri = ""; String uri = "";
boolean unique = false; boolean unique = false;
List<org.hl7.fhir.r5.model.Extension> uniqueExts = theNextSp.getExtensionsByUrl(SearchParamConstants.EXT_SP_UNIQUE); List<org.hl7.fhir.r5.model.Extension> uniqueExts = theNextSp.getExtensionsByUrl(HapiExtensions.EXT_SP_UNIQUE);
if (uniqueExts.size() > 0) { if (uniqueExts.size() > 0) {
IPrimitiveType<?> uniqueExtsValuePrimitive = uniqueExts.get(0).getValueAsPrimitive(); IPrimitiveType<?> uniqueExtsValuePrimitive = uniqueExts.get(0).getValueAsPrimitive();
if (uniqueExtsValuePrimitive != null) { if (uniqueExtsValuePrimitive != null) {

View File

@ -91,7 +91,7 @@ public class SubscriptionDeliveringRestHookSubscriber extends BaseSubscriptionDe
protected void doDelivery(ResourceDeliveryMessage theMsg, CanonicalSubscription theSubscription, EncodingEnum thePayloadType, IGenericClient theClient, IBaseResource thePayloadResource) { protected void doDelivery(ResourceDeliveryMessage theMsg, CanonicalSubscription theSubscription, EncodingEnum thePayloadType, IGenericClient theClient, IBaseResource thePayloadResource) {
IClientExecutable<?, ?> operation; IClientExecutable<?, ?> operation;
if (isNotBlank(theSubscription.getPayloadSearchResult())) { if (isNotBlank(theSubscription.getPayloadSearchCriteria())) {
operation = createDeliveryRequestTransaction(theSubscription, theClient, thePayloadResource); operation = createDeliveryRequestTransaction(theSubscription, theClient, thePayloadResource);
} else if (thePayloadType != null) { } else if (thePayloadType != null) {
operation = createDeliveryRequestNormal(theMsg, theClient, thePayloadResource); operation = createDeliveryRequestNormal(theMsg, theClient, thePayloadResource);
@ -141,11 +141,11 @@ public class SubscriptionDeliveringRestHookSubscriber extends BaseSubscriptionDe
private IClientExecutable<?, ?> createDeliveryRequestTransaction(CanonicalSubscription theSubscription, IGenericClient theClient, IBaseResource thePayloadResource) { private IClientExecutable<?, ?> createDeliveryRequestTransaction(CanonicalSubscription theSubscription, IGenericClient theClient, IBaseResource thePayloadResource) {
IClientExecutable<?, ?> operation; IClientExecutable<?, ?> operation;
String resType = theSubscription.getPayloadSearchResult().substring(0, theSubscription.getPayloadSearchResult().indexOf('?')); String resType = theSubscription.getPayloadSearchCriteria().substring(0, theSubscription.getPayloadSearchCriteria().indexOf('?'));
IFhirResourceDao<?> dao = myDaoRegistry.getResourceDao(resType); IFhirResourceDao<?> dao = myDaoRegistry.getResourceDao(resType);
RuntimeResourceDefinition resourceDefinition = myFhirContext.getResourceDefinition(resType); RuntimeResourceDefinition resourceDefinition = myFhirContext.getResourceDefinition(resType);
String payloadUrl = theSubscription.getPayloadSearchResult(); String payloadUrl = theSubscription.getPayloadSearchCriteria();
Map<String, String> valueMap = new HashMap<>(1); Map<String, String> valueMap = new HashMap<>(1);
valueMap.put("matched_resource_id", thePayloadResource.getIdElement().toUnqualifiedVersionless().getValue()); valueMap.put("matched_resource_id", thePayloadResource.getIdElement().toUnqualifiedVersionless().getValue());
payloadUrl = new StringSubstitutor(valueMap).replace(payloadUrl); payloadUrl = new StringSubstitutor(valueMap).replace(payloadUrl);

View File

@ -22,13 +22,13 @@ package ca.uhn.fhir.jpa.subscription.match.registry;
import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.model.dstu2.resource.Subscription; import ca.uhn.fhir.model.dstu2.resource.Subscription;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.util.HapiExtensions;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions; import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
@ -113,15 +113,15 @@ public class SubscriptionCanonicalizer {
retVal.setChannelExtensions(extractExtension(subscription)); retVal.setChannelExtensions(extractExtension(subscription));
retVal.setIdElement(subscription.getIdElement()); retVal.setIdElement(subscription.getIdElement());
retVal.setPayloadString(subscription.getChannel().getPayload()); retVal.setPayloadString(subscription.getChannel().getPayload());
retVal.setPayloadSearchResult(getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_RESULT)); retVal.setPayloadSearchCriteria(getExtensionString(subscription, HapiExtensions.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_CRITERIA));
if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) { if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) {
String from; String from;
String subjectTemplate; String subjectTemplate;
try { try {
from = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM); from = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_EMAIL_FROM);
subjectTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE); subjectTemplate = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE);
} catch (FHIRException theE) { } catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
} }
@ -134,8 +134,8 @@ public class SubscriptionCanonicalizer {
String stripVersionIds; String stripVersionIds;
String deliverLatestVersion; String deliverLatestVersion;
try { try {
stripVersionIds = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS); stripVersionIds = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS);
deliverLatestVersion = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION); deliverLatestVersion = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION);
} catch (FHIRException theE) { } catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
} }
@ -209,14 +209,14 @@ public class SubscriptionCanonicalizer {
retVal.setChannelExtensions(extractExtension(subscription)); retVal.setChannelExtensions(extractExtension(subscription));
retVal.setIdElement(subscription.getIdElement()); retVal.setIdElement(subscription.getIdElement());
retVal.setPayloadString(subscription.getChannel().getPayload()); retVal.setPayloadString(subscription.getChannel().getPayload());
retVal.setPayloadSearchResult(getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_RESULT)); retVal.setPayloadSearchCriteria(getExtensionString(subscription, HapiExtensions.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_CRITERIA));
if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) { if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) {
String from; String from;
String subjectTemplate; String subjectTemplate;
try { try {
from = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM); from = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_EMAIL_FROM);
subjectTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE); subjectTemplate = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE);
} catch (FHIRException theE) { } catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
} }
@ -228,8 +228,8 @@ public class SubscriptionCanonicalizer {
String stripVersionIds; String stripVersionIds;
String deliverLatestVersion; String deliverLatestVersion;
try { try {
stripVersionIds = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS); stripVersionIds = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS);
deliverLatestVersion = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION); deliverLatestVersion = subscription.getChannel().getExtensionString(HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION);
} catch (FHIRException theE) { } catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
} }
@ -263,14 +263,14 @@ public class SubscriptionCanonicalizer {
retVal.setChannelExtensions(extractExtension(subscription)); retVal.setChannelExtensions(extractExtension(subscription));
retVal.setIdElement(subscription.getIdElement()); retVal.setIdElement(subscription.getIdElement());
retVal.setPayloadString(subscription.getContentType()); retVal.setPayloadString(subscription.getContentType());
retVal.setPayloadSearchResult(getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_RESULT)); retVal.setPayloadSearchCriteria(getExtensionString(subscription, HapiExtensions.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_CRITERIA));
if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) { if (retVal.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) {
String from; String from;
String subjectTemplate; String subjectTemplate;
try { try {
from = getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM); from = getExtensionString(subscription, HapiExtensions.EXT_SUBSCRIPTION_EMAIL_FROM);
subjectTemplate = getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE); subjectTemplate = getExtensionString(subscription, HapiExtensions.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE);
} catch (FHIRException theE) { } catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
} }
@ -282,8 +282,8 @@ public class SubscriptionCanonicalizer {
String stripVersionIds; String stripVersionIds;
String deliverLatestVersion; String deliverLatestVersion;
try { try {
stripVersionIds = getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS); stripVersionIds = getExtensionString(subscription, HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_STRIP_VERSION_IDS);
deliverLatestVersion = getExtensionString(subscription, JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION); deliverLatestVersion = getExtensionString(subscription, HapiExtensions.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION);
} catch (FHIRException theE) { } catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
} }
@ -385,7 +385,7 @@ public class SubscriptionCanonicalizer {
meta meta
.getTag() .getTag()
.stream() .stream()
.filter(t -> JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY.equals(t.getSystem())) .filter(t -> HapiExtensions.EXT_SUBSCRIPTION_MATCHING_STRATEGY.equals(t.getSystem()))
.forEach(t -> { .forEach(t -> {
t.setCode(null); t.setCode(null);
t.setSystem(null); t.setSystem(null);
@ -406,7 +406,7 @@ public class SubscriptionCanonicalizer {
} else { } else {
throw new IllegalStateException("Unknown " + SubscriptionMatchingStrategy.class.getSimpleName() + ": " + theStrategy); throw new IllegalStateException("Unknown " + SubscriptionMatchingStrategy.class.getSimpleName() + ": " + theStrategy);
} }
meta.addTag().setSystem(JpaConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY).setCode(value).setDisplay(display); meta.addTag().setSystem(HapiExtensions.EXT_SUBSCRIPTION_MATCHING_STRATEGY).setCode(value).setDisplay(display);
} }
public String getSubscriptionStatus(IBaseResource theSubscription) { public String getSubscriptionStatus(IBaseResource theSubscription) {

View File

@ -68,8 +68,8 @@ public class CanonicalSubscription implements Serializable, Cloneable, IModelJso
private RestHookDetails myRestHookDetails; private RestHookDetails myRestHookDetails;
@JsonProperty("extensions") @JsonProperty("extensions")
private Map<String, List<String>> myChannelExtensions; private Map<String, List<String>> myChannelExtensions;
@JsonProperty("payloadSearchResult") @JsonProperty("payloadSearchCriteria")
private String myPayloadSearchResult; private String myPayloadSearchCriteria;
/** /**
* Constructor * Constructor
@ -78,12 +78,12 @@ public class CanonicalSubscription implements Serializable, Cloneable, IModelJso
super(); super();
} }
public String getPayloadSearchResult() { public String getPayloadSearchCriteria() {
return myPayloadSearchResult; return myPayloadSearchCriteria;
} }
public void setPayloadSearchResult(String thePayloadSearchResult) { public void setPayloadSearchCriteria(String thePayloadSearchCriteria) {
myPayloadSearchResult = thePayloadSearchResult; myPayloadSearchCriteria = thePayloadSearchCriteria;
} }
/** /**

View File

@ -25,7 +25,6 @@ import ca.uhn.fhir.interceptor.api.Hook;
import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
@ -35,6 +34,7 @@ import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.util.HapiExtensions;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -99,8 +99,8 @@ public class SubscriptionValidatingInterceptor {
validateQuery(subscription.getCriteriaString(), "Subscription.criteria"); validateQuery(subscription.getCriteriaString(), "Subscription.criteria");
if (subscription.getPayloadSearchResult() != null) { if (subscription.getPayloadSearchCriteria() != null) {
validateQuery(subscription.getPayloadSearchResult(), "Subscription.extension(url='" + JpaConstants.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_RESULT + "')"); validateQuery(subscription.getPayloadSearchCriteria(), "Subscription.extension(url='" + HapiExtensions.EXT_SUBSCRIPTION_PAYLOAD_SEARCH_CRITERIA + "')");
} }
validateChannelType(subscription); validateChannelType(subscription);