001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.social.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.social.service.SocialActivitySettingServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link com.liferay.portlet.social.service.SocialActivitySettingServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author Brian Wing Shun Chan
049     * @see SocialActivitySettingServiceSoap
050     * @see com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portlet.social.service.SocialActivitySettingServiceUtil
052     * @generated
053     */
054    public class SocialActivitySettingServiceHttp {
055            public static com.liferay.portlet.social.model.SocialActivityDefinition getActivityDefinition(
056                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
057                    int activityType)
058                    throws com.liferay.portal.kernel.exception.PortalException,
059                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
062                                            "getActivityDefinition",
063                                            _getActivityDefinitionParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
066                                            className, activityType);
067    
068                            Object returnObj = null;
069    
070                            try {
071                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
072                            }
073                            catch (Exception e) {
074                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
075                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
076                                    }
077    
078                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
079                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
080                                    }
081    
082                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
083                            }
084    
085                            return (com.liferay.portlet.social.model.SocialActivityDefinition)returnObj;
086                    }
087                    catch (com.liferay.portal.kernel.exception.SystemException se) {
088                            _log.error(se, se);
089    
090                            throw se;
091                    }
092            }
093    
094            public static java.util.List<com.liferay.portlet.social.model.SocialActivityDefinition> getActivityDefinitions(
095                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className)
096                    throws com.liferay.portal.kernel.exception.PortalException,
097                            com.liferay.portal.kernel.exception.SystemException {
098                    try {
099                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
100                                            "getActivityDefinitions",
101                                            _getActivityDefinitionsParameterTypes1);
102    
103                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
104                                            className);
105    
106                            Object returnObj = null;
107    
108                            try {
109                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
110                            }
111                            catch (Exception e) {
112                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
113                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
114                                    }
115    
116                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
117                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
118                                    }
119    
120                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
121                            }
122    
123                            return (java.util.List<com.liferay.portlet.social.model.SocialActivityDefinition>)returnObj;
124                    }
125                    catch (com.liferay.portal.kernel.exception.SystemException se) {
126                            _log.error(se, se);
127    
128                            throw se;
129                    }
130            }
131    
132            public static java.util.List<com.liferay.portlet.social.model.SocialActivitySetting> getActivitySettings(
133                    HttpPrincipal httpPrincipal, long groupId)
134                    throws com.liferay.portal.kernel.exception.PortalException,
135                            com.liferay.portal.kernel.exception.SystemException {
136                    try {
137                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
138                                            "getActivitySettings", _getActivitySettingsParameterTypes2);
139    
140                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
141    
142                            Object returnObj = null;
143    
144                            try {
145                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
146                            }
147                            catch (Exception e) {
148                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
149                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
150                                    }
151    
152                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
153                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
154                                    }
155    
156                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
157                            }
158    
159                            return (java.util.List<com.liferay.portlet.social.model.SocialActivitySetting>)returnObj;
160                    }
161                    catch (com.liferay.portal.kernel.exception.SystemException se) {
162                            _log.error(se, se);
163    
164                            throw se;
165                    }
166            }
167    
168            public static com.liferay.portal.kernel.json.JSONArray getJSONActivityDefinitions(
169                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className)
170                    throws com.liferay.portal.kernel.exception.PortalException,
171                            com.liferay.portal.kernel.exception.SystemException {
172                    try {
173                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
174                                            "getJSONActivityDefinitions",
175                                            _getJSONActivityDefinitionsParameterTypes3);
176    
177                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
178                                            className);
179    
180                            Object returnObj = null;
181    
182                            try {
183                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
184                            }
185                            catch (Exception e) {
186                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
187                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
188                                    }
189    
190                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
191                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
192                                    }
193    
194                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
195                            }
196    
197                            return (com.liferay.portal.kernel.json.JSONArray)returnObj;
198                    }
199                    catch (com.liferay.portal.kernel.exception.SystemException se) {
200                            _log.error(se, se);
201    
202                            throw se;
203                    }
204            }
205    
206            public static void updateActivitySetting(HttpPrincipal httpPrincipal,
207                    long groupId, java.lang.String className, boolean enabled)
208                    throws com.liferay.portal.kernel.exception.PortalException,
209                            com.liferay.portal.kernel.exception.SystemException {
210                    try {
211                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
212                                            "updateActivitySetting",
213                                            _updateActivitySettingParameterTypes4);
214    
215                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
216                                            className, enabled);
217    
218                            try {
219                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
220                            }
221                            catch (Exception e) {
222                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
223                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
224                                    }
225    
226                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
227                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
228                                    }
229    
230                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
231                            }
232                    }
233                    catch (com.liferay.portal.kernel.exception.SystemException se) {
234                            _log.error(se, se);
235    
236                            throw se;
237                    }
238            }
239    
240            public static void updateActivitySetting(HttpPrincipal httpPrincipal,
241                    long groupId, java.lang.String className, int activityType,
242                    com.liferay.portlet.social.model.SocialActivityCounterDefinition activityCounterDefinition)
243                    throws com.liferay.portal.kernel.exception.PortalException,
244                            com.liferay.portal.kernel.exception.SystemException {
245                    try {
246                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
247                                            "updateActivitySetting",
248                                            _updateActivitySettingParameterTypes5);
249    
250                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
251                                            className, activityType, activityCounterDefinition);
252    
253                            try {
254                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
255                            }
256                            catch (Exception e) {
257                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
258                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
259                                    }
260    
261                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
262                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
263                                    }
264    
265                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
266                            }
267                    }
268                    catch (com.liferay.portal.kernel.exception.SystemException se) {
269                            _log.error(se, se);
270    
271                            throw se;
272                    }
273            }
274    
275            public static void updateActivitySettings(HttpPrincipal httpPrincipal,
276                    long groupId, java.lang.String className, int activityType,
277                    java.util.List<com.liferay.portlet.social.model.SocialActivityCounterDefinition> activityCounterDefinitions)
278                    throws com.liferay.portal.kernel.exception.PortalException,
279                            com.liferay.portal.kernel.exception.SystemException {
280                    try {
281                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
282                                            "updateActivitySettings",
283                                            _updateActivitySettingsParameterTypes6);
284    
285                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
286                                            className, activityType, activityCounterDefinitions);
287    
288                            try {
289                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
290                            }
291                            catch (Exception e) {
292                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
293                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
294                                    }
295    
296                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
297                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
298                                    }
299    
300                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
301                            }
302                    }
303                    catch (com.liferay.portal.kernel.exception.SystemException se) {
304                            _log.error(se, se);
305    
306                            throw se;
307                    }
308            }
309    
310            private static Log _log = LogFactoryUtil.getLog(SocialActivitySettingServiceHttp.class);
311            private static final Class<?>[] _getActivityDefinitionParameterTypes0 = new Class[] {
312                            long.class, java.lang.String.class, int.class
313                    };
314            private static final Class<?>[] _getActivityDefinitionsParameterTypes1 = new Class[] {
315                            long.class, java.lang.String.class
316                    };
317            private static final Class<?>[] _getActivitySettingsParameterTypes2 = new Class[] {
318                            long.class
319                    };
320            private static final Class<?>[] _getJSONActivityDefinitionsParameterTypes3 = new Class[] {
321                            long.class, java.lang.String.class
322                    };
323            private static final Class<?>[] _updateActivitySettingParameterTypes4 = new Class[] {
324                            long.class, java.lang.String.class, boolean.class
325                    };
326            private static final Class<?>[] _updateActivitySettingParameterTypes5 = new Class[] {
327                            long.class, java.lang.String.class, int.class,
328                            com.liferay.portlet.social.model.SocialActivityCounterDefinition.class
329                    };
330            private static final Class<?>[] _updateActivitySettingsParameterTypes6 = new Class[] {
331                            long.class, java.lang.String.class, int.class, java.util.List.class
332                    };
333    }