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.mobiledevicerules.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.mobiledevicerules.service.MDRRuleServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link com.liferay.portlet.mobiledevicerules.service.MDRRuleServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author Edward C. Han
049     * @see MDRRuleServiceSoap
050     * @see com.liferay.portal.security.auth.HttpPrincipal
051     * @see com.liferay.portlet.mobiledevicerules.service.MDRRuleServiceUtil
052     * @generated
053     */
054    public class MDRRuleServiceHttp {
055            public static com.liferay.portlet.mobiledevicerules.model.MDRRule addRule(
056                    HttpPrincipal httpPrincipal, long ruleGroupId,
057                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
058                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
059                    java.lang.String type, java.lang.String typeSettings,
060                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(MDRRuleServiceUtil.class,
065                                            "addRule", _addRuleParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey,
068                                            ruleGroupId, nameMap, descriptionMap, type, typeSettings,
069                                            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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
082                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
083                                    }
084    
085                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
086                            }
087    
088                            return (com.liferay.portlet.mobiledevicerules.model.MDRRule)returnObj;
089                    }
090                    catch (com.liferay.portal.kernel.exception.SystemException se) {
091                            _log.error(se, se);
092    
093                            throw se;
094                    }
095            }
096    
097            public static com.liferay.portlet.mobiledevicerules.model.MDRRule addRule(
098                    HttpPrincipal httpPrincipal, long ruleGroupId,
099                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
100                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
101                    java.lang.String type,
102                    com.liferay.portal.kernel.util.UnicodeProperties typeSettings,
103                    com.liferay.portal.service.ServiceContext serviceContext)
104                    throws com.liferay.portal.kernel.exception.PortalException,
105                            com.liferay.portal.kernel.exception.SystemException {
106                    try {
107                            MethodKey methodKey = new MethodKey(MDRRuleServiceUtil.class,
108                                            "addRule", _addRuleParameterTypes1);
109    
110                            MethodHandler methodHandler = new MethodHandler(methodKey,
111                                            ruleGroupId, nameMap, descriptionMap, type, typeSettings,
112                                            serviceContext);
113    
114                            Object returnObj = null;
115    
116                            try {
117                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
118                            }
119                            catch (Exception e) {
120                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
121                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
122                                    }
123    
124                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
125                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
126                                    }
127    
128                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
129                            }
130    
131                            return (com.liferay.portlet.mobiledevicerules.model.MDRRule)returnObj;
132                    }
133                    catch (com.liferay.portal.kernel.exception.SystemException se) {
134                            _log.error(se, se);
135    
136                            throw se;
137                    }
138            }
139    
140            public static void deleteRule(HttpPrincipal httpPrincipal, long ruleId)
141                    throws com.liferay.portal.kernel.exception.PortalException,
142                            com.liferay.portal.kernel.exception.SystemException {
143                    try {
144                            MethodKey methodKey = new MethodKey(MDRRuleServiceUtil.class,
145                                            "deleteRule", _deleteRuleParameterTypes2);
146    
147                            MethodHandler methodHandler = new MethodHandler(methodKey, ruleId);
148    
149                            try {
150                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
151                            }
152                            catch (Exception e) {
153                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
154                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
155                                    }
156    
157                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
158                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
159                                    }
160    
161                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
162                            }
163                    }
164                    catch (com.liferay.portal.kernel.exception.SystemException se) {
165                            _log.error(se, se);
166    
167                            throw se;
168                    }
169            }
170    
171            public static com.liferay.portlet.mobiledevicerules.model.MDRRule fetchRule(
172                    HttpPrincipal httpPrincipal, long ruleId)
173                    throws com.liferay.portal.kernel.exception.PortalException,
174                            com.liferay.portal.kernel.exception.SystemException {
175                    try {
176                            MethodKey methodKey = new MethodKey(MDRRuleServiceUtil.class,
177                                            "fetchRule", _fetchRuleParameterTypes3);
178    
179                            MethodHandler methodHandler = new MethodHandler(methodKey, ruleId);
180    
181                            Object returnObj = null;
182    
183                            try {
184                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
185                            }
186                            catch (Exception e) {
187                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
188                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
189                                    }
190    
191                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
192                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
193                                    }
194    
195                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
196                            }
197    
198                            return (com.liferay.portlet.mobiledevicerules.model.MDRRule)returnObj;
199                    }
200                    catch (com.liferay.portal.kernel.exception.SystemException se) {
201                            _log.error(se, se);
202    
203                            throw se;
204                    }
205            }
206    
207            public static com.liferay.portlet.mobiledevicerules.model.MDRRule getRule(
208                    HttpPrincipal httpPrincipal, long ruleId)
209                    throws com.liferay.portal.kernel.exception.PortalException,
210                            com.liferay.portal.kernel.exception.SystemException {
211                    try {
212                            MethodKey methodKey = new MethodKey(MDRRuleServiceUtil.class,
213                                            "getRule", _getRuleParameterTypes4);
214    
215                            MethodHandler methodHandler = new MethodHandler(methodKey, ruleId);
216    
217                            Object returnObj = null;
218    
219                            try {
220                                    returnObj = 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                            return (com.liferay.portlet.mobiledevicerules.model.MDRRule)returnObj;
235                    }
236                    catch (com.liferay.portal.kernel.exception.SystemException se) {
237                            _log.error(se, se);
238    
239                            throw se;
240                    }
241            }
242    
243            public static com.liferay.portlet.mobiledevicerules.model.MDRRule updateRule(
244                    HttpPrincipal httpPrincipal, long ruleId,
245                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
246                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
247                    java.lang.String type, java.lang.String typeSettings,
248                    com.liferay.portal.service.ServiceContext serviceContext)
249                    throws com.liferay.portal.kernel.exception.PortalException,
250                            com.liferay.portal.kernel.exception.SystemException {
251                    try {
252                            MethodKey methodKey = new MethodKey(MDRRuleServiceUtil.class,
253                                            "updateRule", _updateRuleParameterTypes5);
254    
255                            MethodHandler methodHandler = new MethodHandler(methodKey, ruleId,
256                                            nameMap, descriptionMap, type, typeSettings, serviceContext);
257    
258                            Object returnObj = null;
259    
260                            try {
261                                    returnObj = 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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
269                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
270                                    }
271    
272                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
273                            }
274    
275                            return (com.liferay.portlet.mobiledevicerules.model.MDRRule)returnObj;
276                    }
277                    catch (com.liferay.portal.kernel.exception.SystemException se) {
278                            _log.error(se, se);
279    
280                            throw se;
281                    }
282            }
283    
284            public static com.liferay.portlet.mobiledevicerules.model.MDRRule updateRule(
285                    HttpPrincipal httpPrincipal, long ruleId,
286                    java.util.Map<java.util.Locale, java.lang.String> nameMap,
287                    java.util.Map<java.util.Locale, java.lang.String> descriptionMap,
288                    java.lang.String type,
289                    com.liferay.portal.kernel.util.UnicodeProperties typeSettingsProperties,
290                    com.liferay.portal.service.ServiceContext serviceContext)
291                    throws com.liferay.portal.kernel.exception.PortalException,
292                            com.liferay.portal.kernel.exception.SystemException {
293                    try {
294                            MethodKey methodKey = new MethodKey(MDRRuleServiceUtil.class,
295                                            "updateRule", _updateRuleParameterTypes6);
296    
297                            MethodHandler methodHandler = new MethodHandler(methodKey, ruleId,
298                                            nameMap, descriptionMap, type, typeSettingsProperties,
299                                            serviceContext);
300    
301                            Object returnObj = null;
302    
303                            try {
304                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
305                            }
306                            catch (Exception e) {
307                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
308                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
309                                    }
310    
311                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
312                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
313                                    }
314    
315                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
316                            }
317    
318                            return (com.liferay.portlet.mobiledevicerules.model.MDRRule)returnObj;
319                    }
320                    catch (com.liferay.portal.kernel.exception.SystemException se) {
321                            _log.error(se, se);
322    
323                            throw se;
324                    }
325            }
326    
327            private static Log _log = LogFactoryUtil.getLog(MDRRuleServiceHttp.class);
328            private static final Class<?>[] _addRuleParameterTypes0 = new Class[] {
329                            long.class, java.util.Map.class, java.util.Map.class,
330                            java.lang.String.class, java.lang.String.class,
331                            com.liferay.portal.service.ServiceContext.class
332                    };
333            private static final Class<?>[] _addRuleParameterTypes1 = new Class[] {
334                            long.class, java.util.Map.class, java.util.Map.class,
335                            java.lang.String.class,
336                            com.liferay.portal.kernel.util.UnicodeProperties.class,
337                            com.liferay.portal.service.ServiceContext.class
338                    };
339            private static final Class<?>[] _deleteRuleParameterTypes2 = new Class[] {
340                            long.class
341                    };
342            private static final Class<?>[] _fetchRuleParameterTypes3 = new Class[] {
343                            long.class
344                    };
345            private static final Class<?>[] _getRuleParameterTypes4 = new Class[] {
346                            long.class
347                    };
348            private static final Class<?>[] _updateRuleParameterTypes5 = new Class[] {
349                            long.class, java.util.Map.class, java.util.Map.class,
350                            java.lang.String.class, java.lang.String.class,
351                            com.liferay.portal.service.ServiceContext.class
352                    };
353            private static final Class<?>[] _updateRuleParameterTypes6 = new Class[] {
354                            long.class, java.util.Map.class, java.util.Map.class,
355                            java.lang.String.class,
356                            com.liferay.portal.kernel.util.UnicodeProperties.class,
357                            com.liferay.portal.service.ServiceContext.class
358                    };
359    }