001/*- 002 * #%L 003 * Smile CDR - CDR 004 * %% 005 * Copyright (C) 2016 - 2024 Smile CDR, Inc. 006 * %% 007 * All rights reserved. 008 * #L% 009 */ 010package ca.cdr.api.fhirgw.model; 011 012public abstract class BaseResponse<T extends BaseResponse<?>> { 013 014 private boolean myDeclinedToHandle; 015 private boolean myCacheHit; 016 017 /** 018 * Constructor - Create an empty object 019 */ 020 public BaseResponse() { 021 super(); 022 } 023 024 /** 025 * Copy constructor - Creates a shallow copy only 026 */ 027 public BaseResponse(T theResponse) { 028 myDeclinedToHandle = theResponse.isDeclinedToHandle(); 029 myCacheHit = theResponse.isCacheHit(); 030 } 031 032 /** 033 * If true, the target has declined to try handling this request 034 */ 035 public boolean isDeclinedToHandle() { 036 return myDeclinedToHandle; 037 } 038 039 /** 040 * If true, the target has declined to try handling this request 041 */ 042 public T setDeclinedToHandle(boolean theDeclinedToHandle) { 043 myDeclinedToHandle = theDeclinedToHandle; 044 return (T) this; 045 } 046 047 /** 048 * Create a clone of this object using a <b>shallow copy only</b>. Values 049 * are copied by reference only, so things like Resources should only be 050 * modified if you are sure that the changes won't affect the value 051 * stored in cache. 052 */ 053 @Override 054 public abstract T clone(); 055 056 public void setCacheHit(boolean theCacheHit) { 057 myCacheHit = theCacheHit; 058 } 059 060 public boolean isCacheHit() { 061 return myCacheHit; 062 } 063}