001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.BooleanWrapper;
026: import com.liferay.portal.kernel.util.LongWrapper;
027: import com.liferay.portal.kernel.util.MethodWrapper;
028: import com.liferay.portal.kernel.util.NullWrapper;
029: import com.liferay.portal.security.auth.HttpPrincipal;
030: import com.liferay.portal.service.CountryServiceUtil;
031:
032: /**
033: * <a href="CountryServiceHttp.java.html"><b><i>View Source</i></b></a>
034: *
035: * <p>
036: * ServiceBuilder generated this class. Modifications in this class will be
037: * overwritten the next time is generated.
038: * </p>
039: *
040: * <p>
041: * This class provides a HTTP utility for the
042: * <code>com.liferay.portal.service.CountryServiceUtil</code> service
043: * utility. The static methods of this class calls the same methods of the
044: * service utility. However, the signatures are different because it requires an
045: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
046: * parameter.
047: * </p>
048: *
049: * <p>
050: * The benefits of using the HTTP utility is that it is fast and allows for
051: * tunneling without the cost of serializing to text. The drawback is that it
052: * only works with Java.
053: * </p>
054: *
055: * <p>
056: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
057: * portal.properties to configure security.
058: * </p>
059: *
060: * <p>
061: * The HTTP utility is only generated for remote services.
062: * </p>
063: *
064: * @author Brian Wing Shun Chan
065: *
066: * @see com.liferay.portal.security.auth.HttpPrincipal
067: * @see com.liferay.portal.service.CountryServiceUtil
068: * @see com.liferay.portal.service.http.CountryServiceSoap
069: *
070: */
071: public class CountryServiceHttp {
072: public static com.liferay.portal.model.Country addCountry(
073: HttpPrincipal httpPrincipal, java.lang.String name,
074: java.lang.String a2, java.lang.String a3,
075: java.lang.String number, java.lang.String idd,
076: boolean active) throws com.liferay.portal.SystemException,
077: com.liferay.portal.PortalException {
078: try {
079: Object paramObj0 = name;
080:
081: if (name == null) {
082: paramObj0 = new NullWrapper("java.lang.String");
083: }
084:
085: Object paramObj1 = a2;
086:
087: if (a2 == null) {
088: paramObj1 = new NullWrapper("java.lang.String");
089: }
090:
091: Object paramObj2 = a3;
092:
093: if (a3 == null) {
094: paramObj2 = new NullWrapper("java.lang.String");
095: }
096:
097: Object paramObj3 = number;
098:
099: if (number == null) {
100: paramObj3 = new NullWrapper("java.lang.String");
101: }
102:
103: Object paramObj4 = idd;
104:
105: if (idd == null) {
106: paramObj4 = new NullWrapper("java.lang.String");
107: }
108:
109: Object paramObj5 = new BooleanWrapper(active);
110:
111: MethodWrapper methodWrapper = new MethodWrapper(
112: CountryServiceUtil.class.getName(), "addCountry",
113: new Object[] { paramObj0, paramObj1, paramObj2,
114: paramObj3, paramObj4, paramObj5 });
115:
116: Object returnObj = null;
117:
118: try {
119: returnObj = TunnelUtil.invoke(httpPrincipal,
120: methodWrapper);
121: } catch (Exception e) {
122: if (e instanceof com.liferay.portal.SystemException) {
123: throw (com.liferay.portal.SystemException) e;
124: }
125:
126: if (e instanceof com.liferay.portal.PortalException) {
127: throw (com.liferay.portal.PortalException) e;
128: }
129:
130: throw new com.liferay.portal.SystemException(e);
131: }
132:
133: return (com.liferay.portal.model.Country) returnObj;
134: } catch (com.liferay.portal.SystemException se) {
135: _log.error(se, se);
136:
137: throw se;
138: }
139: }
140:
141: public static java.util.List getCountries(
142: HttpPrincipal httpPrincipal)
143: throws com.liferay.portal.SystemException {
144: try {
145: MethodWrapper methodWrapper = new MethodWrapper(
146: CountryServiceUtil.class.getName(), "getCountries",
147: new Object[0]);
148:
149: Object returnObj = null;
150:
151: try {
152: returnObj = TunnelUtil.invoke(httpPrincipal,
153: methodWrapper);
154: } catch (Exception e) {
155: if (e instanceof com.liferay.portal.SystemException) {
156: throw (com.liferay.portal.SystemException) e;
157: }
158:
159: throw new com.liferay.portal.SystemException(e);
160: }
161:
162: return (java.util.List) returnObj;
163: } catch (com.liferay.portal.SystemException se) {
164: _log.error(se, se);
165:
166: throw se;
167: }
168: }
169:
170: public static java.util.List getCountries(
171: HttpPrincipal httpPrincipal, boolean active)
172: throws com.liferay.portal.SystemException {
173: try {
174: Object paramObj0 = new BooleanWrapper(active);
175:
176: MethodWrapper methodWrapper = new MethodWrapper(
177: CountryServiceUtil.class.getName(), "getCountries",
178: new Object[] { paramObj0 });
179:
180: Object returnObj = null;
181:
182: try {
183: returnObj = TunnelUtil.invoke(httpPrincipal,
184: methodWrapper);
185: } catch (Exception e) {
186: if (e instanceof com.liferay.portal.SystemException) {
187: throw (com.liferay.portal.SystemException) e;
188: }
189:
190: throw new com.liferay.portal.SystemException(e);
191: }
192:
193: return (java.util.List) returnObj;
194: } catch (com.liferay.portal.SystemException se) {
195: _log.error(se, se);
196:
197: throw se;
198: }
199: }
200:
201: public static com.liferay.portal.model.Country getCountry(
202: HttpPrincipal httpPrincipal, long countryId)
203: throws com.liferay.portal.SystemException,
204: com.liferay.portal.PortalException {
205: try {
206: Object paramObj0 = new LongWrapper(countryId);
207:
208: MethodWrapper methodWrapper = new MethodWrapper(
209: CountryServiceUtil.class.getName(), "getCountry",
210: new Object[] { paramObj0 });
211:
212: Object returnObj = null;
213:
214: try {
215: returnObj = TunnelUtil.invoke(httpPrincipal,
216: methodWrapper);
217: } catch (Exception e) {
218: if (e instanceof com.liferay.portal.SystemException) {
219: throw (com.liferay.portal.SystemException) e;
220: }
221:
222: if (e instanceof com.liferay.portal.PortalException) {
223: throw (com.liferay.portal.PortalException) e;
224: }
225:
226: throw new com.liferay.portal.SystemException(e);
227: }
228:
229: return (com.liferay.portal.model.Country) returnObj;
230: } catch (com.liferay.portal.SystemException se) {
231: _log.error(se, se);
232:
233: throw se;
234: }
235: }
236:
237: private static Log _log = LogFactoryUtil
238: .getLog(CountryServiceHttp.class);
239: }
|