001package ca.uhn.fhir.jpa.api.model;
002
003/*
004 * #%L
005 * HAPI FHIR Storage api
006 * %%
007 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import ca.uhn.fhir.jpa.model.entity.ResourceTable;
024import ca.uhn.fhir.rest.api.MethodOutcome;
025import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
026
027import java.util.List;
028
029/**
030 * This class is a replacement for {@link DaoMethodOutcome} for delete operations,
031 * as they can perform their operation over multiple resources
032 */
033public class DeleteMethodOutcome extends MethodOutcome {
034
035        private List<ResourceTable> myDeletedEntities;
036        @Deprecated
037        private long myExpungedResourcesCount;
038        @Deprecated
039        private long myExpungedEntitiesCount;
040
041        public DeleteMethodOutcome() {
042        }
043
044        public DeleteMethodOutcome(IBaseOperationOutcome theBaseOperationOutcome) {
045                super(theBaseOperationOutcome);
046        }
047
048        public List<ResourceTable> getDeletedEntities() {
049                return myDeletedEntities;
050        }
051
052        /**
053         * Use {@link ca.uhn.fhir.jpa.batch.writer.SqlExecutorWriter#ENTITY_TOTAL_UPDATED_OR_DELETED}
054         */
055        @Deprecated
056        public DeleteMethodOutcome setDeletedEntities(List<ResourceTable> theDeletedEntities) {
057                myDeletedEntities = theDeletedEntities;
058                return this;
059        }
060
061        /**
062         * Use {@link  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}