1 /* 2 * $HeadURL: $ 3 * $Date: $ 4 * $Revision: $ 5 * $Author: $ 6 * 7 * Copyright (c) 2005 MindTree Consulting Ltd. 8 * 9 * This file is part of Insight. 10 * 11 * Insight is free software: you can redistribute it and/or modify it under the 12 * terms of the GNU General Public License as published by the Free Software 13 * Foundation, either version 3 of the License, or (at your option) any later 14 * version. 15 * 16 * Insight is distributed in the hope that it will be useful, but 17 * WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 19 * Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License along with 22 * Insight. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 25 package com.mindtree.techworks.insight.eventsearch; 26 27 import java.io.Serializable; 28 29 30 /** 31 * This is the value object to pass the Search Criteria for the Event Search in 32 * Insight. 33 * 34 * @author Bindul Bhowmik 35 * @version $Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $ 36 */ 37 public class SearchCriteria implements Serializable { 38 39 /** 40 * Used for object serialization 41 */ 42 private static final long serialVersionUID = 1089139959871483251L; 43 44 // 45 // Constant Fields 46 // 47 48 /** 49 * Indicates to search in the thread field 50 */ 51 public static final int THREAD_SEARCH = 1; 52 53 /** 54 * Indicates to search inthe Category field 55 */ 56 public static final int CATEGORY_SEARCH = 2; 57 58 /** 59 * Indicates to search in the Log message 60 */ 61 public static final int MESSAGE_SEARCH = 4; 62 63 /** 64 * Indicates to search for the exception class name. 65 */ 66 public static final int EXCEPTION_CLASS_NAME_SEARCH = 8; 67 68 /** 69 * Indicates to search for the throwable stack trace. 70 */ 71 public static final int THROWABLE_SEARCH = 16; 72 73 /** 74 * Indicates to search for the priority. Note that this field 75 * is not available for selection in the search GUI 76 */ 77 public static final int PRIORITY_SEARCH = 32; 78 79 /** 80 * Indicates to search for the log namespace.Note that this field 81 * is not available for selection in the search GUI 82 */ 83 public static final int NAMESPACE_SEARCH = 64; 84 85 /** 86 * Indicates to search in all fields 87 */ 88 public static final int ALL_FIELDS_SEARCH = THREAD_SEARCH | CATEGORY_SEARCH 89 | MESSAGE_SEARCH | EXCEPTION_CLASS_NAME_SEARCH | THROWABLE_SEARCH 90 | PRIORITY_SEARCH | NAMESPACE_SEARCH; 91 92 // 93 // Instance Variables 94 // 95 96 /** 97 * Holds the type of the search 98 */ 99 private int searchType; 100 101 /** 102 * The string to search for 103 */ 104 private String searchString; 105 106 // 107 // Constructors 108 // 109 110 /** 111 * Constructor for a search criteria. 112 * 113 * @param searchType The type of this search. The search type should be 114 * provided as an <code>OR</code> of the different search 115 * criteria types. For example, to search on both message and 116 * thread, provide the search type as 117 * <code>MESSAGE_SEARCH | THREAD_SEARCH</code>. To search in 118 * all fields use the 119 * {@link SearchCriteria#ALL_FIELDS_SEARCH ALL_FIELDS_SEARCH} 120 * type. 121 */ 122 public SearchCriteria (int searchType) { 123 124 this.searchType = searchType; 125 } 126 127 // 128 // Accessor Methods 129 // 130 131 /** 132 * @return Returns the searchString. 133 */ 134 public String getSearchString () { 135 136 return searchString; 137 } 138 139 /** 140 * @param searchString The searchString to set. 141 */ 142 public void setSearchString (String searchString) { 143 144 this.searchString = searchString; 145 } 146 147 /** 148 * Returns the search type. 149 * 150 * @return The search type for the current search criteria. 151 */ 152 public int getSearchType () { 153 154 return this.searchType; 155 } 156 }