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.provider.merge;
021
022import ca.uhn.fhir.util.CanonicalIdentifier;
023import org.hl7.fhir.instance.model.api.IBaseReference;
024
025import java.util.List;
026
027/**
028 *  Class for input parameters used in both $merge and $hapi.fhir.undo-merge operations.
029 */
030public class MergeOperationsCommonInputParameters {
031        private List<CanonicalIdentifier> mySourceResourceIdentifiers;
032        private List<CanonicalIdentifier> myTargetResourceIdentifiers;
033        private IBaseReference mySourceResource;
034        private IBaseReference myTargetResource;
035        private final int myResourceLimit;
036
037        public MergeOperationsCommonInputParameters(int theResourceLimit) {
038                myResourceLimit = theResourceLimit;
039        }
040
041        public List<CanonicalIdentifier> getSourceIdentifiers() {
042                return mySourceResourceIdentifiers;
043        }
044
045        public boolean hasAtLeastOneSourceIdentifier() {
046                return mySourceResourceIdentifiers != null && !mySourceResourceIdentifiers.isEmpty();
047        }
048
049        public void setSourceResourceIdentifiers(List<CanonicalIdentifier> theSourceIdentifiers) {
050                this.mySourceResourceIdentifiers = theSourceIdentifiers;
051        }
052
053        public List<CanonicalIdentifier> getTargetIdentifiers() {
054                return myTargetResourceIdentifiers;
055        }
056
057        public boolean hasAtLeastOneTargetIdentifier() {
058                return myTargetResourceIdentifiers != null && !myTargetResourceIdentifiers.isEmpty();
059        }
060
061        public void setTargetResourceIdentifiers(List<CanonicalIdentifier> theTargetIdentifiers) {
062                this.myTargetResourceIdentifiers = theTargetIdentifiers;
063        }
064
065        public IBaseReference getSourceResource() {
066                return mySourceResource;
067        }
068
069        public void setSourceResource(IBaseReference theSourceResource) {
070                this.mySourceResource = theSourceResource;
071        }
072
073        public IBaseReference getTargetResource() {
074                return myTargetResource;
075        }
076
077        public void setTargetResource(IBaseReference theTargetResource) {
078                this.myTargetResource = theTargetResource;
079        }
080
081        public int getResourceLimit() {
082                return myResourceLimit;
083        }
084}