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.replacereferences;
021
022import ca.uhn.fhir.interceptor.model.RequestPartitionId;
023import org.hl7.fhir.instance.model.api.IIdType;
024
025import javax.annotation.Nonnull;
026
027/**
028 * This class models the parameters for processing a $hapi.fhir.undo-replace-references operation.
029 */
030public class UndoReplaceReferencesRequest {
031
032        /**
033         * Unqualified source id
034         */
035        @Nonnull
036        public final IIdType sourceId;
037
038        /**
039         * Unqualified target id
040         */
041        @Nonnull
042        public final IIdType targetId;
043
044        public final RequestPartitionId partitionId;
045
046        /**
047         * The maximum number of resource that can be processed in a single undo operation.
048         * If the undo operation requires updating more resources than this limit,
049         * the operation will fail.
050         * This is currently not exposed to FHIR clients and is used internally, and set based on jpaStorageSettings.
051         */
052        public final int resourceLimit;
053
054        public UndoReplaceReferencesRequest(
055                        @Nonnull IIdType theSourceId,
056                        @Nonnull IIdType theTargetId,
057                        RequestPartitionId thePartitionId,
058                        int theResourceLimit) {
059                sourceId = theSourceId.toUnqualifiedVersionless();
060                targetId = theTargetId.toUnqualifiedVersionless();
061                partitionId = thePartitionId;
062                resourceLimit = theResourceLimit;
063        }
064}