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;
24  
25  /**
26   * <a href="Field.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Bruno Farache
29   * @author Brian Wing Shun Chan
30   * @author Allen Chiang
31   *
32   */
33  public class Field {
34  
35      public static final String COMPANY_ID = "companyId";
36  
37      public static final String COMMENTS = "comments";
38  
39      public static final String CONTENT = "content";
40  
41      public static final String DESCRIPTION = "description";
42  
43      public static final String ENTRY_CLASS_NAME = "entryClassName";
44  
45      public static final String ENTRY_CLASS_PK = "entryClassPK";
46  
47      public static final String GROUP_ID = "groupId";
48  
49      public static final String MODIFIED = "modified";
50  
51      public static final String NAME = "name";
52  
53      public static final String PORTLET_ID = "portletId";
54  
55      public static final String PROPERTIES = "properties";
56  
57      public static final String TAGS_ENTRIES = "tagsEntries";
58  
59      public static final String TITLE = "title";
60  
61      public static final String TYPE = "type";
62  
63      public static final String UID = "uid";
64  
65      public static final String URL = "url";
66  
67      public static final String USER_ID = "userId";
68  
69      public static final String USER_NAME = "userName";
70  
71      public Field() {
72      }
73  
74      public Field(String name, String value, boolean tokenized) {
75          this(name, new String[] {value}, tokenized);
76      }
77  
78      public Field(String name, String[] values, boolean tokenized) {
79          _name = name;
80          _values = values;
81          _tokenized = tokenized;
82      }
83  
84      public String getName() {
85          return _name;
86      }
87  
88      public void setName(String name) {
89          _name = name;
90      }
91  
92      public boolean isTokenized() {
93          return _tokenized;
94      }
95  
96      public void setTokenized(boolean type) {
97          _tokenized = type;
98      }
99  
100     public String getValue() {
101         if ((_values != null) && (_values.length > 0)) {
102             return _values[0];
103         }
104         else {
105             return null;
106         }
107     }
108 
109     public void setValue(String value) {
110         setValues(new String[] {value});
111     }
112 
113     public String[] getValues() {
114         return _values;
115     }
116 
117     public void setValues(String[] values) {
118         _values = values;
119     }
120 
121     private String _name;
122     private boolean _tokenized;
123     private String[] _values;
124 
125 }