1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.enterpriseadmin.search;
21  
22  import com.liferay.portal.kernel.dao.search.DisplayTerms;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.ParamUtil;
25  import com.liferay.portal.kernel.util.Validator;
26  
27  import javax.portlet.PortletRequest;
28  
29  /**
30   * <a href="UserDisplayTerms.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   *
34   */
35  public class UserDisplayTerms extends DisplayTerms {
36  
37      public static final String FIRST_NAME = "firstName";
38  
39      public static final String MIDDLE_NAME = "middleName";
40  
41      public static final String LAST_NAME = "lastName";
42  
43      public static final String SCREEN_NAME = "screenName";
44  
45      public static final String EMAIL_ADDRESS = "emailAddress";
46  
47      public static final String ACTIVE = "active";
48  
49      public static final String ORGANIZATION_ID = "organizationId";
50  
51      public static final String ROLE_ID = "roleId";
52  
53      public static final String USER_GROUP_ID = "userGroupId";
54  
55      public UserDisplayTerms(PortletRequest portletRequest) {
56          super(portletRequest);
57  
58          firstName = ParamUtil.getString(portletRequest, FIRST_NAME);
59          middleName = ParamUtil.getString(portletRequest, MIDDLE_NAME);
60          lastName = ParamUtil.getString(portletRequest, LAST_NAME);
61          screenName = ParamUtil.getString(portletRequest, SCREEN_NAME);
62          emailAddress = ParamUtil.getString(portletRequest, EMAIL_ADDRESS);
63  
64          String activeString = ParamUtil.getString(portletRequest, ACTIVE);
65  
66          if (Validator.isNotNull(activeString)) {
67              active = GetterUtil.getBoolean(activeString);
68          }
69  
70          organizationId = ParamUtil.getLong(portletRequest, ORGANIZATION_ID);
71          roleId = ParamUtil.getLong(portletRequest, ROLE_ID);
72          userGroupId = ParamUtil.getLong(portletRequest, USER_GROUP_ID);
73      }
74  
75      public String getFirstName() {
76          return firstName;
77      }
78  
79      public String getMiddleName() {
80          return middleName;
81      }
82  
83      public String getLastName() {
84          return lastName;
85      }
86  
87      public String getScreenName() {
88          return screenName;
89      }
90  
91      public String getEmailAddress() {
92          return emailAddress;
93      }
94  
95      public Boolean getActive() {
96          return active;
97      }
98  
99      public boolean hasActive() {
100         if (active == null) {
101             return false;
102         }
103         else {
104             return true;
105         }
106     }
107 
108     public boolean isActive() {
109         if (active == null) {
110             return true;
111         }
112 
113         return active.booleanValue();
114     }
115 
116     public void setActive(Boolean active) {
117         this.active = active;
118     }
119 
120     public long getOrganizationId() {
121         return organizationId;
122     }
123 
124     public long getRoleId() {
125         return roleId;
126     }
127 
128     public long getUserGroupId() {
129         return userGroupId;
130     }
131 
132     protected String firstName;
133     protected String middleName;
134     protected String lastName;
135     protected String screenName;
136     protected String emailAddress;
137     protected Boolean active;
138     protected long organizationId;
139     protected long roleId;
140     protected long userGroupId;
141 
142 }