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