001package io.ebean.event.readaudit; 002 003/** 004 * A SQL query and associated keys. 005 * <p> 006 * This is logged as a separate event so that the 007 * </p> 008 */ 009public class ReadAuditQueryPlan { 010 011 String beanType; 012 013 String queryKey; 014 015 String sql; 016 017 /** 018 * Construct given the beanType, queryKey and sql. 019 */ 020 public ReadAuditQueryPlan(String beanType, String queryKey, String sql) { 021 this.beanType = beanType; 022 this.queryKey = queryKey; 023 this.sql = sql; 024 } 025 026 /** 027 * Construct for JSON tools. 028 */ 029 public ReadAuditQueryPlan() { 030 } 031 032 @Override 033 public String toString() { 034 return "beanType:" + beanType + " queryKey:" + queryKey + " sql:" + sql; 035 } 036 037 /** 038 * Return the bean type. 039 */ 040 public String getBeanType() { 041 return beanType; 042 } 043 044 /** 045 * Set the bean type. 046 */ 047 public void setBeanType(String beanType) { 048 this.beanType = beanType; 049 } 050 051 /** 052 * Return the query key (relative to the bean type). 053 */ 054 public String getQueryKey() { 055 return queryKey; 056 } 057 058 /** 059 * Set the query key. 060 */ 061 public void setQueryKey(String queryKey) { 062 this.queryKey = queryKey; 063 } 064 065 /** 066 * Return the sql statement. 067 */ 068 public String getSql() { 069 return sql; 070 } 071 072 /** 073 * Set the sql statement. 074 */ 075 public void setSql(String sql) { 076 this.sql = sql; 077 } 078 079 @Override 080 public boolean equals(Object o) { 081 if (this == o) return true; 082 if (o == null || getClass() != o.getClass()) return false; 083 084 ReadAuditQueryPlan that = (ReadAuditQueryPlan) o; 085 if (!beanType.equals(that.beanType)) return false; 086 if (!queryKey.equals(that.queryKey)) return false; 087 return sql.equals(that.sql); 088 } 089 090 @Override 091 public int hashCode() { 092 int result = beanType.hashCode(); 093 result = 92821 * result + queryKey.hashCode(); 094 result = 92821 * result + sql.hashCode(); 095 return result; 096 } 097}