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.ParamUtil;
19  import com.liferay.portal.kernel.util.StringPool;
20  import com.liferay.portal.model.RoleConstants;
21  
22  import javax.portlet.PortletRequest;
23  
24  /**
25   * <a href="RoleDisplayTerms.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   */
29  public class RoleDisplayTerms extends DisplayTerms {
30  
31      public static final String DESCRIPTION = "description";
32  
33      public static final String NAME = "name";
34  
35      public static final String TYPE = "type";
36  
37      public RoleDisplayTerms(PortletRequest portletRequest) {
38          super(portletRequest);
39  
40          description = ParamUtil.getString(portletRequest, DESCRIPTION);
41          name = ParamUtil.getString(portletRequest, NAME);
42          type = ParamUtil.getInteger(portletRequest, TYPE);
43      }
44  
45      public String getDescription() {
46          return description;
47      }
48  
49      public String getName() {
50          return name;
51      }
52  
53      public int getType() {
54          if ((type == RoleConstants.TYPE_COMMUNITY) ||
55              (type == RoleConstants.TYPE_ORGANIZATION) ||
56              (type == RoleConstants.TYPE_REGULAR)) {
57  
58              return type;
59          }
60          else {
61              return 0;
62          }
63      }
64  
65      public String getTypeString() {
66          if ((type == RoleConstants.TYPE_COMMUNITY) ||
67              (type == RoleConstants.TYPE_ORGANIZATION) ||
68              (type == RoleConstants.TYPE_REGULAR)) {
69  
70              return String.valueOf(type);
71          }
72          else {
73              return StringPool.BLANK;
74          }
75      }
76  
77      protected String description;
78      protected String name;
79      protected int type;
80  
81  }