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.api.model;
021
022import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
023import ca.uhn.fhir.rest.api.MethodOutcome;
024import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
025
026import java.util.List;
027
028/**
029 * This class is a replacement for {@link DaoMethodOutcome} for delete operations,
030 * as they can perform their operation over multiple resources
031 */
032public class DeleteMethodOutcome extends MethodOutcome {
033
034        private List<? extends IBasePersistedResource> myDeletedEntities;
035
036        @Deprecated
037        private long myExpungedResourcesCount;
038
039        @Deprecated
040        private long myExpungedEntitiesCount;
041
042        public DeleteMethodOutcome() {}
043
044        public DeleteMethodOutcome(IBaseOperationOutcome theBaseOperationOutcome) {
045                super(theBaseOperationOutcome);
046        }
047
048        public List<? extends IBasePersistedResource> getDeletedEntities() {
049                return myDeletedEntities;
050        }
051
052        /**
053         * Use {@literal ca.uhn.fhir.jpa.batch.writer.SqlExecutorWriter#ENTITY_TOTAL_UPDATED_OR_DELETED}
054         */
055        @Deprecated
056        public DeleteMethodOutcome setDeletedEntities(List<? extends IBasePersistedResource> theDeletedEntities) {
057                myDeletedEntities = theDeletedEntities;
058                return this;
059        }
060
061        /**
062         * Use {@literal ca.uhn.fhir.jpa.batch.listener.PidReaderCounterListener#RESOURCE_TOTAL_PROCESSED}
063         */
064        @Deprecated
065        public long getExpungedResourcesCount() {
066                return myExpungedResourcesCount;
067        }
068
069        @Deprecated
070        public DeleteMethodOutcome setExpungedResourcesCount(long theExpungedResourcesCount) {
071                myExpungedResourcesCount = theExpungedResourcesCount;
072                return this;
073        }
074
075        @Deprecated
076        public long getExpungedEntitiesCount() {
077                return myExpungedEntitiesCount;
078        }
079
080        @Deprecated
081        public DeleteMethodOutcome setExpungedEntitiesCount(long theExpungedEntitiesCount) {
082                myExpungedEntitiesCount = theExpungedEntitiesCount;
083                return this;
084        }
085}