| RatingsEntryServiceHttp.java |
1 /**
2 * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3 *
4 *
5 *
6 *
7 * The contents of this file are subject to the terms of the Liferay Enterprise
8 * Subscription License ("License"). You may not use this file except in
9 * compliance with the License. You can obtain a copy of the License by
10 * contacting Liferay, Inc. See the License for the specific language governing
11 * permissions and limitations under the License, including but not limited to
12 * distribution rights of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 package com.liferay.portlet.ratings.service.http;
24
25 import com.liferay.portal.kernel.log.Log;
26 import com.liferay.portal.kernel.log.LogFactoryUtil;
27 import com.liferay.portal.kernel.util.DoubleWrapper;
28 import com.liferay.portal.kernel.util.LongWrapper;
29 import com.liferay.portal.kernel.util.MethodWrapper;
30 import com.liferay.portal.kernel.util.NullWrapper;
31 import com.liferay.portal.security.auth.HttpPrincipal;
32 import com.liferay.portal.service.http.TunnelUtil;
33
34 import com.liferay.portlet.ratings.service.RatingsEntryServiceUtil;
35
36 /**
37 * <a href="RatingsEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
38 *
39 * <p>
40 * ServiceBuilder generated this class. Modifications in this class will be
41 * overwritten the next time is generated.
42 * </p>
43 *
44 * <p>
45 * This class provides a HTTP utility for the
46 * {@link com.liferay.portlet.ratings.service.RatingsEntryServiceUtil} service utility. The
47 * static methods of this class calls the same methods of the service utility.
48 * However, the signatures are different because it requires an additional
49 * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
50 * </p>
51 *
52 * <p>
53 * The benefits of using the HTTP utility is that it is fast and allows for
54 * tunneling without the cost of serializing to text. The drawback is that it
55 * only works with Java.
56 * </p>
57 *
58 * <p>
59 * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
60 * configure security.
61 * </p>
62 *
63 * <p>
64 * The HTTP utility is only generated for remote services.
65 * </p>
66 *
67 * @author Brian Wing Shun Chan
68 * @see RatingsEntryServiceSoap
69 * @see com.liferay.portal.security.auth.HttpPrincipal
70 * @see com.liferay.portlet.ratings.service.RatingsEntryServiceUtil
71 * @generated
72 */
73 public class RatingsEntryServiceHttp {
74 public static void deleteEntry(HttpPrincipal httpPrincipal,
75 java.lang.String className, long classPK)
76 throws com.liferay.portal.PortalException,
77 com.liferay.portal.SystemException {
78 try {
79 Object paramObj0 = className;
80
81 if (className == null) {
82 paramObj0 = new NullWrapper("java.lang.String");
83 }
84
85 Object paramObj1 = new LongWrapper(classPK);
86
87 MethodWrapper methodWrapper = new MethodWrapper(RatingsEntryServiceUtil.class.getName(),
88 "deleteEntry", new Object[] { paramObj0, paramObj1 });
89
90 try {
91 TunnelUtil.invoke(httpPrincipal, methodWrapper);
92 }
93 catch (Exception e) {
94 if (e instanceof com.liferay.portal.PortalException) {
95 throw (com.liferay.portal.PortalException)e;
96 }
97
98 if (e instanceof com.liferay.portal.SystemException) {
99 throw (com.liferay.portal.SystemException)e;
100 }
101
102 throw new com.liferay.portal.SystemException(e);
103 }
104 }
105 catch (com.liferay.portal.SystemException se) {
106 _log.error(se, se);
107
108 throw se;
109 }
110 }
111
112 public static com.liferay.portlet.ratings.model.RatingsEntry updateEntry(
113 HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
114 double score)
115 throws com.liferay.portal.PortalException,
116 com.liferay.portal.SystemException {
117 try {
118 Object paramObj0 = className;
119
120 if (className == null) {
121 paramObj0 = new NullWrapper("java.lang.String");
122 }
123
124 Object paramObj1 = new LongWrapper(classPK);
125
126 Object paramObj2 = new DoubleWrapper(score);
127
128 MethodWrapper methodWrapper = new MethodWrapper(RatingsEntryServiceUtil.class.getName(),
129 "updateEntry",
130 new Object[] { paramObj0, paramObj1, paramObj2 });
131
132 Object returnObj = null;
133
134 try {
135 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
136 }
137 catch (Exception e) {
138 if (e instanceof com.liferay.portal.PortalException) {
139 throw (com.liferay.portal.PortalException)e;
140 }
141
142 if (e instanceof com.liferay.portal.SystemException) {
143 throw (com.liferay.portal.SystemException)e;
144 }
145
146 throw new com.liferay.portal.SystemException(e);
147 }
148
149 return (com.liferay.portlet.ratings.model.RatingsEntry)returnObj;
150 }
151 catch (com.liferay.portal.SystemException se) {
152 _log.error(se, se);
153
154 throw se;
155 }
156 }
157
158 private static Log _log = LogFactoryUtil.getLog(RatingsEntryServiceHttp.class);
159 }