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.LayoutSetServiceUtil;
031:
032: /**
033: * <a href="LayoutSetServiceHttp.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.LayoutSetServiceUtil</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.LayoutSetServiceUtil
068: * @see com.liferay.portal.service.http.LayoutSetServiceSoap
069: *
070: */
071: public class LayoutSetServiceHttp {
072: public static void updateLogo(HttpPrincipal httpPrincipal,
073: long groupId, boolean privateLayout, boolean logo,
074: java.io.File file)
075: throws com.liferay.portal.SystemException,
076: com.liferay.portal.PortalException {
077: try {
078: Object paramObj0 = new LongWrapper(groupId);
079:
080: Object paramObj1 = new BooleanWrapper(privateLayout);
081:
082: Object paramObj2 = new BooleanWrapper(logo);
083:
084: Object paramObj3 = file;
085:
086: if (file == null) {
087: paramObj3 = new NullWrapper("java.io.File");
088: }
089:
090: MethodWrapper methodWrapper = new MethodWrapper(
091: LayoutSetServiceUtil.class.getName(), "updateLogo",
092: new Object[] { paramObj0, paramObj1, paramObj2,
093: paramObj3 });
094:
095: try {
096: TunnelUtil.invoke(httpPrincipal, methodWrapper);
097: } catch (Exception e) {
098: if (e instanceof com.liferay.portal.SystemException) {
099: throw (com.liferay.portal.SystemException) e;
100: }
101:
102: if (e instanceof com.liferay.portal.PortalException) {
103: throw (com.liferay.portal.PortalException) e;
104: }
105:
106: throw new com.liferay.portal.SystemException(e);
107: }
108: } catch (com.liferay.portal.SystemException se) {
109: _log.error(se, se);
110:
111: throw se;
112: }
113: }
114:
115: public static com.liferay.portal.model.LayoutSet updateLookAndFeel(
116: HttpPrincipal httpPrincipal, long groupId,
117: boolean privateLayout, java.lang.String themeId,
118: java.lang.String colorSchemeId, java.lang.String css,
119: boolean wapTheme)
120: throws com.liferay.portal.SystemException,
121: com.liferay.portal.PortalException {
122: try {
123: Object paramObj0 = new LongWrapper(groupId);
124:
125: Object paramObj1 = new BooleanWrapper(privateLayout);
126:
127: Object paramObj2 = themeId;
128:
129: if (themeId == null) {
130: paramObj2 = new NullWrapper("java.lang.String");
131: }
132:
133: Object paramObj3 = colorSchemeId;
134:
135: if (colorSchemeId == null) {
136: paramObj3 = new NullWrapper("java.lang.String");
137: }
138:
139: Object paramObj4 = css;
140:
141: if (css == null) {
142: paramObj4 = new NullWrapper("java.lang.String");
143: }
144:
145: Object paramObj5 = new BooleanWrapper(wapTheme);
146:
147: MethodWrapper methodWrapper = new MethodWrapper(
148: LayoutSetServiceUtil.class.getName(),
149: "updateLookAndFeel", new Object[] { paramObj0,
150: paramObj1, paramObj2, paramObj3, paramObj4,
151: paramObj5 });
152:
153: Object returnObj = null;
154:
155: try {
156: returnObj = TunnelUtil.invoke(httpPrincipal,
157: methodWrapper);
158: } catch (Exception e) {
159: if (e instanceof com.liferay.portal.SystemException) {
160: throw (com.liferay.portal.SystemException) e;
161: }
162:
163: if (e instanceof com.liferay.portal.PortalException) {
164: throw (com.liferay.portal.PortalException) e;
165: }
166:
167: throw new com.liferay.portal.SystemException(e);
168: }
169:
170: return (com.liferay.portal.model.LayoutSet) returnObj;
171: } catch (com.liferay.portal.SystemException se) {
172: _log.error(se, se);
173:
174: throw se;
175: }
176: }
177:
178: public static com.liferay.portal.model.LayoutSet updateVirtualHost(
179: HttpPrincipal httpPrincipal, long groupId,
180: boolean privateLayout, java.lang.String virtualHost)
181: throws com.liferay.portal.SystemException,
182: com.liferay.portal.PortalException {
183: try {
184: Object paramObj0 = new LongWrapper(groupId);
185:
186: Object paramObj1 = new BooleanWrapper(privateLayout);
187:
188: Object paramObj2 = virtualHost;
189:
190: if (virtualHost == null) {
191: paramObj2 = new NullWrapper("java.lang.String");
192: }
193:
194: MethodWrapper methodWrapper = new MethodWrapper(
195: LayoutSetServiceUtil.class.getName(),
196: "updateVirtualHost", new Object[] { paramObj0,
197: paramObj1, paramObj2 });
198:
199: Object returnObj = null;
200:
201: try {
202: returnObj = TunnelUtil.invoke(httpPrincipal,
203: methodWrapper);
204: } catch (Exception e) {
205: if (e instanceof com.liferay.portal.SystemException) {
206: throw (com.liferay.portal.SystemException) e;
207: }
208:
209: if (e instanceof com.liferay.portal.PortalException) {
210: throw (com.liferay.portal.PortalException) e;
211: }
212:
213: throw new com.liferay.portal.SystemException(e);
214: }
215:
216: return (com.liferay.portal.model.LayoutSet) returnObj;
217: } catch (com.liferay.portal.SystemException se) {
218: _log.error(se, se);
219:
220: throw se;
221: }
222: }
223:
224: private static Log _log = LogFactoryUtil
225: .getLog(LayoutSetServiceHttp.class);
226: }
|