/** * If e-mail subscriptions are supported, the From address used when sending e-mails */ public String getEmailFromAddress() { return myModelConfig.getEmailFromAddress(); }
/** * This setting may be used to advise the server that any references found in * resources that have any of the base URLs given here will be replaced with * simple local references. * <p> * For example, if the set contains the value <code>http://example.com/base/</code> * and a resource is submitted to the server that contains a reference to * <code>http://example.com/base/Patient/1</code>, the server will automatically * convert this reference to <code>Patient/1</code> * </p> * <p> * Note that this property has different behaviour from {@link DaoConfig#getTreatReferencesAsLogical()} * </p> * * @see #getTreatReferencesAsLogical() */ public Set<String> getTreatBaseUrlsAsLocal() { return myModelConfig.getTreatBaseUrlsAsLocal(); }
/** * This setting may be used to advise the server that any references found in * resources that have any of the base URLs given here will be treated as logical * references instead of being treated as real references. * <p> * A logical reference is a reference which is treated as an identifier, and * does not neccesarily resolve. See <a href="http://hl7.org/fhir/references.html">references</a> for * a description of logical references. For example, the valueset * <a href="http://hl7.org/fhir/valueset-quantity-comparator.html">valueset-quantity-comparator</a> is a logical * reference. * </p> * <p> * Values for this field may take either of the following forms: * </p> * <ul> * <li><code>http://example.com/some-url</code> <b>(will be matched exactly)</b></li> * <li><code>http://example.com/some-base*</code> <b>(will match anything beginning with the part before the *)</b></li> * </ul> * * @see ModelConfig#DEFAULT_LOGICAL_BASE_URLS Default values for this property */ public Set<String> getTreatReferencesAsLogical() { return myModelConfig.getTreatReferencesAsLogical(); }
if (!myModelConfig.getTreatBaseUrlsAsLocal().contains(baseUrl) && !myModelConfig.isAllowExternalReferences()) { String msg = myContext.getLocalizer().getMessage(BaseSearchParamExtractor.class, "externalReferenceNotAllowed", nextId.getValue()); throw new InvalidRequestException(msg);
/** * If set to <code>true</code> (default is true) the server will match incoming resources against active subscriptions * and send them to the subscription channel. If set to <code>false</code> no matching or sending occurs. * @since 3.7.0 */ public boolean isSubscriptionMatchingEnabled() { return myModelConfig.isSubscriptionMatchingEnabled(); }
/** * If enabled, the server will support the use of :contains searches, * which are helpful but can have adverse effects on performance. * <p> * Default is <code>false</code> (Note that prior to HAPI FHIR * 3.5.0 the default was <code>true</code>) * </p> * <p> * Note: If you change this value after data already has * already been stored in the database, you must for a reindexing * of all data in the database or resources may not be * searchable. * </p> */ public boolean isAllowContainsSearches() { return this.myModelConfig.isAllowContainsSearches(); }
/** * If set to {@code true} the default search params (i.e. the search parameters that are * defined by the FHIR specification itself) may be overridden by uploading search * parameters to the server with the same code as the built-in search parameter. * <p> * This can be useful if you want to be able to disable or alter * the behaviour of the default search parameters. * </p> * <p> * The default value for this setting is {@code false} * </p> */ public boolean isDefaultSearchParamsCanBeOverridden() { return myModelConfig.isDefaultSearchParamsCanBeOverridden(); }
/** * If set to <code>true</code> (default is <code>false</code>) the server will allow * resources to have references to external servers. For example if this server is * running at <code>http://example.com/fhir</code> and this setting is set to * <code>true</code> the server will allow a Patient resource to be saved with a * Patient.organization value of <code>http://foo.com/Organization/1</code>. * <p> * Under the default behaviour if this value has not been changed, the above * resource would be rejected by the server because it requires all references * to be resolvable on the local server. * </p> * <p> * Note that external references will be indexed by the server and may be searched * (e.g. <code>Patient:organization</code>), but * chained searches (e.g. <code>Patient:organization.name</code>) will not work across * these references. * </p> * <p> * It is recommended to also set {@link #setTreatBaseUrlsAsLocal(Set)} if this value * is set to <code>true</code> * </p> * * @see #setTreatBaseUrlsAsLocal(Set) * @see #setAllowExternalReferences(boolean) */ public boolean isAllowExternalReferences() { return myModelConfig.isAllowExternalReferences(); }
/** * Add a value to the {@link #setTreatReferencesAsLogical(Set) logical references list}. * * @see #setTreatReferencesAsLogical(Set) */ public void addTreatReferencesAsLogical(String theTreatReferencesAsLogical) { myModelConfig.addTreatReferencesAsLogical(theTreatReferencesAsLogical); }
/** * This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted * to the server matching these types will be activated. */ public DaoConfig addSupportedSubscriptionType(Subscription.SubscriptionChannelType theSubscriptionChannelType) { myModelConfig.addSupportedSubscriptionType(theSubscriptionChannelType); return this; }
.addTask(new CalculateHashesTask() .setColumnName("HASH_NORM_PREFIX") .addCalculator("HASH_NORM_PREFIX", t -> ResourceIndexedSearchParamString.calculateHashNormalized(new ModelConfig(), t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_VALUE_NORMALIZED"))) .addCalculator("HASH_EXACT", t -> ResourceIndexedSearchParamString.calculateHashExact(t.getResourceType(), t.getParamName(), t.getString("SP_VALUE_EXACT"))) );
@SuppressWarnings("UnusedReturnValue") private CanonicalSubscription registerSubscription(IIdType theId, IBaseResource theSubscription) { Validate.notNull(theId); String subscriptionId = theId.getIdPart(); Validate.notBlank(subscriptionId); Validate.notNull(theSubscription); CanonicalSubscription canonicalized = mySubscriptionCanonicalizer.canonicalize(theSubscription); SubscribableChannel deliveryChannel; Optional<MessageHandler> deliveryHandler; if (myModelConfig.isSubscriptionMatchingEnabled()) { deliveryChannel = mySubscriptionDeliveryChannelFactory.newDeliveryChannel(subscriptionId, canonicalized.getChannelType().toCode().toLowerCase()); deliveryHandler = mySubscriptionDeliveryHandlerFactory.createDeliveryHandler(canonicalized); } else { deliveryChannel = null; deliveryHandler = Optional.empty(); } ActiveSubscription activeSubscription = new ActiveSubscription(canonicalized, deliveryChannel); deliveryHandler.ifPresent(activeSubscription::register); myActiveSubscriptionCache.put(subscriptionId, activeSubscription); // Interceptor call: SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED, canonicalized); return canonicalized; }
public static long calculateHashNormalized(ModelConfig theModelConfig, String theResourceType, String theParamName, String theValueNormalized) { /* * If we're not allowing contained searches, we'll add the first * bit of the normalized value to the hash. This helps to * make the hash even more unique, which will be good for * performance. */ int hashPrefixLength = HASH_PREFIX_LENGTH; if (theModelConfig.isAllowContainsSearches()) { hashPrefixLength = 0; } return hash(theResourceType, theParamName, left(theValueNormalized, hashPrefixLength)); }
if (myModelConfig.isDefaultSearchParamsCanBeOverridden() || !searchParamMap.containsKey(name)) { searchParamMap.put(name, runtimeSp);
/** * If set to <code>true</code> (default is <code>false</code>) the server will allow * resources to have references to external servers. For example if this server is * running at <code>http://example.com/fhir</code> and this setting is set to * <code>true</code> the server will allow a Patient resource to be saved with a * Patient.organization value of <code>http://foo.com/Organization/1</code>. * <p> * Under the default behaviour if this value has not been changed, the above * resource would be rejected by the server because it requires all references * to be resolvable on the local server. * </p> * <p> * Note that external references will be indexed by the server and may be searched * (e.g. <code>Patient:organization</code>), but * chained searches (e.g. <code>Patient:organization.name</code>) will not work across * these references. * </p> * <p> * It is recommended to also set {@link #setTreatBaseUrlsAsLocal(Set)} if this value * is set to <code>true</code> * </p> * * @see #setTreatBaseUrlsAsLocal(Set) * @see #setAllowExternalReferences(boolean) */ public boolean isAllowExternalReferences() { return myModelConfig.isAllowExternalReferences(); }
/** * Add a value to the {@link #setTreatReferencesAsLogical(Set) logical references list}. * * @see #setTreatReferencesAsLogical(Set) */ public void addTreatReferencesAsLogical(String theTreatReferencesAsLogical) { myModelConfig.addTreatReferencesAsLogical(theTreatReferencesAsLogical); }
/** * This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted * to the server matching these types will be activated. */ public DaoConfig addSupportedSubscriptionType(Subscription.SubscriptionChannelType theSubscriptionChannelType) { myModelConfig.addSupportedSubscriptionType(theSubscriptionChannelType); return this; }
/** * If set to <code>true</code> (default is true) the server will match incoming resources against active subscriptions * and send them to the subscription channel. If set to <code>false</code> no matching or sending occurs. * @since 3.7.0 */ public boolean isSubscriptionMatchingEnabled() { return myModelConfig.isSubscriptionMatchingEnabled(); }
@Override public void handleMessage(ResourceDeliveryMessage theMessage) throws Exception { CanonicalSubscription subscription = theMessage.getSubscription(); // The Subscription.endpoint is treated as the email "to" String endpointUrl = subscription.getEndpointUrl(); List<String> destinationAddresses = new ArrayList<>(); String[] destinationAddressStrings = StringUtils.split(endpointUrl, ","); for (String next : destinationAddressStrings) { next = processEmailAddressUri(next); if (isNotBlank(next)) { destinationAddresses.add(next); } } String from = processEmailAddressUri(defaultString(subscription.getEmailDetails().getFrom(), myModelConfig.getEmailFromAddress())); String subjectTemplate = defaultString(subscription.getEmailDetails().getSubjectTemplate(), provideDefaultSubjectTemplate()); EmailDetails details = new EmailDetails(); details.setTo(destinationAddresses); details.setFrom(from); details.setBodyTemplate(subscription.getPayloadString()); details.setSubjectTemplate(subjectTemplate); details.setSubscription(subscription.getIdElement(myFhirContext)); myEmailSender.send(details); }
/** * If enabled, the server will support the use of :contains searches, * which are helpful but can have adverse effects on performance. * <p> * Default is <code>false</code> (Note that prior to HAPI FHIR * 3.5.0 the default was <code>true</code>) * </p> * <p> * Note: If you change this value after data already has * already been stored in the database, you must for a reindexing * of all data in the database or resources may not be * searchable. * </p> */ public boolean isAllowContainsSearches() { return this.myModelConfig.isAllowContainsSearches(); }