001/*-
002 * #%L
003 * HAPI FHIR Storage api
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.context.FhirContext;
023import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
024import org.hl7.fhir.instance.model.api.IBase;
025import org.hl7.fhir.instance.model.api.IBaseBundle;
026import org.hl7.fhir.instance.model.api.IBaseExtension;
027import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
028import org.hl7.fhir.instance.model.api.IBaseResource;
029
030import java.util.Date;
031import java.util.List;
032import java.util.Optional;
033
034public interface ITransactionProcessorVersionAdapter<BUNDLE extends IBaseBundle, BUNDLEENTRY extends IBase> {
035
036        void setResponseStatus(BUNDLEENTRY theBundleEntry, String theStatus);
037
038        void setResponseLastModified(BUNDLEENTRY theBundleEntry, Date theLastModified);
039
040        void setResource(BUNDLEENTRY theBundleEntry, IBaseResource theResource);
041
042        IBaseResource getResource(BUNDLEENTRY theBundleEntry);
043
044        String getBundleType(BUNDLE theRequest);
045
046        void populateEntryWithOperationOutcome(BaseServerResponseException theCaughtEx, BUNDLEENTRY theEntry);
047
048        BUNDLE createBundle(String theBundleType);
049
050        List<BUNDLEENTRY> getEntries(BUNDLE theRequest);
051
052        void addEntry(BUNDLE theBundle, BUNDLEENTRY theEntry);
053
054        BUNDLEENTRY addEntry(BUNDLE theBundle);
055
056        String getEntryRequestVerb(FhirContext theContext, BUNDLEENTRY theEntry);
057
058        String getFullUrl(BUNDLEENTRY theEntry);
059
060        void setFullUrl(BUNDLEENTRY theEntry, String theFullUrl);
061
062        String getEntryIfNoneExist(BUNDLEENTRY theEntry);
063
064        String getEntryRequestUrl(BUNDLEENTRY theEntry);
065
066        void setResponseLocation(BUNDLEENTRY theEntry, String theResponseLocation);
067
068        void setResponseETag(BUNDLEENTRY theEntry, String theEtag);
069
070        String getEntryRequestIfMatch(BUNDLEENTRY theEntry);
071
072        String getEntryRequestIfNoneExist(BUNDLEENTRY theEntry);
073
074        String getEntryRequestIfNoneMatch(BUNDLEENTRY theEntry);
075
076        void setResponseOutcome(BUNDLEENTRY theEntry, IBaseOperationOutcome theOperationOutcome);
077
078        void setRequestVerb(BUNDLEENTRY theEntry, String theVerb);
079
080        void setRequestUrl(BUNDLEENTRY theEntry, String theUrl);
081
082        Optional<IBaseExtension<?, ?>> getEntryRequestExtensionByUrl(BUNDLEENTRY theEntry, String theUrl);
083}