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.cross.IBasePersistedResource; 024import ca.uhn.fhir.rest.api.MethodOutcome; 025import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; 026import org.hl7.fhir.instance.model.api.IBaseResource; 027 028public class DaoMethodOutcome extends MethodOutcome { 029 030 private IBasePersistedResource myEntity; 031 private IBaseResource myPreviousResource; 032 private boolean myNop; 033 private ResourcePersistentId myResourcePersistentId; 034 035 /** 036 * Constructor 037 */ 038 public DaoMethodOutcome() { 039 super(); 040 } 041 042 /** 043 * Was this a NO-OP - Typically because of an update to a resource that already matched the contents provided 044 */ 045 public boolean isNop() { 046 return myNop; 047 } 048 049 /** 050 * Was this a NO-OP - Typically because of an update to a resource that already matched the contents provided 051 */ 052 public DaoMethodOutcome setNop(boolean theNop) { 053 myNop = theNop; 054 return this; 055 } 056 057 public IBasePersistedResource getEntity() { 058 return myEntity; 059 } 060 061 public DaoMethodOutcome setEntity(IBasePersistedResource theEntity) { 062 myEntity = theEntity; 063 return this; 064 } 065 066 /** 067 * For update operations, this is the body of the resource as it was before the 068 * update 069 */ 070 public IBaseResource getPreviousResource() { 071 return myPreviousResource; 072 } 073 074 /** 075 * For update operations, this is the body of the resource as it was before the 076 * update 077 */ 078 public void setPreviousResource(IBaseResource thePreviousResource) { 079 myPreviousResource = thePreviousResource; 080 } 081 082 @Override 083 public DaoMethodOutcome setCreated(Boolean theCreated) { 084 super.setCreated(theCreated); 085 return this; 086 } 087 088 public ResourcePersistentId getPersistentId() { 089 return myResourcePersistentId; 090 } 091 092 public DaoMethodOutcome setPersistentId(ResourcePersistentId theResourcePersistentId) { 093 myResourcePersistentId = theResourcePersistentId; 094 return this; 095 } 096 097}