Enhance isPlaceholder to check value of placeholder extension.

This commit is contained in:
Diederik Muylwyk 2021-03-04 19:33:00 -05:00
parent 96a2151542
commit beab3522b9
2 changed files with 11 additions and 6 deletions

View File

@ -110,7 +110,6 @@ public class DaoResourceLinkResolver implements IResourceLinkResolver {
return resolvedResource; return resolvedResource;
} }
// FIXME: DM 2021-03-04 - This is where placeholder reference targets are handled.
/** /**
* @param theIdToAssignToPlaceholder If specified, the placeholder resource created will be given a specific ID * @param theIdToAssignToPlaceholder If specified, the placeholder resource created will be given a specific ID
*/ */
@ -150,7 +149,7 @@ public class DaoResourceLinkResolver implements IResourceLinkResolver {
return Optional.ofNullable(valueOf); return Optional.ofNullable(valueOf);
} }
// FIXME: DM 2021-03-04 - Should we throw an error if the identifier isn't available? Otherwise we get a placeholder with no identifier. // FIXME: DM 2021-03-04 - Should we issue a warning if the identifier isn't available?
private <T extends IBaseResource> void tryToCopyIdentifierFromReferenceToTargetResource(IBaseReference theSourceReference, RuntimeResourceDefinition theTargetResourceDef, T theTargetResource) { private <T extends IBaseResource> void tryToCopyIdentifierFromReferenceToTargetResource(IBaseReference theSourceReference, RuntimeResourceDefinition theTargetResourceDef, T theTargetResource) {
boolean referenceHasIdentifier = theSourceReference.hasIdentifier(); boolean referenceHasIdentifier = theSourceReference.hasIdentifier();
if (referenceHasIdentifier) { if (referenceHasIdentifier) {

View File

@ -119,15 +119,17 @@ import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.CanonicalType; import org.hl7.fhir.r4.model.CanonicalType;
import org.hl7.fhir.r4.model.CodeSystem; import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.CodeableConcept; import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.ConceptMap; import org.hl7.fhir.r4.model.ConceptMap;
import org.hl7.fhir.r4.model.DomainResource;
import org.hl7.fhir.r4.model.Enumerations; import org.hl7.fhir.r4.model.Enumerations;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.IntegerType;
import org.hl7.fhir.r4.model.MetadataResource;
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;
import org.hl7.fhir.r4.model.codesystems.ConceptSubsumptionOutcome; import org.hl7.fhir.r4.model.codesystems.ConceptSubsumptionOutcome;
@ -2122,9 +2124,13 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
} }
} }
private boolean isPlaceholder(MetadataResource theResource) { private boolean isPlaceholder(DomainResource theResource) {
// FIXME: DM 2021-03-04 - We should probably check if this extension exists and the value is true. boolean retVal = false;
return theResource.getMeta().getExtensionByUrl(HapiExtensions.EXT_RESOURCE_META_PLACEHOLDER) != null; Extension extension = theResource.getExtensionByUrl(HapiExtensions.EXT_RESOURCE_PLACEHOLDER);
if (extension != null && extension.hasValue() && extension.getValue() instanceof BooleanType) {
retVal = ((BooleanType) extension.getValue()).booleanValue();
}
return retVal;
} }
@Override @Override