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.RegionServiceUtil;
031:
032: /**
033: * <a href="RegionServiceHttp.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.RegionServiceUtil</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.RegionServiceUtil
068: * @see com.liferay.portal.service.http.RegionServiceSoap
069: *
070: */
071: public class RegionServiceHttp {
072: public static com.liferay.portal.model.Region addRegion(
073: HttpPrincipal httpPrincipal, long countryId,
074: java.lang.String regionCode, java.lang.String name,
075: boolean active) throws com.liferay.portal.SystemException,
076: com.liferay.portal.PortalException {
077: try {
078: Object paramObj0 = new LongWrapper(countryId);
079:
080: Object paramObj1 = regionCode;
081:
082: if (regionCode == null) {
083: paramObj1 = new NullWrapper("java.lang.String");
084: }
085:
086: Object paramObj2 = name;
087:
088: if (name == null) {
089: paramObj2 = new NullWrapper("java.lang.String");
090: }
091:
092: Object paramObj3 = new BooleanWrapper(active);
093:
094: MethodWrapper methodWrapper = new MethodWrapper(
095: RegionServiceUtil.class.getName(), "addRegion",
096: new Object[] { paramObj0, paramObj1, paramObj2,
097: paramObj3 });
098:
099: Object returnObj = null;
100:
101: try {
102: returnObj = TunnelUtil.invoke(httpPrincipal,
103: methodWrapper);
104: } catch (Exception e) {
105: if (e instanceof com.liferay.portal.SystemException) {
106: throw (com.liferay.portal.SystemException) e;
107: }
108:
109: if (e instanceof com.liferay.portal.PortalException) {
110: throw (com.liferay.portal.PortalException) e;
111: }
112:
113: throw new com.liferay.portal.SystemException(e);
114: }
115:
116: return (com.liferay.portal.model.Region) returnObj;
117: } catch (com.liferay.portal.SystemException se) {
118: _log.error(se, se);
119:
120: throw se;
121: }
122: }
123:
124: public static java.util.List getRegions(HttpPrincipal httpPrincipal)
125: throws com.liferay.portal.SystemException {
126: try {
127: MethodWrapper methodWrapper = new MethodWrapper(
128: RegionServiceUtil.class.getName(), "getRegions",
129: new Object[0]);
130:
131: Object returnObj = null;
132:
133: try {
134: returnObj = TunnelUtil.invoke(httpPrincipal,
135: methodWrapper);
136: } catch (Exception e) {
137: if (e instanceof com.liferay.portal.SystemException) {
138: throw (com.liferay.portal.SystemException) e;
139: }
140:
141: throw new com.liferay.portal.SystemException(e);
142: }
143:
144: return (java.util.List) returnObj;
145: } catch (com.liferay.portal.SystemException se) {
146: _log.error(se, se);
147:
148: throw se;
149: }
150: }
151:
152: public static java.util.List getRegions(
153: HttpPrincipal httpPrincipal, long countryId)
154: throws com.liferay.portal.SystemException {
155: try {
156: Object paramObj0 = new LongWrapper(countryId);
157:
158: MethodWrapper methodWrapper = new MethodWrapper(
159: RegionServiceUtil.class.getName(), "getRegions",
160: new Object[] { paramObj0 });
161:
162: Object returnObj = null;
163:
164: try {
165: returnObj = TunnelUtil.invoke(httpPrincipal,
166: methodWrapper);
167: } catch (Exception e) {
168: if (e instanceof com.liferay.portal.SystemException) {
169: throw (com.liferay.portal.SystemException) e;
170: }
171:
172: throw new com.liferay.portal.SystemException(e);
173: }
174:
175: return (java.util.List) returnObj;
176: } catch (com.liferay.portal.SystemException se) {
177: _log.error(se, se);
178:
179: throw se;
180: }
181: }
182:
183: public static java.util.List getRegions(
184: HttpPrincipal httpPrincipal, boolean active)
185: throws com.liferay.portal.SystemException {
186: try {
187: Object paramObj0 = new BooleanWrapper(active);
188:
189: MethodWrapper methodWrapper = new MethodWrapper(
190: RegionServiceUtil.class.getName(), "getRegions",
191: new Object[] { paramObj0 });
192:
193: Object returnObj = null;
194:
195: try {
196: returnObj = TunnelUtil.invoke(httpPrincipal,
197: methodWrapper);
198: } catch (Exception e) {
199: if (e instanceof com.liferay.portal.SystemException) {
200: throw (com.liferay.portal.SystemException) e;
201: }
202:
203: throw new com.liferay.portal.SystemException(e);
204: }
205:
206: return (java.util.List) returnObj;
207: } catch (com.liferay.portal.SystemException se) {
208: _log.error(se, se);
209:
210: throw se;
211: }
212: }
213:
214: public static java.util.List getRegions(
215: HttpPrincipal httpPrincipal, long countryId, boolean active)
216: throws com.liferay.portal.SystemException {
217: try {
218: Object paramObj0 = new LongWrapper(countryId);
219:
220: Object paramObj1 = new BooleanWrapper(active);
221:
222: MethodWrapper methodWrapper = new MethodWrapper(
223: RegionServiceUtil.class.getName(), "getRegions",
224: new Object[] { paramObj0, paramObj1 });
225:
226: Object returnObj = null;
227:
228: try {
229: returnObj = TunnelUtil.invoke(httpPrincipal,
230: methodWrapper);
231: } catch (Exception e) {
232: if (e instanceof com.liferay.portal.SystemException) {
233: throw (com.liferay.portal.SystemException) e;
234: }
235:
236: throw new com.liferay.portal.SystemException(e);
237: }
238:
239: return (java.util.List) returnObj;
240: } catch (com.liferay.portal.SystemException se) {
241: _log.error(se, se);
242:
243: throw se;
244: }
245: }
246:
247: public static com.liferay.portal.model.Region getRegion(
248: HttpPrincipal httpPrincipal, long regionId)
249: throws com.liferay.portal.SystemException,
250: com.liferay.portal.PortalException {
251: try {
252: Object paramObj0 = new LongWrapper(regionId);
253:
254: MethodWrapper methodWrapper = new MethodWrapper(
255: RegionServiceUtil.class.getName(), "getRegion",
256: new Object[] { paramObj0 });
257:
258: Object returnObj = null;
259:
260: try {
261: returnObj = TunnelUtil.invoke(httpPrincipal,
262: methodWrapper);
263: } catch (Exception e) {
264: if (e instanceof com.liferay.portal.SystemException) {
265: throw (com.liferay.portal.SystemException) e;
266: }
267:
268: if (e instanceof com.liferay.portal.PortalException) {
269: throw (com.liferay.portal.PortalException) e;
270: }
271:
272: throw new com.liferay.portal.SystemException(e);
273: }
274:
275: return (com.liferay.portal.model.Region) returnObj;
276: } catch (com.liferay.portal.SystemException se) {
277: _log.error(se, se);
278:
279: throw se;
280: }
281: }
282:
283: private static Log _log = LogFactoryUtil
284: .getLog(RegionServiceHttp.class);
285: }
|