001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.enterpriseadmin.search;
016    
017    import com.liferay.portal.kernel.dao.search.DisplayTerms;
018    import com.liferay.portal.kernel.util.GetterUtil;
019    import com.liferay.portal.kernel.util.ParamUtil;
020    import com.liferay.portal.kernel.util.Validator;
021    
022    import javax.portlet.PortletRequest;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     */
027    public class UserDisplayTerms extends DisplayTerms {
028    
029            public static final String ACTIVE = "active";
030    
031            public static final String EMAIL_ADDRESS = "emailAddress";
032    
033            public static final String FIRST_NAME = "firstName";
034    
035            public static final String LAST_NAME = "lastName";
036    
037            public static final String MIDDLE_NAME = "middleName";
038    
039            public static final String ORGANIZATION_ID = "organizationId";
040    
041            public static final String ROLE_ID = "roleId";
042    
043            public static final String SCREEN_NAME = "screenName";
044    
045            public static final String USER_GROUP_ID = "userGroupId";
046    
047            public UserDisplayTerms(PortletRequest portletRequest) {
048                    super(portletRequest);
049    
050                    String activeString = ParamUtil.getString(portletRequest, ACTIVE);
051    
052                    if (Validator.isNotNull(activeString)) {
053                            active = GetterUtil.getBoolean(activeString);
054                    }
055    
056                    emailAddress = ParamUtil.getString(portletRequest, EMAIL_ADDRESS);
057                    firstName = ParamUtil.getString(portletRequest, FIRST_NAME);
058                    lastName = ParamUtil.getString(portletRequest, LAST_NAME);
059                    middleName = ParamUtil.getString(portletRequest, MIDDLE_NAME);
060                    organizationId = ParamUtil.getLong(portletRequest, ORGANIZATION_ID);
061                    roleId = ParamUtil.getLong(portletRequest, ROLE_ID);
062                    screenName = ParamUtil.getString(portletRequest, SCREEN_NAME);
063                    userGroupId = ParamUtil.getLong(portletRequest, USER_GROUP_ID);
064            }
065    
066            public Boolean getActive() {
067                    return active;
068            }
069    
070            public String getEmailAddress() {
071                    return emailAddress;
072            }
073    
074            public String getFirstName() {
075                    return firstName;
076            }
077    
078            public String getLastName() {
079                    return lastName;
080            }
081    
082            public String getMiddleName() {
083                    return middleName;
084            }
085    
086            public long getOrganizationId() {
087                    return organizationId;
088            }
089    
090            public long getRoleId() {
091                    return roleId;
092            }
093    
094            public String getScreenName() {
095                    return screenName;
096            }
097    
098            public long getUserGroupId() {
099                    return userGroupId;
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            protected Boolean active;
124            protected String emailAddress;
125            protected String firstName;
126            protected String lastName;
127            protected String middleName;
128            protected long organizationId;
129            protected long roleId;
130            protected String screenName;
131            protected long userGroupId;
132    
133    }