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.CountryServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portal.service.CountryServiceUtil} 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       CountryServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portal.service.CountryServiceUtil
054     * @generated
055     */
056    public class CountryServiceHttp {
057            public static com.liferay.portal.model.Country addCountry(
058                    HttpPrincipal httpPrincipal, java.lang.String name,
059                    java.lang.String a2, java.lang.String a3, java.lang.String number,
060                    java.lang.String idd, boolean active)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            Object paramObj0 = name;
065    
066                            if (name == null) {
067                                    paramObj0 = new NullWrapper("java.lang.String");
068                            }
069    
070                            Object paramObj1 = a2;
071    
072                            if (a2 == null) {
073                                    paramObj1 = new NullWrapper("java.lang.String");
074                            }
075    
076                            Object paramObj2 = a3;
077    
078                            if (a3 == null) {
079                                    paramObj2 = new NullWrapper("java.lang.String");
080                            }
081    
082                            Object paramObj3 = number;
083    
084                            if (number == null) {
085                                    paramObj3 = new NullWrapper("java.lang.String");
086                            }
087    
088                            Object paramObj4 = idd;
089    
090                            if (idd == null) {
091                                    paramObj4 = new NullWrapper("java.lang.String");
092                            }
093    
094                            Object paramObj5 = new BooleanWrapper(active);
095    
096                            MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
097                                            "addCountry",
098                                            new Object[] {
099                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
100                                                    paramObj5
101                                            });
102    
103                            Object returnObj = null;
104    
105                            try {
106                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
107                            }
108                            catch (Exception e) {
109                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
110                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
111                                    }
112    
113                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
114                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
115                                    }
116    
117                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
118                            }
119    
120                            return (com.liferay.portal.model.Country)returnObj;
121                    }
122                    catch (com.liferay.portal.kernel.exception.SystemException se) {
123                            _log.error(se, se);
124    
125                            throw se;
126                    }
127            }
128    
129            public static java.util.List<com.liferay.portal.model.Country> getCountries(
130                    HttpPrincipal httpPrincipal)
131                    throws com.liferay.portal.kernel.exception.SystemException {
132                    try {
133                            MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
134                                            "getCountries", new Object[0]);
135    
136                            Object returnObj = null;
137    
138                            try {
139                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
140                            }
141                            catch (Exception e) {
142                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
143                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
144                                    }
145    
146                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
147                            }
148    
149                            return (java.util.List<com.liferay.portal.model.Country>)returnObj;
150                    }
151                    catch (com.liferay.portal.kernel.exception.SystemException se) {
152                            _log.error(se, se);
153    
154                            throw se;
155                    }
156            }
157    
158            public static java.util.List<com.liferay.portal.model.Country> getCountries(
159                    HttpPrincipal httpPrincipal, boolean active)
160                    throws com.liferay.portal.kernel.exception.SystemException {
161                    try {
162                            Object paramObj0 = new BooleanWrapper(active);
163    
164                            MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
165                                            "getCountries", new Object[] { paramObj0 });
166    
167                            Object returnObj = null;
168    
169                            try {
170                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
171                            }
172                            catch (Exception e) {
173                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
174                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
175                                    }
176    
177                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
178                            }
179    
180                            return (java.util.List<com.liferay.portal.model.Country>)returnObj;
181                    }
182                    catch (com.liferay.portal.kernel.exception.SystemException se) {
183                            _log.error(se, se);
184    
185                            throw se;
186                    }
187            }
188    
189            public static com.liferay.portal.model.Country getCountry(
190                    HttpPrincipal httpPrincipal, long countryId)
191                    throws com.liferay.portal.kernel.exception.PortalException,
192                            com.liferay.portal.kernel.exception.SystemException {
193                    try {
194                            Object paramObj0 = new LongWrapper(countryId);
195    
196                            MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
197                                            "getCountry", new Object[] { paramObj0 });
198    
199                            Object returnObj = null;
200    
201                            try {
202                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
210                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
211                                    }
212    
213                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
214                            }
215    
216                            return (com.liferay.portal.model.Country)returnObj;
217                    }
218                    catch (com.liferay.portal.kernel.exception.SystemException se) {
219                            _log.error(se, se);
220    
221                            throw se;
222                    }
223            }
224    
225            public static com.liferay.portal.model.Country getCountryByA2(
226                    HttpPrincipal httpPrincipal, java.lang.String a2)
227                    throws com.liferay.portal.kernel.exception.PortalException,
228                            com.liferay.portal.kernel.exception.SystemException {
229                    try {
230                            Object paramObj0 = a2;
231    
232                            if (a2 == null) {
233                                    paramObj0 = new NullWrapper("java.lang.String");
234                            }
235    
236                            MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
237                                            "getCountryByA2", new Object[] { paramObj0 });
238    
239                            Object returnObj = null;
240    
241                            try {
242                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
243                            }
244                            catch (Exception e) {
245                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
246                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
247                                    }
248    
249                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
250                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
251                                    }
252    
253                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
254                            }
255    
256                            return (com.liferay.portal.model.Country)returnObj;
257                    }
258                    catch (com.liferay.portal.kernel.exception.SystemException se) {
259                            _log.error(se, se);
260    
261                            throw se;
262                    }
263            }
264    
265            public static com.liferay.portal.model.Country getCountryByA3(
266                    HttpPrincipal httpPrincipal, java.lang.String a3)
267                    throws com.liferay.portal.kernel.exception.PortalException,
268                            com.liferay.portal.kernel.exception.SystemException {
269                    try {
270                            Object paramObj0 = a3;
271    
272                            if (a3 == null) {
273                                    paramObj0 = new NullWrapper("java.lang.String");
274                            }
275    
276                            MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
277                                            "getCountryByA3", new Object[] { paramObj0 });
278    
279                            Object returnObj = null;
280    
281                            try {
282                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
283                            }
284                            catch (Exception e) {
285                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
286                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
287                                    }
288    
289                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
290                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
291                                    }
292    
293                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
294                            }
295    
296                            return (com.liferay.portal.model.Country)returnObj;
297                    }
298                    catch (com.liferay.portal.kernel.exception.SystemException se) {
299                            _log.error(se, se);
300    
301                            throw se;
302                    }
303            }
304    
305            public static com.liferay.portal.model.Country getCountryByName(
306                    HttpPrincipal httpPrincipal, java.lang.String name)
307                    throws com.liferay.portal.kernel.exception.PortalException,
308                            com.liferay.portal.kernel.exception.SystemException {
309                    try {
310                            Object paramObj0 = name;
311    
312                            if (name == null) {
313                                    paramObj0 = new NullWrapper("java.lang.String");
314                            }
315    
316                            MethodWrapper methodWrapper = new MethodWrapper(CountryServiceUtil.class.getName(),
317                                            "getCountryByName", new Object[] { paramObj0 });
318    
319                            Object returnObj = null;
320    
321                            try {
322                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
323                            }
324                            catch (Exception e) {
325                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
326                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
327                                    }
328    
329                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
330                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
331                                    }
332    
333                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
334                            }
335    
336                            return (com.liferay.portal.model.Country)returnObj;
337                    }
338                    catch (com.liferay.portal.kernel.exception.SystemException se) {
339                            _log.error(se, se);
340    
341                            throw se;
342                    }
343            }
344    
345            private static Log _log = LogFactoryUtil.getLog(CountryServiceHttp.class);
346    }