001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.ratings.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.DoubleWrapper;
026: import com.liferay.portal.kernel.util.LongWrapper;
027: import com.liferay.portal.kernel.util.MethodWrapper;
028: import com.liferay.portal.kernel.util.NullWrapper;
029: import com.liferay.portal.security.auth.HttpPrincipal;
030: import com.liferay.portal.service.http.TunnelUtil;
031:
032: import com.liferay.portlet.ratings.service.RatingsEntryServiceUtil;
033:
034: /**
035: * <a href="RatingsEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
036: *
037: * <p>
038: * ServiceBuilder generated this class. Modifications in this class will be
039: * overwritten the next time is generated.
040: * </p>
041: *
042: * <p>
043: * This class provides a HTTP utility for the
044: * <code>com.liferay.portlet.ratings.service.RatingsEntryServiceUtil</code> service
045: * utility. The static methods of this class calls the same methods of the
046: * service utility. However, the signatures are different because it requires an
047: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
048: * parameter.
049: * </p>
050: *
051: * <p>
052: * The benefits of using the HTTP utility is that it is fast and allows for
053: * tunneling without the cost of serializing to text. The drawback is that it
054: * only works with Java.
055: * </p>
056: *
057: * <p>
058: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
059: * portal.properties to configure security.
060: * </p>
061: *
062: * <p>
063: * The HTTP utility is only generated for remote services.
064: * </p>
065: *
066: * @author Brian Wing Shun Chan
067: *
068: * @see com.liferay.portal.security.auth.HttpPrincipal
069: * @see com.liferay.portlet.ratings.service.RatingsEntryServiceUtil
070: * @see com.liferay.portlet.ratings.service.http.RatingsEntryServiceSoap
071: *
072: */
073: public class RatingsEntryServiceHttp {
074: public static com.liferay.portlet.ratings.model.RatingsEntry updateEntry(
075: HttpPrincipal httpPrincipal, java.lang.String className,
076: long classPK, double score)
077: throws com.liferay.portal.SystemException,
078: com.liferay.portal.PortalException {
079: try {
080: Object paramObj0 = className;
081:
082: if (className == null) {
083: paramObj0 = new NullWrapper("java.lang.String");
084: }
085:
086: Object paramObj1 = new LongWrapper(classPK);
087:
088: Object paramObj2 = new DoubleWrapper(score);
089:
090: MethodWrapper methodWrapper = new MethodWrapper(
091: RatingsEntryServiceUtil.class.getName(),
092: "updateEntry", new Object[] { paramObj0, paramObj1,
093: paramObj2 });
094:
095: Object returnObj = null;
096:
097: try {
098: returnObj = TunnelUtil.invoke(httpPrincipal,
099: methodWrapper);
100: } catch (Exception e) {
101: if (e instanceof com.liferay.portal.SystemException) {
102: throw (com.liferay.portal.SystemException) e;
103: }
104:
105: if (e instanceof com.liferay.portal.PortalException) {
106: throw (com.liferay.portal.PortalException) e;
107: }
108:
109: throw new com.liferay.portal.SystemException(e);
110: }
111:
112: return (com.liferay.portlet.ratings.model.RatingsEntry) returnObj;
113: } catch (com.liferay.portal.SystemException se) {
114: _log.error(se, se);
115:
116: throw se;
117: }
118: }
119:
120: private static Log _log = LogFactoryUtil
121: .getLog(RatingsEntryServiceHttp.class);
122: }
|