1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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.portlet.enterpriseadmin.search;
24  
25  import com.liferay.portal.kernel.dao.search.DisplayTerms;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.kernel.util.ParamUtil;
28  import com.liferay.portal.kernel.util.Validator;
29  
30  import javax.portlet.PortletRequest;
31  
32  /**
33   * <a href="UserDisplayTerms.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   */
37  public class UserDisplayTerms extends DisplayTerms {
38  
39      public static final String FIRST_NAME = "firstName";
40  
41      public static final String MIDDLE_NAME = "middleName";
42  
43      public static final String LAST_NAME = "lastName";
44  
45      public static final String SCREEN_NAME = "screenName";
46  
47      public static final String EMAIL_ADDRESS = "emailAddress";
48  
49      public static final String ACTIVE = "active";
50  
51      public static final String ORGANIZATION_ID = "organizationId";
52  
53      public static final String ROLE_ID = "roleId";
54  
55      public static final String USER_GROUP_ID = "userGroupId";
56  
57      public UserDisplayTerms(PortletRequest portletRequest) {
58          super(portletRequest);
59  
60          firstName = ParamUtil.getString(portletRequest, FIRST_NAME);
61          middleName = ParamUtil.getString(portletRequest, MIDDLE_NAME);
62          lastName = ParamUtil.getString(portletRequest, LAST_NAME);
63          screenName = ParamUtil.getString(portletRequest, SCREEN_NAME);
64          emailAddress = ParamUtil.getString(portletRequest, EMAIL_ADDRESS);
65  
66          String activeString = ParamUtil.getString(portletRequest, ACTIVE);
67  
68          if (Validator.isNotNull(activeString)) {
69              active = GetterUtil.getBoolean(activeString);
70          }
71  
72          organizationId = ParamUtil.getLong(portletRequest, ORGANIZATION_ID);
73          roleId = ParamUtil.getLong(portletRequest, ROLE_ID);
74          userGroupId = ParamUtil.getLong(portletRequest, USER_GROUP_ID);
75      }
76  
77      public String getFirstName() {
78          return firstName;
79      }
80  
81      public String getMiddleName() {
82          return middleName;
83      }
84  
85      public String getLastName() {
86          return lastName;
87      }
88  
89      public String getScreenName() {
90          return screenName;
91      }
92  
93      public String getEmailAddress() {
94          return emailAddress;
95      }
96  
97      public Boolean getActive() {
98          return active;
99      }
100 
101     public boolean hasActive() {
102         if (active == null) {
103             return false;
104         }
105         else {
106             return true;
107         }
108     }
109 
110     public boolean isActive() {
111         if (active == null) {
112             return true;
113         }
114 
115         return active.booleanValue();
116     }
117 
118     public void setActive(Boolean active) {
119         this.active = active;
120     }
121 
122     public long getOrganizationId() {
123         return organizationId;
124     }
125 
126     public long getRoleId() {
127         return roleId;
128     }
129 
130     public long getUserGroupId() {
131         return userGroupId;
132     }
133 
134     protected String firstName;
135     protected String middleName;
136     protected String lastName;
137     protected String screenName;
138     protected String emailAddress;
139     protected Boolean active;
140     protected long organizationId;
141     protected long roleId;
142     protected long userGroupId;
143 
144 }