1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.search;
16  
17  import java.io.Serializable;
18  
19  /**
20   * <a href="Field.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Bruno Farache
23   * @author Brian Wing Shun Chan
24   * @author Allen Chiang
25   * @author Alex Wallace
26   */
27  public class Field implements Serializable {
28  
29      public static final String ASSET_CATEGORY_IDS = "assetCategoryIds";
30  
31      public static final String ASSET_TAG_NAMES = "assetTagNames";
32  
33      public static final String CATEGORY_ID = "categoryId";
34  
35      public static final String COMMENTS = "comments";
36  
37      public static final String COMPANY_ID = "companyId";
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 FOLDER_ID = "folderId";
48  
49      public static final String GROUP_ID = "groupId";
50  
51      public static final String GROUP_ROLE_ID = "groupRoleId";
52  
53      public static final String MODIFIED = "modified";
54  
55      public static final String NAME = "name";
56  
57      public static final String NODE_ID = "nodeId";
58  
59      public static final String PORTLET_ID = "portletId";
60  
61      public static final String PROPERTIES = "properties";
62  
63      public static final String ROLE_ID = "roleId";
64  
65      public static final String ROOT_ENTRY_CLASS_PK = "rootEntryClassPK";
66  
67      public static final String SCOPE_GROUP_ID = "scopeGroupId";
68  
69      public static final String TITLE = "title";
70  
71      public static final String TYPE = "type";
72  
73      public static final String UID = "uid";
74  
75      public static final String URL = "url";
76  
77      public static final String USER_ID = "userId";
78  
79      public static final String USER_NAME = "userName";
80  
81      public static final String VERSION = "version";
82  
83      public Field(String name, String value, boolean tokenized) {
84          this(name, new String[] {value}, tokenized);
85      }
86  
87      public Field(String name, String[] values, boolean tokenized) {
88          this(name, values, tokenized, 1);
89      }
90  
91      public Field(String name, String[] values, boolean tokenized, float boost) {
92          _name = name;
93          _values = values;
94          _tokenized = tokenized;
95          _boost = boost;
96      }
97  
98      public float getBoost() {
99          return _boost;
100     }
101 
102     public String getName() {
103         return _name;
104     }
105 
106     public String getValue() {
107         if ((_values != null) && (_values.length > 0)) {
108             return _values[0];
109         }
110         else {
111             return null;
112         }
113     }
114 
115     public String[] getValues() {
116         return _values;
117     }
118 
119     public boolean isTokenized() {
120         return _tokenized;
121     }
122 
123     public void setBoost(float boost) {
124         _boost = boost;
125     }
126 
127     public void setName(String name) {
128         _name = name;
129     }
130 
131     public void setTokenized(boolean type) {
132         _tokenized = type;
133     }
134 
135     public void setValue(String value) {
136         setValues(new String[] {value});
137     }
138 
139     public void setValues(String[] values) {
140         _values = values;
141     }
142 
143     private float _boost;
144     private String _name;
145     private boolean _tokenized;
146     private String[] _values;
147 
148 }