1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.search.messaging;
24  
25  import com.liferay.portal.kernel.search.Document;
26  import com.liferay.portal.kernel.search.Sort;
27  
28  /**
29   * <a href="SearchRequest.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Bruno Farache
32   *
33   */
34  public class SearchRequest {
35  
36      public static final String COMMAND_ADD = "ADD";
37  
38      public static final String COMMAND_DELETE = "DELETE";
39  
40      public static final String COMMAND_DELETE_PORTLET_DOCS =
41          "DELETE_PORTLET_DOCS";
42  
43      public static final String COMMAND_INDEX_ONLY = "INDEX_ONLY";
44  
45      public static final String COMMAND_SEARCH = "SEARCH";
46  
47      public static final String COMMAND_UPDATE = "UPDATE";
48  
49      public SearchRequest() {
50      }
51  
52      public SearchRequest(String command) {
53          this(command, 0, (String)null);
54      }
55  
56      public SearchRequest(String command, long companyId, String id) {
57          this(command, companyId, id, null);
58      }
59  
60      public SearchRequest(String command, long companyId, Document doc) {
61          this(command, companyId, null, doc);
62      }
63  
64      public SearchRequest(
65          String command, long companyId, String id, Document doc) {
66  
67          this(command, companyId, id, doc, null, null, 0, 0);
68      }
69  
70      public SearchRequest(
71          String command, long companyId, String query, Sort sort, int start,
72          int end) {
73  
74          this(command, companyId, null, null, query, sort, start, end);
75      }
76  
77      public SearchRequest(
78          String command, long companyId, String id, Document doc, String query,
79          Sort sort, int start, int end) {
80  
81          _command = command;
82          _companyId = companyId;
83          _id = id;
84          _doc = doc;
85          _query = query;
86          _sort = sort;
87          _start = start;
88          _end = end;
89      }
90  
91      public String getCommand() {
92          return _command;
93      }
94  
95      public void setCommand(String command) {
96          _command = command;
97      }
98  
99      public long getCompanyId() {
100         return _companyId;
101     }
102 
103     public void setCompanyId(long companyId) {
104         _companyId = companyId;
105     }
106 
107     public String getId() {
108         return _id;
109     }
110 
111     public void setId(String id) {
112         _id = id;
113     }
114 
115     public Document getDocument() {
116         return _doc;
117     }
118 
119     public void setDocument(Document doc) {
120         _doc = doc;
121     }
122 
123     public String getQuery() {
124         return _query;
125     }
126 
127     public void setQuery(String query) {
128         _query = query;
129     }
130 
131     public Sort getSort() {
132         return _sort;
133     }
134 
135     public void setSort(Sort sort) {
136         _sort = sort;
137     }
138 
139     public int getStart() {
140         return _start;
141     }
142 
143     public void setStart(int start) {
144         _start = start;
145     }
146 
147     public int getEnd() {
148         return _end;
149     }
150 
151     public void setEnd(int end) {
152         _end = end;
153     }
154 
155     private String _command;
156     private long _companyId;
157     private String _id;
158     private Document _doc;
159     private String _query;
160     private Sort _sort;
161     private int _start;
162     private int _end;
163 
164 }