001    /**
002     * Copyright (c) 2000-2010 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.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.BooleanWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.RegionServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portal.service.RegionServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
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       RegionServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portal.service.RegionServiceUtil
054     * @generated
055     */
056    public class RegionServiceHttp {
057            public static com.liferay.portal.model.Region addRegion(
058                    HttpPrincipal httpPrincipal, long countryId,
059                    java.lang.String regionCode, java.lang.String name, boolean active)
060                    throws com.liferay.portal.kernel.exception.PortalException,
061                            com.liferay.portal.kernel.exception.SystemException {
062                    try {
063                            Object paramObj0 = new LongWrapper(countryId);
064    
065                            Object paramObj1 = regionCode;
066    
067                            if (regionCode == null) {
068                                    paramObj1 = new NullWrapper("java.lang.String");
069                            }
070    
071                            Object paramObj2 = name;
072    
073                            if (name == null) {
074                                    paramObj2 = new NullWrapper("java.lang.String");
075                            }
076    
077                            Object paramObj3 = new BooleanWrapper(active);
078    
079                            MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
080                                            "addRegion",
081                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
082    
083                            Object returnObj = null;
084    
085                            try {
086                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
087                            }
088                            catch (Exception e) {
089                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
090                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
091                                    }
092    
093                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
094                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
095                                    }
096    
097                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
098                            }
099    
100                            return (com.liferay.portal.model.Region)returnObj;
101                    }
102                    catch (com.liferay.portal.kernel.exception.SystemException se) {
103                            _log.error(se, se);
104    
105                            throw se;
106                    }
107            }
108    
109            public static java.util.List<com.liferay.portal.model.Region> getRegions(
110                    HttpPrincipal httpPrincipal)
111                    throws com.liferay.portal.kernel.exception.SystemException {
112                    try {
113                            MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
114                                            "getRegions", new Object[0]);
115    
116                            Object returnObj = null;
117    
118                            try {
119                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
120                            }
121                            catch (Exception e) {
122                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
123                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
124                                    }
125    
126                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
127                            }
128    
129                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
130                    }
131                    catch (com.liferay.portal.kernel.exception.SystemException se) {
132                            _log.error(se, se);
133    
134                            throw se;
135                    }
136            }
137    
138            public static java.util.List<com.liferay.portal.model.Region> getRegions(
139                    HttpPrincipal httpPrincipal, long countryId)
140                    throws com.liferay.portal.kernel.exception.SystemException {
141                    try {
142                            Object paramObj0 = new LongWrapper(countryId);
143    
144                            MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
145                                            "getRegions", new Object[] { paramObj0 });
146    
147                            Object returnObj = null;
148    
149                            try {
150                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
151                            }
152                            catch (Exception e) {
153                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
154                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
155                                    }
156    
157                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
158                            }
159    
160                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
161                    }
162                    catch (com.liferay.portal.kernel.exception.SystemException se) {
163                            _log.error(se, se);
164    
165                            throw se;
166                    }
167            }
168    
169            public static java.util.List<com.liferay.portal.model.Region> getRegions(
170                    HttpPrincipal httpPrincipal, boolean active)
171                    throws com.liferay.portal.kernel.exception.SystemException {
172                    try {
173                            Object paramObj0 = new BooleanWrapper(active);
174    
175                            MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
176                                            "getRegions", new Object[] { paramObj0 });
177    
178                            Object returnObj = null;
179    
180                            try {
181                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
182                            }
183                            catch (Exception e) {
184                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
185                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
186                                    }
187    
188                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
189                            }
190    
191                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
192                    }
193                    catch (com.liferay.portal.kernel.exception.SystemException se) {
194                            _log.error(se, se);
195    
196                            throw se;
197                    }
198            }
199    
200            public static java.util.List<com.liferay.portal.model.Region> getRegions(
201                    HttpPrincipal httpPrincipal, long countryId, boolean active)
202                    throws com.liferay.portal.kernel.exception.SystemException {
203                    try {
204                            Object paramObj0 = new LongWrapper(countryId);
205    
206                            Object paramObj1 = new BooleanWrapper(active);
207    
208                            MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
209                                            "getRegions", new Object[] { paramObj0, paramObj1 });
210    
211                            Object returnObj = null;
212    
213                            try {
214                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
215                            }
216                            catch (Exception e) {
217                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
218                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
219                                    }
220    
221                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
222                            }
223    
224                            return (java.util.List<com.liferay.portal.model.Region>)returnObj;
225                    }
226                    catch (com.liferay.portal.kernel.exception.SystemException se) {
227                            _log.error(se, se);
228    
229                            throw se;
230                    }
231            }
232    
233            public static com.liferay.portal.model.Region getRegion(
234                    HttpPrincipal httpPrincipal, long regionId)
235                    throws com.liferay.portal.kernel.exception.PortalException,
236                            com.liferay.portal.kernel.exception.SystemException {
237                    try {
238                            Object paramObj0 = new LongWrapper(regionId);
239    
240                            MethodWrapper methodWrapper = new MethodWrapper(RegionServiceUtil.class.getName(),
241                                            "getRegion", new Object[] { paramObj0 });
242    
243                            Object returnObj = null;
244    
245                            try {
246                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
247                            }
248                            catch (Exception e) {
249                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
250                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
251                                    }
252    
253                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
254                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
255                                    }
256    
257                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
258                            }
259    
260                            return (com.liferay.portal.model.Region)returnObj;
261                    }
262                    catch (com.liferay.portal.kernel.exception.SystemException se) {
263                            _log.error(se, se);
264    
265                            throw se;
266                    }
267            }
268    
269            private static Log _log = LogFactoryUtil.getLog(RegionServiceHttp.class);
270    }