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