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