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.consent; 011 012import ca.uhn.fhir.model.primitive.IdDt; 013import jakarta.annotation.Nullable; 014import org.apache.commons.lang3.builder.EqualsBuilder; 015 016import java.util.Objects; 017 018/** 019 * Represents the relevant context information to run Consent resource derived consent logic. 020 */ 021public class ConsentLookupContext { 022 023 @Nullable 024 private final IdDt myClinicalPatientId; 025 026 public ConsentLookupContext(@Nullable IdDt theClinicalPatientId) { 027 myClinicalPatientId = theClinicalPatientId; 028 } 029 030 public @Nullable IdDt getClinicalPatientId() { 031 return myClinicalPatientId; 032 } 033 034 @Override 035 public boolean equals(Object o) { 036 if (this == o) { 037 return true; 038 } 039 040 if (o == null || getClass() != o.getClass()) { 041 return false; 042 } 043 044 ConsentLookupContext that = (ConsentLookupContext) o; 045 046 return new EqualsBuilder() 047 .append(myClinicalPatientId, that.myClinicalPatientId) 048 .isEquals(); 049 } 050 051 @Override 052 public int hashCode() { 053 return Objects.hash(myClinicalPatientId); 054 } 055}