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