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