All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.uhn.fhir.context.api.BundleInclusionRule Maven / Gradle / Ivy

Go to download

Builds the hapi fhir base. Requires Common lang, commons-text, and guava be built first.

There is a newer version: 7.0.2-r12
Show newest version
/*
 * #%L
 * HAPI FHIR - Core Library
 * %%
 * Copyright (C) 2014 - 2024 Smile CDR, Inc.
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package ca.uhn.fhir.context.api;

import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.util.ResourceReferenceInfo;

import java.util.Set;

/**
 * Created by Bill de Beaubien on 3/4/2015.
 *
 * Controls how bundles decide whether referenced resources should be included
 */
public enum BundleInclusionRule {

	/**
	 * Decision is based on whether the resource's Include is in the IncludeSet (e.g. DiagnosticReport.result). Note that the resource has to be populated to be included.
	 *
	 * This is the default behavior
	 */
	BASED_ON_INCLUDES {
		@Override
		public boolean shouldIncludeReferencedResource(
				ResourceReferenceInfo theReferenceInfo, Set theIncludes) {
			return theReferenceInfo.matchesIncludeSet(theIncludes);
		}
	},

	/**
	 * Decision is based on whether the resource reference is set to a populated resource (in which case its included) or just an id (in which case it's not included)
	 *
	 * This is the original HAPI behavior
	 */
	BASED_ON_RESOURCE_PRESENCE {
		@Override
		public boolean shouldIncludeReferencedResource(
				ResourceReferenceInfo theReferenceInfo, Set theIncludes) {
			return true;
		}
	};

	public abstract boolean shouldIncludeReferencedResource(
			ResourceReferenceInfo theReferenceInfo, Set theIncludes);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy