1   /**
2    * Copyright (c) 2000-2009 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.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   */
38  public class UserDisplayTerms extends DisplayTerms {
39  
40      public static final String FIRST_NAME = "firstName";
41  
42      public static final String MIDDLE_NAME = "middleName";
43  
44      public static final String LAST_NAME = "lastName";
45  
46      public static final String SCREEN_NAME = "screenName";
47  
48      public static final String EMAIL_ADDRESS = "emailAddress";
49  
50      public static final String ACTIVE = "active";
51  
52      public static final String ORGANIZATION_ID = "organizationId";
53  
54      public static final String ROLE_ID = "roleId";
55  
56      public static final String USER_GROUP_ID = "userGroupId";
57  
58      public UserDisplayTerms(PortletRequest portletRequest) {
59          super(portletRequest);
60  
61          firstName = ParamUtil.getString(portletRequest, FIRST_NAME);
62          middleName = ParamUtil.getString(portletRequest, MIDDLE_NAME);
63          lastName = ParamUtil.getString(portletRequest, LAST_NAME);
64          screenName = ParamUtil.getString(portletRequest, SCREEN_NAME);
65          emailAddress = ParamUtil.getString(portletRequest, EMAIL_ADDRESS);
66  
67          String activeString = ParamUtil.getString(portletRequest, ACTIVE);
68  
69          if (Validator.isNotNull(activeString)) {
70              active = GetterUtil.getBoolean(activeString);
71          }
72  
73          organizationId = ParamUtil.getLong(portletRequest, ORGANIZATION_ID);
74          roleId = ParamUtil.getLong(portletRequest, ROLE_ID);
75          userGroupId = ParamUtil.getLong(portletRequest, USER_GROUP_ID);
76      }
77  
78      public String getFirstName() {
79          return firstName;
80      }
81  
82      public String getMiddleName() {
83          return middleName;
84      }
85  
86      public String getLastName() {
87          return lastName;
88      }
89  
90      public String getScreenName() {
91          return screenName;
92      }
93  
94      public String getEmailAddress() {
95          return emailAddress;
96      }
97  
98      public Boolean getActive() {
99          return active;
100     }
101 
102     public boolean hasActive() {
103         if (active == null) {
104             return false;
105         }
106         else {
107             return true;
108         }
109     }
110 
111     public boolean isActive() {
112         if (active == null) {
113             return true;
114         }
115 
116         return active.booleanValue();
117     }
118 
119     public void setActive(Boolean active) {
120         this.active = active;
121     }
122 
123     public long getOrganizationId() {
124         return organizationId;
125     }
126 
127     public long getRoleId() {
128         return roleId;
129     }
130 
131     public long getUserGroupId() {
132         return userGroupId;
133     }
134 
135     protected String firstName;
136     protected String middleName;
137     protected String lastName;
138     protected String screenName;
139     protected String emailAddress;
140     protected Boolean active;
141     protected long organizationId;
142     protected long roleId;
143     protected long userGroupId;
144 
145 }