001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.social.service.SocialActivitySettingServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link SocialActivitySettingServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link HttpPrincipal} parameter.
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 HttpPrincipal
053     * @see SocialActivitySettingServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class SocialActivitySettingServiceHttp {
058            public static com.liferay.portlet.social.model.SocialActivityDefinition getActivityDefinition(
059                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
060                    int activityType)
061                    throws com.liferay.portal.kernel.exception.PortalException {
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
081                            }
082    
083                            return (com.liferay.portlet.social.model.SocialActivityDefinition)returnObj;
084                    }
085                    catch (com.liferay.portal.kernel.exception.SystemException se) {
086                            _log.error(se, se);
087    
088                            throw se;
089                    }
090            }
091    
092            public static java.util.List<com.liferay.portlet.social.model.SocialActivityDefinition> getActivityDefinitions(
093                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className)
094                    throws com.liferay.portal.kernel.exception.PortalException {
095                    try {
096                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
097                                            "getActivityDefinitions",
098                                            _getActivityDefinitionsParameterTypes1);
099    
100                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
101                                            className);
102    
103                            Object returnObj = null;
104    
105                            try {
106                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
107                            }
108                            catch (Exception e) {
109                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
110                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
111                                    }
112    
113                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
114                            }
115    
116                            return (java.util.List<com.liferay.portlet.social.model.SocialActivityDefinition>)returnObj;
117                    }
118                    catch (com.liferay.portal.kernel.exception.SystemException se) {
119                            _log.error(se, se);
120    
121                            throw se;
122                    }
123            }
124    
125            public static java.util.List<com.liferay.portlet.social.model.SocialActivitySetting> getActivitySettings(
126                    HttpPrincipal httpPrincipal, long groupId)
127                    throws com.liferay.portal.kernel.exception.PortalException {
128                    try {
129                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
130                                            "getActivitySettings", _getActivitySettingsParameterTypes2);
131    
132                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId);
133    
134                            Object returnObj = null;
135    
136                            try {
137                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
138                            }
139                            catch (Exception e) {
140                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
141                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
142                                    }
143    
144                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
145                            }
146    
147                            return (java.util.List<com.liferay.portlet.social.model.SocialActivitySetting>)returnObj;
148                    }
149                    catch (com.liferay.portal.kernel.exception.SystemException se) {
150                            _log.error(se, se);
151    
152                            throw se;
153                    }
154            }
155    
156            public static com.liferay.portal.kernel.json.JSONArray getJSONActivityDefinitions(
157                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className)
158                    throws com.liferay.portal.kernel.exception.PortalException {
159                    try {
160                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
161                                            "getJSONActivityDefinitions",
162                                            _getJSONActivityDefinitionsParameterTypes3);
163    
164                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
165                                            className);
166    
167                            Object returnObj = null;
168    
169                            try {
170                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
171                            }
172                            catch (Exception e) {
173                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
174                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
175                                    }
176    
177                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
178                            }
179    
180                            return (com.liferay.portal.kernel.json.JSONArray)returnObj;
181                    }
182                    catch (com.liferay.portal.kernel.exception.SystemException se) {
183                            _log.error(se, se);
184    
185                            throw se;
186                    }
187            }
188    
189            public static void updateActivitySetting(HttpPrincipal httpPrincipal,
190                    long groupId, java.lang.String className, boolean enabled)
191                    throws com.liferay.portal.kernel.exception.PortalException {
192                    try {
193                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
194                                            "updateActivitySetting",
195                                            _updateActivitySettingParameterTypes4);
196    
197                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
198                                            className, enabled);
199    
200                            try {
201                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
202                            }
203                            catch (Exception e) {
204                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
205                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
206                                    }
207    
208                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
209                            }
210                    }
211                    catch (com.liferay.portal.kernel.exception.SystemException se) {
212                            _log.error(se, se);
213    
214                            throw se;
215                    }
216            }
217    
218            public static void updateActivitySetting(HttpPrincipal httpPrincipal,
219                    long groupId, java.lang.String className, int activityType,
220                    com.liferay.portlet.social.model.SocialActivityCounterDefinition activityCounterDefinition)
221                    throws com.liferay.portal.kernel.exception.PortalException {
222                    try {
223                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
224                                            "updateActivitySetting",
225                                            _updateActivitySettingParameterTypes5);
226    
227                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
228                                            className, activityType, activityCounterDefinition);
229    
230                            try {
231                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
232                            }
233                            catch (Exception e) {
234                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
235                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
236                                    }
237    
238                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
239                            }
240                    }
241                    catch (com.liferay.portal.kernel.exception.SystemException se) {
242                            _log.error(se, se);
243    
244                            throw se;
245                    }
246            }
247    
248            public static void updateActivitySettings(HttpPrincipal httpPrincipal,
249                    long groupId, java.lang.String className, int activityType,
250                    java.util.List<com.liferay.portlet.social.model.SocialActivityCounterDefinition> activityCounterDefinitions)
251                    throws com.liferay.portal.kernel.exception.PortalException {
252                    try {
253                            MethodKey methodKey = new MethodKey(SocialActivitySettingServiceUtil.class,
254                                            "updateActivitySettings",
255                                            _updateActivitySettingsParameterTypes6);
256    
257                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
258                                            className, activityType, activityCounterDefinitions);
259    
260                            try {
261                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
262                            }
263                            catch (Exception e) {
264                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
265                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
266                                    }
267    
268                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
269                            }
270                    }
271                    catch (com.liferay.portal.kernel.exception.SystemException se) {
272                            _log.error(se, se);
273    
274                            throw se;
275                    }
276            }
277    
278            private static Log _log = LogFactoryUtil.getLog(SocialActivitySettingServiceHttp.class);
279            private static final Class<?>[] _getActivityDefinitionParameterTypes0 = new Class[] {
280                            long.class, java.lang.String.class, int.class
281                    };
282            private static final Class<?>[] _getActivityDefinitionsParameterTypes1 = new Class[] {
283                            long.class, java.lang.String.class
284                    };
285            private static final Class<?>[] _getActivitySettingsParameterTypes2 = new Class[] {
286                            long.class
287                    };
288            private static final Class<?>[] _getJSONActivityDefinitionsParameterTypes3 = new Class[] {
289                            long.class, java.lang.String.class
290                    };
291            private static final Class<?>[] _updateActivitySettingParameterTypes4 = new Class[] {
292                            long.class, java.lang.String.class, boolean.class
293                    };
294            private static final Class<?>[] _updateActivitySettingParameterTypes5 = new Class[] {
295                            long.class, java.lang.String.class, int.class,
296                            com.liferay.portlet.social.model.SocialActivityCounterDefinition.class
297                    };
298            private static final Class<?>[] _updateActivitySettingsParameterTypes6 = new Class[] {
299                            long.class, java.lang.String.class, int.class, java.util.List.class
300                    };
301    }