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.mobiledevicerules.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.mobiledevicerules.service.MDRRuleGroupServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link MDRRuleGroupServiceUtil} 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 Edward C. Han
051     * @see MDRRuleGroupServiceSoap
052     * @see HttpPrincipal
053     * @see MDRRuleGroupServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class MDRRuleGroupServiceHttp {
058            public static com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup addRuleGroup(
059                    HttpPrincipal httpPrincipal, long groupId,
060                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
061                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
062                    com.liferay.portal.service.ServiceContext serviceContext)
063                    throws com.liferay.portal.kernel.exception.PortalException {
064                    try {
065                            MethodKey methodKey = new MethodKey(MDRRuleGroupServiceUtil.class,
066                                            "addRuleGroup", _addRuleGroupParameterTypes0);
067    
068                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
069                                            nameMap, descriptionMap, serviceContext);
070    
071                            Object returnObj = null;
072    
073                            try {
074                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
075                            }
076                            catch (Exception e) {
077                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
078                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
079                                    }
080    
081                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083    
084                            return (com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup)returnObj;
085                    }
086                    catch (com.liferay.portal.kernel.exception.SystemException se) {
087                            _log.error(se, se);
088    
089                            throw se;
090                    }
091            }
092    
093            public static com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup copyRuleGroup(
094                    HttpPrincipal httpPrincipal, long ruleGroupId, long groupId,
095                    com.liferay.portal.service.ServiceContext serviceContext)
096                    throws com.liferay.portal.kernel.exception.PortalException {
097                    try {
098                            MethodKey methodKey = new MethodKey(MDRRuleGroupServiceUtil.class,
099                                            "copyRuleGroup", _copyRuleGroupParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey,
102                                            ruleGroupId, groupId, serviceContext);
103    
104                            Object returnObj = null;
105    
106                            try {
107                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
108                            }
109                            catch (Exception e) {
110                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
111                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
112                                    }
113    
114                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
115                            }
116    
117                            return (com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup)returnObj;
118                    }
119                    catch (com.liferay.portal.kernel.exception.SystemException se) {
120                            _log.error(se, se);
121    
122                            throw se;
123                    }
124            }
125    
126            public static void deleteRuleGroup(HttpPrincipal httpPrincipal,
127                    long ruleGroupId)
128                    throws com.liferay.portal.kernel.exception.PortalException {
129                    try {
130                            MethodKey methodKey = new MethodKey(MDRRuleGroupServiceUtil.class,
131                                            "deleteRuleGroup", _deleteRuleGroupParameterTypes2);
132    
133                            MethodHandler methodHandler = new MethodHandler(methodKey,
134                                            ruleGroupId);
135    
136                            try {
137                                    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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
148                            _log.error(se, se);
149    
150                            throw se;
151                    }
152            }
153    
154            public static com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup fetchRuleGroup(
155                    HttpPrincipal httpPrincipal, long ruleGroupId)
156                    throws com.liferay.portal.kernel.exception.PortalException {
157                    try {
158                            MethodKey methodKey = new MethodKey(MDRRuleGroupServiceUtil.class,
159                                            "fetchRuleGroup", _fetchRuleGroupParameterTypes3);
160    
161                            MethodHandler methodHandler = new MethodHandler(methodKey,
162                                            ruleGroupId);
163    
164                            Object returnObj = null;
165    
166                            try {
167                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
168                            }
169                            catch (Exception e) {
170                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
171                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
172                                    }
173    
174                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
175                            }
176    
177                            return (com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup)returnObj;
178                    }
179                    catch (com.liferay.portal.kernel.exception.SystemException se) {
180                            _log.error(se, se);
181    
182                            throw se;
183                    }
184            }
185    
186            public static com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup getRuleGroup(
187                    HttpPrincipal httpPrincipal, long ruleGroupId)
188                    throws com.liferay.portal.kernel.exception.PortalException {
189                    try {
190                            MethodKey methodKey = new MethodKey(MDRRuleGroupServiceUtil.class,
191                                            "getRuleGroup", _getRuleGroupParameterTypes4);
192    
193                            MethodHandler methodHandler = new MethodHandler(methodKey,
194                                            ruleGroupId);
195    
196                            Object returnObj = null;
197    
198                            try {
199                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
200                            }
201                            catch (Exception e) {
202                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
203                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
204                                    }
205    
206                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
207                            }
208    
209                            return (com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup)returnObj;
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 java.util.List<com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup> getRuleGroups(
219                    HttpPrincipal httpPrincipal, long[] groupIds, int start, int end) {
220                    try {
221                            MethodKey methodKey = new MethodKey(MDRRuleGroupServiceUtil.class,
222                                            "getRuleGroups", _getRuleGroupsParameterTypes5);
223    
224                            MethodHandler methodHandler = new MethodHandler(methodKey,
225                                            groupIds, start, end);
226    
227                            Object returnObj = null;
228    
229                            try {
230                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
231                            }
232                            catch (Exception e) {
233                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
234                            }
235    
236                            return (java.util.List<com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup>)returnObj;
237                    }
238                    catch (com.liferay.portal.kernel.exception.SystemException se) {
239                            _log.error(se, se);
240    
241                            throw se;
242                    }
243            }
244    
245            public static int getRuleGroupsCount(HttpPrincipal httpPrincipal,
246                    long[] groupIds) {
247                    try {
248                            MethodKey methodKey = new MethodKey(MDRRuleGroupServiceUtil.class,
249                                            "getRuleGroupsCount", _getRuleGroupsCountParameterTypes6);
250    
251                            MethodHandler methodHandler = new MethodHandler(methodKey, groupIds);
252    
253                            Object returnObj = null;
254    
255                            try {
256                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
257                            }
258                            catch (Exception e) {
259                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
260                            }
261    
262                            return ((Integer)returnObj).intValue();
263                    }
264                    catch (com.liferay.portal.kernel.exception.SystemException se) {
265                            _log.error(se, se);
266    
267                            throw se;
268                    }
269            }
270    
271            public static com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup updateRuleGroup(
272                    HttpPrincipal httpPrincipal, long ruleGroupId,
273                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
274                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
275                    com.liferay.portal.service.ServiceContext serviceContext)
276                    throws com.liferay.portal.kernel.exception.PortalException {
277                    try {
278                            MethodKey methodKey = new MethodKey(MDRRuleGroupServiceUtil.class,
279                                            "updateRuleGroup", _updateRuleGroupParameterTypes7);
280    
281                            MethodHandler methodHandler = new MethodHandler(methodKey,
282                                            ruleGroupId, nameMap, descriptionMap, serviceContext);
283    
284                            Object returnObj = null;
285    
286                            try {
287                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
288                            }
289                            catch (Exception e) {
290                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
291                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
292                                    }
293    
294                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
295                            }
296    
297                            return (com.liferay.portlet.mobiledevicerules.model.MDRRuleGroup)returnObj;
298                    }
299                    catch (com.liferay.portal.kernel.exception.SystemException se) {
300                            _log.error(se, se);
301    
302                            throw se;
303                    }
304            }
305    
306            private static Log _log = LogFactoryUtil.getLog(MDRRuleGroupServiceHttp.class);
307            private static final Class<?>[] _addRuleGroupParameterTypes0 = new Class[] {
308                            long.class, java.util.Map.class, java.util.Map.class,
309                            com.liferay.portal.service.ServiceContext.class
310                    };
311            private static final Class<?>[] _copyRuleGroupParameterTypes1 = new Class[] {
312                            long.class, long.class,
313                            com.liferay.portal.service.ServiceContext.class
314                    };
315            private static final Class<?>[] _deleteRuleGroupParameterTypes2 = new Class[] {
316                            long.class
317                    };
318            private static final Class<?>[] _fetchRuleGroupParameterTypes3 = new Class[] {
319                            long.class
320                    };
321            private static final Class<?>[] _getRuleGroupParameterTypes4 = new Class[] {
322                            long.class
323                    };
324            private static final Class<?>[] _getRuleGroupsParameterTypes5 = new Class[] {
325                            long[].class, int.class, int.class
326                    };
327            private static final Class<?>[] _getRuleGroupsCountParameterTypes6 = new Class[] {
328                            long[].class
329                    };
330            private static final Class<?>[] _updateRuleGroupParameterTypes7 = new Class[] {
331                            long.class, java.util.Map.class, java.util.Map.class,
332                            com.liferay.portal.service.ServiceContext.class
333                    };
334    }