/portal-service/src/com/liferay/portal/kernel/portlet/LiferayPortletURL.java

https://github.com/kevincho/liferay-portal · Java · 305 lines · 37 code · 33 blank · 235 comment · 0 complexity · 1e46bb3d0fa09be09cf113b082d8c38b MD5 · raw file

  1. /**
  2. * Copyright (c) 2000-2012 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. package com.liferay.portal.kernel.portlet;
  15. import java.io.Serializable;
  16. import java.util.Map;
  17. import java.util.Set;
  18. import javax.portlet.PortletURL;
  19. import javax.portlet.ResourceURL;
  20. /**
  21. * Represents a URL pointing to a portlet.
  22. *
  23. * @author Brian Wing Shun Chan
  24. * @see com.liferay.portlet.PortletURLImpl
  25. */
  26. public interface LiferayPortletURL
  27. extends PortletURL, ResourceURL, Serializable {
  28. /**
  29. * Adds a parameter that is included in the friendly URL path and does not
  30. * need to appear in the query string.
  31. *
  32. * @param name the name of the parameter
  33. */
  34. public void addParameterIncludedInPath(String name);
  35. /**
  36. * Returns the portlet lifecycle of this URL's target portlet.
  37. *
  38. * @return the portlet lifecycle of this URL's target portlet
  39. * @see #setLifecycle(String)
  40. */
  41. public String getLifecycle();
  42. /**
  43. * Returns the first value of the URL parameter.
  44. *
  45. * @param name the name of the URL parameter
  46. * @return the first value of the URL parameter
  47. */
  48. public String getParameter(String name);
  49. /**
  50. * Returns the parameters that are included in the friendly URL path and do
  51. * not need to appear in the query string.
  52. *
  53. * @return the names of the parameters that are included in the friendly URL
  54. * path and do not need to appear in the query string
  55. */
  56. public Set<String> getParametersIncludedInPath();
  57. /**
  58. * Returns the ID of this URL's target portlet.
  59. *
  60. * @return the ID of this URL's target portlet
  61. */
  62. public String getPortletId();
  63. /**
  64. * Returns the map of reserved parameters for this URL.
  65. *
  66. * <p>
  67. * This method is only used internally. Reserved parameters contain special,
  68. * Liferay specific information, such as <code>p_p_id</code> and
  69. * <code>p_p_lifecycle</code>.
  70. * </p>
  71. *
  72. * @return the reserved parameter names and values in a read-only map
  73. */
  74. public Map<String, String> getReservedParameterMap();
  75. /**
  76. * Returns the ID of this URL's target resource.
  77. *
  78. * @return the ID of this URL's target resource
  79. */
  80. public String getResourceID();
  81. /**
  82. * Returns <code>true</code> if this URL is an anchor pointing to the
  83. * specified portlet on the page.
  84. *
  85. * @return whether this URL is an anchor pointing to the specified portlet
  86. * on the page
  87. * @see #setAnchor(boolean)
  88. */
  89. public boolean isAnchor();
  90. /**
  91. * Returns <code>true</code> if the render parameters in the current request
  92. * should be copied to this URL.
  93. *
  94. * @return whether the render parameters in the current request should be
  95. * copied to this URL
  96. * @see #setCopyCurrentRenderParameters(boolean)
  97. */
  98. public boolean isCopyCurrentRenderParameters();
  99. /**
  100. * Returns <code>true</code> if this URL should be encrypted.
  101. *
  102. * @return <code>true</code> if this URL should be encrypted;
  103. * <code>false</code> otherwise
  104. * @see #setEncrypt(boolean)
  105. */
  106. public boolean isEncrypt();
  107. /**
  108. * Returns <code>true</code> if this URL should be XML escaped.
  109. *
  110. * @return <code>true</code> if this URL should be XML escaped;
  111. * <code>false</code> otherwise
  112. * @see #setEscapeXml(boolean)
  113. */
  114. public boolean isEscapeXml();
  115. /**
  116. * Returns <code>true</code> if the parameter is included in the friendly
  117. * URL path.
  118. *
  119. * @param name the name of the parameter to check for inclusion in the path
  120. * @return whether the parameter is included in the friendly URL path
  121. * @see #addParameterIncludedInPath(String)
  122. */
  123. public boolean isParameterIncludedInPath(String name);
  124. /**
  125. * Returns <code>true</code> if this URL is secure (https).
  126. *
  127. * @return <code>true</code> if this URL is secure; <code>false</code>
  128. * otherwise
  129. */
  130. public boolean isSecure();
  131. /**
  132. * Sets whether this URL is an anchor pointing to the specified portlet on
  133. * the page.
  134. *
  135. * <p>
  136. * An anchor URL will cause the user's browser to automatically jump down to
  137. * the specified portlet after the page loads, avoiding the need to scroll.
  138. * </p>
  139. *
  140. * @param anchor whether this URL is an anchor pointing to the specified
  141. * portlet on the page
  142. */
  143. public void setAnchor(boolean anchor);
  144. public void setControlPanelCategory(String controlPanelCategory);
  145. /**
  146. * Sets whether the render parameters in the current request should be
  147. * copied to this URL.
  148. *
  149. * <p>
  150. * New parameters set on this URL will appear before the copied render
  151. * parameters.
  152. * </p>
  153. *
  154. * @param copyCurrentRenderParameters whether the render parameters in the
  155. * current request should be copied to this URL
  156. */
  157. public void setCopyCurrentRenderParameters(
  158. boolean copyCurrentRenderParameters);
  159. public void setDoAsGroupId(long doAsGroupId);
  160. /**
  161. * Sets the ID of the user to impersonate.
  162. *
  163. * <p>
  164. * When a page is accessed while impersonating a user, it will appear
  165. * exactly as it would to that user.
  166. * </p>
  167. *
  168. * @param doAsUserId the ID of the user to impersonate in the portlet this
  169. * URL points to
  170. */
  171. public void setDoAsUserId(long doAsUserId);
  172. /**
  173. * Sets the language ID of the user to impersonate. This will only have an
  174. * effect when a user is being impersonated via {@link
  175. * #setDoAsUserId(long)}.
  176. *
  177. * <p>
  178. * The language set here will override the impersonated user's default
  179. * language.
  180. * </p>
  181. *
  182. * @param doAsUserLanguageId the language ID of the user to impersonate
  183. */
  184. public void setDoAsUserLanguageId(String doAsUserLanguageId);
  185. /**
  186. * Sets whether this URL should be encrypted.
  187. *
  188. * <p>
  189. * In an encrypted URL, the value of every parameter will be encrypted using
  190. * the company's key. This allows sensitive information to be placed in the
  191. * URL without being vulnerable to snooping.
  192. * </p>
  193. *
  194. * <p>
  195. * Note that this is not the same as making a URL {@link #setSecure(boolean)
  196. * secure}.
  197. * </p>
  198. */
  199. public void setEncrypt(boolean encrypt);
  200. /**
  201. * Sets whether this URL should be XML escaped.
  202. *
  203. * <p>
  204. * If a URL is XML escaped, it will automatically have special characters
  205. * escaped when it is converted to a string or written to a {@link
  206. * java.io.Writer}.
  207. * </p>
  208. *
  209. * @param escapeXml whether this URL should be XML escaped
  210. */
  211. public void setEscapeXml(boolean escapeXml);
  212. /**
  213. * Sets the portlet lifecycle of this URL's target portlet.
  214. *
  215. * <p>
  216. * Valid lifecycles are:
  217. * </p>
  218. *
  219. * <ul>
  220. * <li>
  221. * {@link javax.portlet.PortletRequest#ACTION_PHASE}
  222. * </li>
  223. * <li>
  224. * {@link javax.portlet.PortletRequest#RENDER_PHASE}
  225. * </li>
  226. * <li>
  227. * {@link javax.portlet.PortletRequest#RESOURCE_PHASE}
  228. * </li>
  229. * </ul>
  230. *
  231. * @param lifecycle the portlet lifecycle
  232. */
  233. public void setLifecycle(String lifecycle);
  234. /**
  235. * Sets the URL parameter to the value.
  236. *
  237. * @param name the name of the URL parameter
  238. * @param value the value of the URL parameter
  239. * @param append whether the new value should be appended to any existing
  240. * values for the parameter. If <code>append</code> is
  241. * <code>false</code> any existing values will be overwritten with
  242. * the new value.
  243. */
  244. public void setParameter(String name, String value, boolean append);
  245. /**
  246. * Sets the URL parameter the values.
  247. *
  248. * @param name the name of the URL parameter
  249. * @param values the values of the URL parameter
  250. * @param append whether the new values should be appended to any existing
  251. * values for the parameter. If <code>append</code> is
  252. * <code>false</code> any existing values will be overwritten with
  253. * the new values.
  254. */
  255. public void setParameter(String name, String[] values, boolean append);
  256. /**
  257. * Sets the portlet layout ID.
  258. *
  259. * @param plid the portlet layout ID
  260. */
  261. public void setPlid(long plid);
  262. /**
  263. * Sets the ID of the target portlet.
  264. */
  265. public void setPortletId(String portletId);
  266. /**
  267. * Sets the referer layout ID.
  268. *
  269. * @param refererPlid the referer layout ID
  270. */
  271. public void setRefererPlid(long refererPlid);
  272. }