PageRenderTime 24ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/portal-impl/src/com/liferay/portlet/polls/service/http/PollsQuestionServiceHttp.java

http://github.com/liferay/liferay-portal
Java | 235 lines | 158 code | 34 blank | 43 comment | 8 complexity | 0423af572197d8f10a0ef4e2e2c6ceeb MD5 | raw file
Possible License(s): LGPL-2.0
  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.portlet.polls.service.http;
  15. import com.liferay.portal.kernel.log.Log;
  16. import com.liferay.portal.kernel.log.LogFactoryUtil;
  17. import com.liferay.portal.kernel.util.MethodHandler;
  18. import com.liferay.portal.kernel.util.MethodKey;
  19. import com.liferay.portal.security.auth.HttpPrincipal;
  20. import com.liferay.portal.service.http.TunnelUtil;
  21. import com.liferay.portlet.polls.service.PollsQuestionServiceUtil;
  22. /**
  23. * <p>
  24. * This class provides a HTTP utility for the
  25. * {@link com.liferay.portlet.polls.service.PollsQuestionServiceUtil} service 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. * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
  29. * </p>
  30. *
  31. * <p>
  32. * The benefits of using the HTTP utility is that it is fast and allows for
  33. * tunneling without the cost of serializing to text. The drawback is that it
  34. * only works with Java.
  35. * </p>
  36. *
  37. * <p>
  38. * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
  39. * configure security.
  40. * </p>
  41. *
  42. * <p>
  43. * The HTTP utility is only generated for remote services.
  44. * </p>
  45. *
  46. * @author Brian Wing Shun Chan
  47. * @see PollsQuestionServiceSoap
  48. * @see com.liferay.portal.security.auth.HttpPrincipal
  49. * @see com.liferay.portlet.polls.service.PollsQuestionServiceUtil
  50. * @generated
  51. */
  52. public class PollsQuestionServiceHttp {
  53. public static com.liferay.portlet.polls.model.PollsQuestion addQuestion(
  54. HttpPrincipal httpPrincipal,
  55. java.util.Map<java.util.Locale, java.lang.String> titleMap,
  56. java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
  57. int expirationDateMonth, int expirationDateDay, int expirationDateYear,
  58. int expirationDateHour, int expirationDateMinute, boolean neverExpire,
  59. java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
  60. com.liferay.portal.service.ServiceContext serviceContext)
  61. throws com.liferay.portal.kernel.exception.PortalException,
  62. com.liferay.portal.kernel.exception.SystemException {
  63. try {
  64. MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class,
  65. "addQuestion", _addQuestionParameterTypes0);
  66. MethodHandler methodHandler = new MethodHandler(methodKey,
  67. titleMap, descriptionMap, expirationDateMonth,
  68. expirationDateDay, expirationDateYear, expirationDateHour,
  69. expirationDateMinute, neverExpire, choices, serviceContext);
  70. Object returnObj = null;
  71. try {
  72. returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
  73. }
  74. catch (Exception e) {
  75. if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
  76. throw (com.liferay.portal.kernel.exception.PortalException)e;
  77. }
  78. if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
  79. throw (com.liferay.portal.kernel.exception.SystemException)e;
  80. }
  81. throw new com.liferay.portal.kernel.exception.SystemException(e);
  82. }
  83. return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
  84. }
  85. catch (com.liferay.portal.kernel.exception.SystemException se) {
  86. _log.error(se, se);
  87. throw se;
  88. }
  89. }
  90. public static void deleteQuestion(HttpPrincipal httpPrincipal,
  91. long questionId)
  92. throws com.liferay.portal.kernel.exception.PortalException,
  93. com.liferay.portal.kernel.exception.SystemException {
  94. try {
  95. MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class,
  96. "deleteQuestion", _deleteQuestionParameterTypes1);
  97. MethodHandler methodHandler = new MethodHandler(methodKey,
  98. questionId);
  99. try {
  100. TunnelUtil.invoke(httpPrincipal, methodHandler);
  101. }
  102. catch (Exception e) {
  103. if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
  104. throw (com.liferay.portal.kernel.exception.PortalException)e;
  105. }
  106. if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
  107. throw (com.liferay.portal.kernel.exception.SystemException)e;
  108. }
  109. throw new com.liferay.portal.kernel.exception.SystemException(e);
  110. }
  111. }
  112. catch (com.liferay.portal.kernel.exception.SystemException se) {
  113. _log.error(se, se);
  114. throw se;
  115. }
  116. }
  117. public static com.liferay.portlet.polls.model.PollsQuestion getQuestion(
  118. HttpPrincipal httpPrincipal, long questionId)
  119. throws com.liferay.portal.kernel.exception.PortalException,
  120. com.liferay.portal.kernel.exception.SystemException {
  121. try {
  122. MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class,
  123. "getQuestion", _getQuestionParameterTypes2);
  124. MethodHandler methodHandler = new MethodHandler(methodKey,
  125. questionId);
  126. Object returnObj = null;
  127. try {
  128. returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
  129. }
  130. catch (Exception e) {
  131. if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
  132. throw (com.liferay.portal.kernel.exception.PortalException)e;
  133. }
  134. if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
  135. throw (com.liferay.portal.kernel.exception.SystemException)e;
  136. }
  137. throw new com.liferay.portal.kernel.exception.SystemException(e);
  138. }
  139. return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
  140. }
  141. catch (com.liferay.portal.kernel.exception.SystemException se) {
  142. _log.error(se, se);
  143. throw se;
  144. }
  145. }
  146. public static com.liferay.portlet.polls.model.PollsQuestion updateQuestion(
  147. HttpPrincipal httpPrincipal, long questionId,
  148. java.util.Map<java.util.Locale, java.lang.String> titleMap,
  149. java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
  150. int expirationDateMonth, int expirationDateDay, int expirationDateYear,
  151. int expirationDateHour, int expirationDateMinute, boolean neverExpire,
  152. java.util.List<com.liferay.portlet.polls.model.PollsChoice> choices,
  153. com.liferay.portal.service.ServiceContext serviceContext)
  154. throws com.liferay.portal.kernel.exception.PortalException,
  155. com.liferay.portal.kernel.exception.SystemException {
  156. try {
  157. MethodKey methodKey = new MethodKey(PollsQuestionServiceUtil.class,
  158. "updateQuestion", _updateQuestionParameterTypes3);
  159. MethodHandler methodHandler = new MethodHandler(methodKey,
  160. questionId, titleMap, descriptionMap, expirationDateMonth,
  161. expirationDateDay, expirationDateYear, expirationDateHour,
  162. expirationDateMinute, neverExpire, choices, serviceContext);
  163. Object returnObj = null;
  164. try {
  165. returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
  166. }
  167. catch (Exception e) {
  168. if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
  169. throw (com.liferay.portal.kernel.exception.PortalException)e;
  170. }
  171. if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
  172. throw (com.liferay.portal.kernel.exception.SystemException)e;
  173. }
  174. throw new com.liferay.portal.kernel.exception.SystemException(e);
  175. }
  176. return (com.liferay.portlet.polls.model.PollsQuestion)returnObj;
  177. }
  178. catch (com.liferay.portal.kernel.exception.SystemException se) {
  179. _log.error(se, se);
  180. throw se;
  181. }
  182. }
  183. private static Log _log = LogFactoryUtil.getLog(PollsQuestionServiceHttp.class);
  184. private static final Class<?>[] _addQuestionParameterTypes0 = new Class[] {
  185. java.util.Map.class, java.util.Map.class, int.class, int.class,
  186. int.class, int.class, int.class, boolean.class, java.util.List.class,
  187. com.liferay.portal.service.ServiceContext.class
  188. };
  189. private static final Class<?>[] _deleteQuestionParameterTypes1 = new Class[] {
  190. long.class
  191. };
  192. private static final Class<?>[] _getQuestionParameterTypes2 = new Class[] {
  193. long.class
  194. };
  195. private static final Class<?>[] _updateQuestionParameterTypes3 = new Class[] {
  196. long.class, java.util.Map.class, java.util.Map.class, int.class,
  197. int.class, int.class, int.class, int.class, boolean.class,
  198. java.util.List.class,
  199. com.liferay.portal.service.ServiceContext.class
  200. };
  201. }