001/*-
002 * #%L
003 * HAPI FHIR - Core Library
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.util.bundle;
021
022import ca.uhn.fhir.context.FhirContext;
023import ca.uhn.fhir.rest.api.RequestTypeEnum;
024import org.hl7.fhir.instance.model.api.IBaseResource;
025
026import java.util.Date;
027
028public class ModifiableBundleEntry {
029        private final BundleEntryParts myBundleEntryParts;
030        private final BundleEntryMutator myBundleEntryMutator;
031
032        public ModifiableBundleEntry(BundleEntryParts theBundleEntryParts, BundleEntryMutator theBundleEntryMutator) {
033                myBundleEntryParts = theBundleEntryParts;
034                myBundleEntryMutator = theBundleEntryMutator;
035        }
036
037        BundleEntryParts getBundleEntryParts() {
038                return myBundleEntryParts;
039        }
040
041        public void setRequestUrl(FhirContext theFhirContext, String theRequestUrl) {
042                myBundleEntryMutator.setRequestUrl(theFhirContext, theRequestUrl);
043        }
044
045        public String getFullUrl() {
046                return myBundleEntryParts.getFullUrl();
047        }
048
049        public String getRequestUrl() {
050                return myBundleEntryParts.getUrl();
051        }
052
053        public IBaseResource getResource() {
054                return myBundleEntryParts.getResource();
055        }
056
057        public void setFullUrl(String theFullUrl) {
058                myBundleEntryMutator.setFullUrl(theFullUrl);
059        }
060
061        public void setResource(IBaseResource theUpdatedResource) {
062                myBundleEntryMutator.setResource(theUpdatedResource);
063        }
064
065        public RequestTypeEnum getRequestMethod() {
066                return myBundleEntryParts.getRequestType();
067        }
068
069        public String getConditionalUrl() {
070                return myBundleEntryParts.getConditionalUrl();
071        }
072
073        public void setRequestIfNoneMatch(FhirContext theFhirContext, String ifNoneMatch) {
074                myBundleEntryMutator.setRequestIfNoneMatch(theFhirContext, ifNoneMatch);
075        }
076
077        public void setRequestIfModifiedSince(FhirContext theFhirContext, Date theModifiedSince) {
078                myBundleEntryMutator.setRequestIfModifiedSince(theFhirContext, theModifiedSince);
079        }
080
081        public void setRequestIfMatch(FhirContext theFhirContext, String theIfMatch) {
082                myBundleEntryMutator.setRequestIfMatch(theFhirContext, theIfMatch);
083        }
084
085        public void setRequestIfNoneExist(FhirContext theFhirContext, String theIfNoneExist) {
086                myBundleEntryMutator.setRequestIfNoneExist(theFhirContext, theIfNoneExist);
087        }
088}