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.portlet.enterpriseadmin.search;
16  
17  import com.liferay.portal.kernel.dao.search.DisplayTerms;
18  import com.liferay.portal.kernel.util.GetterUtil;
19  import com.liferay.portal.kernel.util.ParamUtil;
20  import com.liferay.portal.kernel.util.Validator;
21  
22  import javax.portlet.PortletRequest;
23  
24  /**
25   * <a href="UserDisplayTerms.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class UserDisplayTerms extends DisplayTerms {
30  
31      public static final String ACTIVE = "active";
32  
33      public static final String EMAIL_ADDRESS = "emailAddress";
34  
35      public static final String FIRST_NAME = "firstName";
36  
37      public static final String LAST_NAME = "lastName";
38  
39      public static final String MIDDLE_NAME = "middleName";
40  
41      public static final String ORGANIZATION_ID = "organizationId";
42  
43      public static final String ROLE_ID = "roleId";
44  
45      public static final String SCREEN_NAME = "screenName";
46  
47      public static final String USER_GROUP_ID = "userGroupId";
48  
49      public UserDisplayTerms(PortletRequest portletRequest) {
50          super(portletRequest);
51  
52          String activeString = ParamUtil.getString(portletRequest, ACTIVE);
53  
54          if (Validator.isNotNull(activeString)) {
55              active = GetterUtil.getBoolean(activeString);
56          }
57  
58          emailAddress = ParamUtil.getString(portletRequest, EMAIL_ADDRESS);
59          firstName = ParamUtil.getString(portletRequest, FIRST_NAME);
60          lastName = ParamUtil.getString(portletRequest, LAST_NAME);
61          middleName = ParamUtil.getString(portletRequest, MIDDLE_NAME);
62          organizationId = ParamUtil.getLong(portletRequest, ORGANIZATION_ID);
63          roleId = ParamUtil.getLong(portletRequest, ROLE_ID);
64          screenName = ParamUtil.getString(portletRequest, SCREEN_NAME);
65          userGroupId = ParamUtil.getLong(portletRequest, USER_GROUP_ID);
66      }
67  
68      public Boolean getActive() {
69          return active;
70      }
71  
72      public String getEmailAddress() {
73          return emailAddress;
74      }
75  
76      public String getFirstName() {
77          return firstName;
78      }
79  
80      public String getLastName() {
81          return lastName;
82      }
83  
84      public String getMiddleName() {
85          return middleName;
86      }
87  
88      public long getOrganizationId() {
89          return organizationId;
90      }
91  
92      public long getRoleId() {
93          return roleId;
94      }
95  
96      public String getScreenName() {
97          return screenName;
98      }
99  
100     public long getUserGroupId() {
101         return userGroupId;
102     }
103 
104     public boolean hasActive() {
105         if (active == null) {
106             return false;
107         }
108         else {
109             return true;
110         }
111     }
112 
113     public boolean isActive() {
114         if (active == null) {
115             return true;
116         }
117 
118         return active.booleanValue();
119     }
120 
121     public void setActive(Boolean active) {
122         this.active = active;
123     }
124 
125     protected Boolean active;
126     protected String emailAddress;
127     protected String firstName;
128     protected String lastName;
129     protected String middleName;
130     protected long organizationId;
131     protected long roleId;
132     protected String screenName;
133     protected long userGroupId;
134 
135 }