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.getName(),
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.getName(),
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 com.liferay.portal.kernel.json.JSONArray getJSONActivityDefinitions(
135                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className)
136                    throws com.liferay.portal.kernel.exception.PortalException,
137                            com.liferay.portal.kernel.exception.SystemException {
138                    try {
139                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class.getName(),
140                                            "getJSONActivityDefinitions",
141                                            _getJSONActivityDefinitionsParameterTypes2);
142    
143                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
144                                            className);
145    
146                            Object returnObj = null;
147    
148                            try {
149                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
150                            }
151                            catch (Exception e) {
152                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
153                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
154                                    }
155    
156                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
157                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
158                                    }
159    
160                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
161                            }
162    
163                            return (com.liferay.portal.kernel.json.JSONArray)returnObj;
164                    }
165                    catch (com.liferay.portal.kernel.exception.SystemException se) {
166                            _log.error(se, se);
167    
168                            throw se;
169                    }
170            }
171    
172            public static void updateActivitySetting(HttpPrincipal httpPrincipal,
173                    long groupId, java.lang.String className, boolean enabled)
174                    throws com.liferay.portal.kernel.exception.PortalException,
175                            com.liferay.portal.kernel.exception.SystemException {
176                    try {
177                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class.getName(),
178                                            "updateActivitySetting",
179                                            _updateActivitySettingParameterTypes3);
180    
181                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
182                                            className, enabled);
183    
184                            try {
185                                    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                    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, int activityType,
208                    com.liferay.portlet.social.model.SocialActivityCounterDefinition activityCounterDefinition)
209                    throws com.liferay.portal.kernel.exception.PortalException,
210                            com.liferay.portal.kernel.exception.SystemException {
211                    try {
212                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class.getName(),
213                                            "updateActivitySetting",
214                                            _updateActivitySettingParameterTypes4);
215    
216                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
217                                            className, activityType, activityCounterDefinition);
218    
219                            try {
220                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
221                            }
222                            catch (Exception e) {
223                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
224                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
225                                    }
226    
227                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
228                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
229                                    }
230    
231                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
232                            }
233                    }
234                    catch (com.liferay.portal.kernel.exception.SystemException se) {
235                            _log.error(se, se);
236    
237                            throw se;
238                    }
239            }
240    
241            public static void updateActivitySettings(HttpPrincipal httpPrincipal,
242                    long groupId, java.lang.String className, int activityType,
243                    java.util.List<com.liferay.portlet.social.model.SocialActivityCounterDefinition> activityCounterDefinitions)
244                    throws com.liferay.portal.kernel.exception.PortalException,
245                            com.liferay.portal.kernel.exception.SystemException {
246                    try {
247                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class.getName(),
248                                            "updateActivitySettings",
249                                            _updateActivitySettingsParameterTypes5);
250    
251                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
252                                            className, activityType, activityCounterDefinitions);
253    
254                            try {
255                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
256                            }
257                            catch (Exception e) {
258                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
259                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
260                                    }
261    
262                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
263                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
264                                    }
265    
266                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
267                            }
268                    }
269                    catch (com.liferay.portal.kernel.exception.SystemException se) {
270                            _log.error(se, se);
271    
272                            throw se;
273                    }
274            }
275    
276            private static Log _log = LogFactoryUtil.getLog(SocialActivitySettingServiceHttp.class);
277            private static final Class<?>[] _getActivityDefinitionParameterTypes0 = new Class[] {
278                            long.class, java.lang.String.class, int.class
279                    };
280            private static final Class<?>[] _getActivityDefinitionsParameterTypes1 = new Class[] {
281                            long.class, java.lang.String.class
282                    };
283            private static final Class<?>[] _getJSONActivityDefinitionsParameterTypes2 = new Class[] {
284                            long.class, java.lang.String.class
285                    };
286            private static final Class<?>[] _updateActivitySettingParameterTypes3 = new Class[] {
287                            long.class, java.lang.String.class, boolean.class
288                    };
289            private static final Class<?>[] _updateActivitySettingParameterTypes4 = new Class[] {
290                            long.class, java.lang.String.class, int.class,
291                            com.liferay.portlet.social.model.SocialActivityCounterDefinition.class
292                    };
293            private static final Class<?>[] _updateActivitySettingsParameterTypes5 = new Class[] {
294                            long.class, java.lang.String.class, int.class, java.util.List.class
295                    };
296    }