001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.client;
019
020import org.apache.commons.lang3.builder.EqualsBuilder;
021import org.apache.commons.lang3.builder.HashCodeBuilder;
022import org.apache.commons.lang3.builder.ToStringBuilder;
023import org.apache.yetus.audience.InterfaceAudience;
024import org.apache.yetus.audience.InterfaceStability;
025
026/**
027 * Slow/Large Log Query Filter with all filter and limit parameters Extends generic LogRequest used
028 * by Admin API getLogEntries
029 * @deprecated as of 2.4.0. Will be removed in 4.0.0.
030 */
031@InterfaceAudience.Public
032@InterfaceStability.Evolving
033@Deprecated
034public class LogQueryFilter {
035
036  private String regionName;
037  private String clientAddress;
038  private String tableName;
039  private String userName;
040  private int limit = 10;
041  private Type type = Type.SLOW_LOG;
042  private FilterByOperator filterByOperator = FilterByOperator.OR;
043
044  public enum Type {
045    SLOW_LOG,
046    LARGE_LOG
047  }
048
049  public enum FilterByOperator {
050    AND,
051    OR
052  }
053
054  public String getRegionName() {
055    return regionName;
056  }
057
058  public void setRegionName(String regionName) {
059    this.regionName = regionName;
060  }
061
062  public String getClientAddress() {
063    return clientAddress;
064  }
065
066  public void setClientAddress(String clientAddress) {
067    this.clientAddress = clientAddress;
068  }
069
070  public String getTableName() {
071    return tableName;
072  }
073
074  public void setTableName(String tableName) {
075    this.tableName = tableName;
076  }
077
078  public String getUserName() {
079    return userName;
080  }
081
082  public void setUserName(String userName) {
083    this.userName = userName;
084  }
085
086  public int getLimit() {
087    return limit;
088  }
089
090  public void setLimit(int limit) {
091    this.limit = limit;
092  }
093
094  public Type getType() {
095    return type;
096  }
097
098  public void setType(Type type) {
099    this.type = type;
100  }
101
102  public FilterByOperator getFilterByOperator() {
103    return filterByOperator;
104  }
105
106  public void setFilterByOperator(FilterByOperator filterByOperator) {
107    this.filterByOperator = filterByOperator;
108  }
109
110  @Override
111  public boolean equals(Object o) {
112    if (this == o) {
113      return true;
114    }
115    if (!(o instanceof LogQueryFilter)) {
116      return false;
117    }
118    LogQueryFilter that = (LogQueryFilter) o;
119    return new EqualsBuilder().append(limit, that.limit).append(regionName, that.regionName)
120      .append(clientAddress, that.clientAddress).append(tableName, that.tableName)
121      .append(userName, that.userName).append(type, that.type)
122      .append(filterByOperator, that.filterByOperator).isEquals();
123  }
124
125  @Override
126  public int hashCode() {
127    return new HashCodeBuilder(17, 37).append(regionName).append(clientAddress).append(tableName)
128      .append(userName).append(limit).append(type).append(filterByOperator).toHashCode();
129  }
130
131  @Override
132  public String toString() {
133    return new ToStringBuilder(this).append("regionName", regionName)
134      .append("clientAddress", clientAddress).append("tableName", tableName)
135      .append("userName", userName).append("limit", limit).append("type", type)
136      .append("filterByOperator", filterByOperator).toString();
137  }
138
139}