001
014
015 package com.liferay.portal.comment.display.context.util;
016
017 import com.liferay.portal.kernel.util.GetterUtil;
018
019 import javax.servlet.http.HttpServletRequest;
020
021
024 public class DiscussionTaglibHelper {
025
026 public DiscussionTaglibHelper(HttpServletRequest request) {
027 _request = request;
028 }
029
030 public String getClassName() {
031 if (_className == null) {
032 HttpServletRequest request = getRequest();
033
034 _className = (String)request.getAttribute(
035 "liferay-ui:discussion:className");
036 }
037
038 return _className;
039 }
040
041 public long getClassPK() {
042 if (_classPK == null) {
043 HttpServletRequest request = getRequest();
044
045 _classPK = GetterUtil.getLong(
046 (String)request.getAttribute("liferay-ui:discussion:classPK"));
047 }
048
049 return _classPK;
050 }
051
052 public String getFormAction() {
053 if (_formAction == null) {
054 HttpServletRequest request = getRequest();
055
056 _formAction = (String)request.getAttribute(
057 "liferay-ui:discussion:formAction");
058 }
059
060 return _formAction;
061 }
062
063 public String getFormName() {
064 if (_formName == null) {
065 HttpServletRequest request = getRequest();
066
067 _formName = (String)request.getAttribute(
068 "liferay-ui:discussion:formName");
069 }
070
071 return _formName;
072 }
073
074 public String getPaginationURL() {
075 if (_paginationURL == null) {
076 HttpServletRequest request = getRequest();
077
078 _paginationURL = (String)request.getAttribute(
079 "liferay-ui:discussion:paginationURL");
080 }
081
082 return _paginationURL;
083 }
084
085 public String getRedirect() {
086 if (_redirect == null) {
087 HttpServletRequest request = getRequest();
088
089 _redirect = (String)request.getAttribute(
090 "liferay-ui:discussion:redirect");
091 }
092
093 return _redirect;
094 }
095
096 public long getUserId() {
097 if (_userId == null) {
098 HttpServletRequest request = getRequest();
099
100 _userId = GetterUtil.getLong(
101 (String)request.getAttribute("liferay-ui:discussion:userId"));
102 }
103
104 return _userId;
105 }
106
107 public boolean isAssetEntryVisible() {
108 if (_assetEntryVisible == null) {
109 HttpServletRequest request = getRequest();
110
111 _assetEntryVisible = GetterUtil.getBoolean(
112 (String)request.getAttribute(
113 "liferay-ui:discussion:assetEntryVisible"));
114 }
115
116 return _assetEntryVisible;
117 }
118
119 public boolean isHideControls() {
120 if (_hideControls == null) {
121 HttpServletRequest request = getRequest();
122
123 _hideControls = GetterUtil.getBoolean(
124 (String)request.getAttribute(
125 "liferay-ui:discussion:hideControls"));
126 }
127
128 return _hideControls;
129 }
130
131 public boolean isRatingsEnabled() {
132 if (_ratingsEnabled == null) {
133 HttpServletRequest request = getRequest();
134
135 _ratingsEnabled = GetterUtil.getBoolean(
136 (String)request.getAttribute(
137 "liferay-ui:discussion:ratingsEnabled"));
138 }
139
140 return _ratingsEnabled;
141 }
142
143 protected HttpServletRequest getRequest() {
144 return _request;
145 }
146
147 private Boolean _assetEntryVisible;
148 private String _className;
149 private Long _classPK;
150 private String _formAction;
151 private String _formName;
152 private Boolean _hideControls;
153 private String _paginationURL;
154 private Boolean _ratingsEnabled;
155 private String _redirect;
156 private final HttpServletRequest _request;
157 private Long _userId;
158
159 }