001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.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.RegionServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.RegionServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
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    Brian Wing Shun Chan
049     * @see       RegionServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.RegionServiceUtil
052     * @generated
053     */
054    public class RegionServiceHttp {
055            public static com.liferay.portal.model.Region addRegion(
056                    HttpPrincipal httpPrincipal, long countryId,
057                    java.lang.String regionCode, java.lang.String name, boolean active)
058                    throws com.liferay.portal.kernel.exception.PortalException,
059                            com.liferay.portal.kernel.exception.SystemException {
060                    try {
061                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
062                                            "addRegion", _addRegionParameterTypes0);
063    
064                            MethodHandler methodHandler = new MethodHandler(methodKey,
065                                            countryId, regionCode, name, active);
066    
067                            Object returnObj = null;
068    
069                            try {
070                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
071                            }
072                            catch (Exception e) {
073                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
075                                    }
076    
077                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
078                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
079                                    }
080    
081                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083    
084                            return (com.liferay.portal.model.Region)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 java.util.List<com.liferay.portal.model.Region> getRegions(
094                    HttpPrincipal httpPrincipal)
095                    throws com.liferay.portal.kernel.exception.SystemException {
096                    try {
097                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
098                                            "getRegions", _getRegionsParameterTypes1);
099    
100                            MethodHandler methodHandler = new MethodHandler(methodKey);
101    
102                            Object returnObj = null;
103    
104                            try {
105                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
106                            }
107                            catch (Exception e) {
108                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
109                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
110                                    }
111    
112                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
113                            }
114    
115                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
116                    }
117                    catch (com.liferay.portal.kernel.exception.SystemException se) {
118                            _log.error(se, se);
119    
120                            throw se;
121                    }
122            }
123    
124            public static java.util.List<com.liferay.portal.model.Region> getRegions(
125                    HttpPrincipal httpPrincipal, long countryId)
126                    throws com.liferay.portal.kernel.exception.SystemException {
127                    try {
128                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
129                                            "getRegions", _getRegionsParameterTypes2);
130    
131                            MethodHandler methodHandler = new MethodHandler(methodKey, countryId);
132    
133                            Object returnObj = null;
134    
135                            try {
136                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
137                            }
138                            catch (Exception e) {
139                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
140                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
141                                    }
142    
143                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
144                            }
145    
146                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
147                    }
148                    catch (com.liferay.portal.kernel.exception.SystemException se) {
149                            _log.error(se, se);
150    
151                            throw se;
152                    }
153            }
154    
155            public static java.util.List<com.liferay.portal.model.Region> getRegions(
156                    HttpPrincipal httpPrincipal, boolean active)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    try {
159                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
160                                            "getRegions", _getRegionsParameterTypes3);
161    
162                            MethodHandler methodHandler = new MethodHandler(methodKey, active);
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.SystemException) {
171                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
172                                    }
173    
174                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
175                            }
176    
177                            return (java.util.List<com.liferay.portal.model.Region>)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 java.util.List<com.liferay.portal.model.Region> getRegions(
187                    HttpPrincipal httpPrincipal, long countryId, boolean active)
188                    throws com.liferay.portal.kernel.exception.SystemException {
189                    try {
190                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
191                                            "getRegions", _getRegionsParameterTypes4);
192    
193                            MethodHandler methodHandler = new MethodHandler(methodKey,
194                                            countryId, active);
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.SystemException) {
203                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
204                                    }
205    
206                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
207                            }
208    
209                            return (java.util.List<com.liferay.portal.model.Region>)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 com.liferay.portal.model.Region getRegion(
219                    HttpPrincipal httpPrincipal, long regionId)
220                    throws com.liferay.portal.kernel.exception.PortalException,
221                            com.liferay.portal.kernel.exception.SystemException {
222                    try {
223                            MethodKey methodKey = new MethodKey(RegionServiceUtil.class.getName(),
224                                            "getRegion", _getRegionParameterTypes5);
225    
226                            MethodHandler methodHandler = new MethodHandler(methodKey, regionId);
227    
228                            Object returnObj = null;
229    
230                            try {
231                                    returnObj = 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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
239                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
240                                    }
241    
242                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
243                            }
244    
245                            return (com.liferay.portal.model.Region)returnObj;
246                    }
247                    catch (com.liferay.portal.kernel.exception.SystemException se) {
248                            _log.error(se, se);
249    
250                            throw se;
251                    }
252            }
253    
254            private static Log _log = LogFactoryUtil.getLog(RegionServiceHttp.class);
255            private static final Class<?>[] _addRegionParameterTypes0 = new Class[] {
256                            long.class, java.lang.String.class, java.lang.String.class,
257                            boolean.class
258                    };
259            private static final Class<?>[] _getRegionsParameterTypes1 = new Class[] {  };
260            private static final Class<?>[] _getRegionsParameterTypes2 = new Class[] {
261                            long.class
262                    };
263            private static final Class<?>[] _getRegionsParameterTypes3 = new Class[] {
264                            boolean.class
265                    };
266            private static final Class<?>[] _getRegionsParameterTypes4 = new Class[] {
267                            long.class, boolean.class
268                    };
269            private static final Class<?>[] _getRegionParameterTypes5 = new Class[] {
270                            long.class
271                    };
272    }