PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/portal-impl/src/com/liferay/portal/service/http/WebsiteServiceHttp.java

http://github.com/liferay/liferay-portal
Java | 273 lines | 179 code | 54 blank | 40 comment | 5 complexity | d5abdb7985e7e141c81527118c613fb2 MD5 | raw file
Possible License(s): LGPL-2.0
  1. /**
  2. * Copyright (c) 2000-present 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.service.http;
  15. import com.liferay.portal.kernel.log.Log;
  16. import com.liferay.portal.kernel.log.LogFactoryUtil;
  17. import com.liferay.portal.kernel.security.auth.HttpPrincipal;
  18. import com.liferay.portal.kernel.service.WebsiteServiceUtil;
  19. import com.liferay.portal.kernel.service.http.TunnelUtil;
  20. import com.liferay.portal.kernel.util.MethodHandler;
  21. import com.liferay.portal.kernel.util.MethodKey;
  22. /**
  23. * Provides the HTTP utility for the
  24. * <code>WebsiteServiceUtil</code> service
  25. * utility. The
  26. * static methods of this class calls the same methods of the service utility.
  27. * However, the signatures are different because it requires an additional
  28. * <code>HttpPrincipal</code> parameter.
  29. *
  30. * <p>
  31. * The benefits of using the HTTP utility is that it is fast and allows for
  32. * tunneling without the cost of serializing to text. The drawback is that it
  33. * only works with Java.
  34. * </p>
  35. *
  36. * <p>
  37. * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
  38. * configure security.
  39. * </p>
  40. *
  41. * <p>
  42. * The HTTP utility is only generated for remote services.
  43. * </p>
  44. *
  45. * @author Brian Wing Shun Chan
  46. * @see WebsiteServiceSoap
  47. * @generated
  48. */
  49. public class WebsiteServiceHttp {
  50. public static com.liferay.portal.kernel.model.Website addWebsite(
  51. HttpPrincipal httpPrincipal, String className, long classPK,
  52. String url, long typeId, boolean primary,
  53. com.liferay.portal.kernel.service.ServiceContext serviceContext)
  54. throws com.liferay.portal.kernel.exception.PortalException {
  55. try {
  56. MethodKey methodKey = new MethodKey(
  57. WebsiteServiceUtil.class, "addWebsite",
  58. _addWebsiteParameterTypes0);
  59. MethodHandler methodHandler = new MethodHandler(
  60. methodKey, className, classPK, url, typeId, primary,
  61. serviceContext);
  62. Object returnObj = null;
  63. try {
  64. returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
  65. }
  66. catch (Exception exception) {
  67. if (exception instanceof
  68. com.liferay.portal.kernel.exception.PortalException) {
  69. throw (com.liferay.portal.kernel.exception.PortalException)
  70. exception;
  71. }
  72. throw new com.liferay.portal.kernel.exception.SystemException(
  73. exception);
  74. }
  75. return (com.liferay.portal.kernel.model.Website)returnObj;
  76. }
  77. catch (com.liferay.portal.kernel.exception.SystemException
  78. systemException) {
  79. _log.error(systemException, systemException);
  80. throw systemException;
  81. }
  82. }
  83. public static void deleteWebsite(
  84. HttpPrincipal httpPrincipal, long websiteId)
  85. throws com.liferay.portal.kernel.exception.PortalException {
  86. try {
  87. MethodKey methodKey = new MethodKey(
  88. WebsiteServiceUtil.class, "deleteWebsite",
  89. _deleteWebsiteParameterTypes1);
  90. MethodHandler methodHandler = new MethodHandler(
  91. methodKey, websiteId);
  92. try {
  93. TunnelUtil.invoke(httpPrincipal, methodHandler);
  94. }
  95. catch (Exception exception) {
  96. if (exception instanceof
  97. com.liferay.portal.kernel.exception.PortalException) {
  98. throw (com.liferay.portal.kernel.exception.PortalException)
  99. exception;
  100. }
  101. throw new com.liferay.portal.kernel.exception.SystemException(
  102. exception);
  103. }
  104. }
  105. catch (com.liferay.portal.kernel.exception.SystemException
  106. systemException) {
  107. _log.error(systemException, systemException);
  108. throw systemException;
  109. }
  110. }
  111. public static com.liferay.portal.kernel.model.Website getWebsite(
  112. HttpPrincipal httpPrincipal, long websiteId)
  113. throws com.liferay.portal.kernel.exception.PortalException {
  114. try {
  115. MethodKey methodKey = new MethodKey(
  116. WebsiteServiceUtil.class, "getWebsite",
  117. _getWebsiteParameterTypes2);
  118. MethodHandler methodHandler = new MethodHandler(
  119. methodKey, websiteId);
  120. Object returnObj = null;
  121. try {
  122. returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
  123. }
  124. catch (Exception exception) {
  125. if (exception instanceof
  126. com.liferay.portal.kernel.exception.PortalException) {
  127. throw (com.liferay.portal.kernel.exception.PortalException)
  128. exception;
  129. }
  130. throw new com.liferay.portal.kernel.exception.SystemException(
  131. exception);
  132. }
  133. return (com.liferay.portal.kernel.model.Website)returnObj;
  134. }
  135. catch (com.liferay.portal.kernel.exception.SystemException
  136. systemException) {
  137. _log.error(systemException, systemException);
  138. throw systemException;
  139. }
  140. }
  141. public static java.util.List<com.liferay.portal.kernel.model.Website>
  142. getWebsites(
  143. HttpPrincipal httpPrincipal, String className, long classPK)
  144. throws com.liferay.portal.kernel.exception.PortalException {
  145. try {
  146. MethodKey methodKey = new MethodKey(
  147. WebsiteServiceUtil.class, "getWebsites",
  148. _getWebsitesParameterTypes3);
  149. MethodHandler methodHandler = new MethodHandler(
  150. methodKey, className, classPK);
  151. Object returnObj = null;
  152. try {
  153. returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
  154. }
  155. catch (Exception exception) {
  156. if (exception instanceof
  157. com.liferay.portal.kernel.exception.PortalException) {
  158. throw (com.liferay.portal.kernel.exception.PortalException)
  159. exception;
  160. }
  161. throw new com.liferay.portal.kernel.exception.SystemException(
  162. exception);
  163. }
  164. return (java.util.List<com.liferay.portal.kernel.model.Website>)
  165. returnObj;
  166. }
  167. catch (com.liferay.portal.kernel.exception.SystemException
  168. systemException) {
  169. _log.error(systemException, systemException);
  170. throw systemException;
  171. }
  172. }
  173. public static com.liferay.portal.kernel.model.Website updateWebsite(
  174. HttpPrincipal httpPrincipal, long websiteId, String url,
  175. long typeId, boolean primary)
  176. throws com.liferay.portal.kernel.exception.PortalException {
  177. try {
  178. MethodKey methodKey = new MethodKey(
  179. WebsiteServiceUtil.class, "updateWebsite",
  180. _updateWebsiteParameterTypes4);
  181. MethodHandler methodHandler = new MethodHandler(
  182. methodKey, websiteId, url, typeId, primary);
  183. Object returnObj = null;
  184. try {
  185. returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
  186. }
  187. catch (Exception exception) {
  188. if (exception instanceof
  189. com.liferay.portal.kernel.exception.PortalException) {
  190. throw (com.liferay.portal.kernel.exception.PortalException)
  191. exception;
  192. }
  193. throw new com.liferay.portal.kernel.exception.SystemException(
  194. exception);
  195. }
  196. return (com.liferay.portal.kernel.model.Website)returnObj;
  197. }
  198. catch (com.liferay.portal.kernel.exception.SystemException
  199. systemException) {
  200. _log.error(systemException, systemException);
  201. throw systemException;
  202. }
  203. }
  204. private static Log _log = LogFactoryUtil.getLog(WebsiteServiceHttp.class);
  205. private static final Class<?>[] _addWebsiteParameterTypes0 = new Class[] {
  206. String.class, long.class, String.class, long.class, boolean.class,
  207. com.liferay.portal.kernel.service.ServiceContext.class
  208. };
  209. private static final Class<?>[] _deleteWebsiteParameterTypes1 =
  210. new Class[] {long.class};
  211. private static final Class<?>[] _getWebsiteParameterTypes2 = new Class[] {
  212. long.class
  213. };
  214. private static final Class<?>[] _getWebsitesParameterTypes3 = new Class[] {
  215. String.class, long.class
  216. };
  217. private static final Class<?>[] _updateWebsiteParameterTypes4 =
  218. new Class[] {long.class, String.class, long.class, boolean.class};
  219. }