
001/*- 002 * #%L 003 * HAPI FHIR JPA Server 004 * %% 005 * Copyright (C) 2014 - 2025 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.jpa.dao; 021 022import ca.uhn.fhir.jpa.model.dao.JpaPid; 023import ca.uhn.fhir.jpa.model.entity.BaseTag; 024import ca.uhn.fhir.jpa.model.entity.IBaseResourceEntity; 025import ca.uhn.fhir.rest.api.server.RequestDetails; 026import jakarta.annotation.Nullable; 027import org.hl7.fhir.instance.model.api.IBaseResource; 028 029import java.util.Collection; 030 031public interface IJpaStorageResourceParser extends IStorageResourceParser<JpaPid> { 032 033 /** 034 * Convert a storage entity into a FHIR resource model instance. This method may return null if the entity is not 035 * completely flushed, including the entity's history entries. 036 */ 037 <R extends IBaseResource> R toResource( 038 RequestDetails theDetails, 039 Class<R> theResourceType, 040 IBaseResourceEntity<?> theEntity, 041 Collection<BaseTag> theTagList, 042 boolean theForHistoryOperation); 043 044 /** 045 * Populate the metadata (Resource.meta.*) from a storage entity and other related 046 * objects pulled from the database 047 */ 048 <R extends IBaseResource> R populateResourceMetadata( 049 IBaseResourceEntity<?> theEntitySource, 050 boolean theForHistoryOperation, 051 @Nullable Collection<? extends BaseTag> tagList, 052 long theVersion, 053 R theResourceTarget); 054 055 /** 056 * Populates a resource model object's metadata (Resource.meta.*) based on the 057 * values from a storage entity. 058 * 059 * @param theEntitySource The source 060 * @param theResourceTarget The target 061 */ 062 void updateResourceMetadata(IBaseResourceEntity<?> theEntitySource, IBaseResource theResourceTarget); 063}