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.service.RoleServiceUtil;
026:
027: import java.rmi.RemoteException;
028:
029: /**
030: * <a href="RoleServiceSoap.java.html"><b><i>View Source</i></b></a>
031: *
032: * <p>
033: * ServiceBuilder generated this class. Modifications in this class will be
034: * overwritten the next time is generated.
035: * </p>
036: *
037: * <p>
038: * This class provides a SOAP utility for the
039: * <code>com.liferay.portal.service.RoleServiceUtil</code> service
040: * utility. The static methods of this class calls the same methods of the
041: * service utility. However, the signatures are different because it is
042: * difficult for SOAP to support certain types.
043: * </p>
044: *
045: * <p>
046: * ServiceBuilder follows certain rules in translating the methods. For example,
047: * if the method in the service utility returns a <code>java.util.List</code>,
048: * that is translated to an array of
049: * <code>com.liferay.portal.model.RoleSoap</code>. If the method in the
050: * service utility returns a <code>com.liferay.portal.model.Role</code>,
051: * that is translated to a <code>com.liferay.portal.model.RoleSoap</code>.
052: * Methods that SOAP cannot safely wire are skipped.
053: * </p>
054: *
055: * <p>
056: * The benefits of using the SOAP utility is that it is cross platform
057: * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
058: * even Perl, to call the generated services. One drawback of SOAP is that it is
059: * slow because it needs to serialize all calls into a text format (XML).
060: * </p>
061: *
062: * <p>
063: * You can see a list of services at
064: * http://localhost:8080/tunnel-web/secure/axis. Set the property
065: * <code>tunnel.servlet.hosts.allowed</code> in portal.properties to configure
066: * security.
067: * </p>
068: *
069: * <p>
070: * The SOAP utility is only generated for remote services.
071: * </p>
072: *
073: * @author Brian Wing Shun Chan
074: *
075: * @see com.liferay.portal.service.RoleServiceUtil
076: * @see com.liferay.portal.service.http.RoleServiceHttp
077: * @see com.liferay.portal.service.model.RoleSoap
078: *
079: */
080: public class RoleServiceSoap {
081: public static com.liferay.portal.model.RoleSoap addRole(
082: java.lang.String name, java.lang.String description,
083: int type) throws RemoteException {
084: try {
085: com.liferay.portal.model.Role returnValue = RoleServiceUtil
086: .addRole(name, description, type);
087:
088: return com.liferay.portal.model.RoleSoap
089: .toSoapModel(returnValue);
090: } catch (Exception e) {
091: _log.error(e, e);
092:
093: throw new RemoteException(e.getMessage());
094: }
095: }
096:
097: public static void addUserRoles(long userId, long[] roleIds)
098: throws RemoteException {
099: try {
100: RoleServiceUtil.addUserRoles(userId, roleIds);
101: } catch (Exception e) {
102: _log.error(e, e);
103:
104: throw new RemoteException(e.getMessage());
105: }
106: }
107:
108: public static void deleteRole(long roleId) throws RemoteException {
109: try {
110: RoleServiceUtil.deleteRole(roleId);
111: } catch (Exception e) {
112: _log.error(e, e);
113:
114: throw new RemoteException(e.getMessage());
115: }
116: }
117:
118: public static com.liferay.portal.model.RoleSoap getGroupRole(
119: long companyId, long groupId) throws RemoteException {
120: try {
121: com.liferay.portal.model.Role returnValue = RoleServiceUtil
122: .getGroupRole(companyId, groupId);
123:
124: return com.liferay.portal.model.RoleSoap
125: .toSoapModel(returnValue);
126: } catch (Exception e) {
127: _log.error(e, e);
128:
129: throw new RemoteException(e.getMessage());
130: }
131: }
132:
133: public static com.liferay.portal.model.RoleSoap[] getGroupRoles(
134: long groupId) throws RemoteException {
135: try {
136: java.util.List returnValue = RoleServiceUtil
137: .getGroupRoles(groupId);
138:
139: return com.liferay.portal.model.RoleSoap
140: .toSoapModels(returnValue);
141: } catch (Exception e) {
142: _log.error(e, e);
143:
144: throw new RemoteException(e.getMessage());
145: }
146: }
147:
148: public static com.liferay.portal.model.RoleSoap getRole(long roleId)
149: throws RemoteException {
150: try {
151: com.liferay.portal.model.Role returnValue = RoleServiceUtil
152: .getRole(roleId);
153:
154: return com.liferay.portal.model.RoleSoap
155: .toSoapModel(returnValue);
156: } catch (Exception e) {
157: _log.error(e, e);
158:
159: throw new RemoteException(e.getMessage());
160: }
161: }
162:
163: public static com.liferay.portal.model.RoleSoap getRole(
164: long companyId, java.lang.String name)
165: throws RemoteException {
166: try {
167: com.liferay.portal.model.Role returnValue = RoleServiceUtil
168: .getRole(companyId, name);
169:
170: return com.liferay.portal.model.RoleSoap
171: .toSoapModel(returnValue);
172: } catch (Exception e) {
173: _log.error(e, e);
174:
175: throw new RemoteException(e.getMessage());
176: }
177: }
178:
179: public static com.liferay.portal.model.RoleSoap[] getUserGroupRoles(
180: long userId, long groupId) throws RemoteException {
181: try {
182: java.util.List returnValue = RoleServiceUtil
183: .getUserGroupRoles(userId, groupId);
184:
185: return com.liferay.portal.model.RoleSoap
186: .toSoapModels(returnValue);
187: } catch (Exception e) {
188: _log.error(e, e);
189:
190: throw new RemoteException(e.getMessage());
191: }
192: }
193:
194: public static com.liferay.portal.model.RoleSoap[] getUserRelatedRoles(
195: long userId, java.util.List groups) throws RemoteException {
196: try {
197: java.util.List returnValue = RoleServiceUtil
198: .getUserRelatedRoles(userId, groups);
199:
200: return com.liferay.portal.model.RoleSoap
201: .toSoapModels(returnValue);
202: } catch (Exception e) {
203: _log.error(e, e);
204:
205: throw new RemoteException(e.getMessage());
206: }
207: }
208:
209: public static com.liferay.portal.model.RoleSoap[] getUserRoles(
210: long userId) throws RemoteException {
211: try {
212: java.util.List returnValue = RoleServiceUtil
213: .getUserRoles(userId);
214:
215: return com.liferay.portal.model.RoleSoap
216: .toSoapModels(returnValue);
217: } catch (Exception e) {
218: _log.error(e, e);
219:
220: throw new RemoteException(e.getMessage());
221: }
222: }
223:
224: public static boolean hasUserRole(long userId, long companyId,
225: java.lang.String name, boolean inherited)
226: throws RemoteException {
227: try {
228: boolean returnValue = RoleServiceUtil.hasUserRole(userId,
229: companyId, name, inherited);
230:
231: return returnValue;
232: } catch (Exception e) {
233: _log.error(e, e);
234:
235: throw new RemoteException(e.getMessage());
236: }
237: }
238:
239: public static boolean hasUserRoles(long userId, long companyId,
240: java.lang.String[] names, boolean inherited)
241: throws RemoteException {
242: try {
243: boolean returnValue = RoleServiceUtil.hasUserRoles(userId,
244: companyId, names, inherited);
245:
246: return returnValue;
247: } catch (Exception e) {
248: _log.error(e, e);
249:
250: throw new RemoteException(e.getMessage());
251: }
252: }
253:
254: public static void unsetUserRoles(long userId, long[] roleIds)
255: throws RemoteException {
256: try {
257: RoleServiceUtil.unsetUserRoles(userId, roleIds);
258: } catch (Exception e) {
259: _log.error(e, e);
260:
261: throw new RemoteException(e.getMessage());
262: }
263: }
264:
265: public static com.liferay.portal.model.RoleSoap updateRole(
266: long roleId, java.lang.String name,
267: java.lang.String description) throws RemoteException {
268: try {
269: com.liferay.portal.model.Role returnValue = RoleServiceUtil
270: .updateRole(roleId, name, description);
271:
272: return com.liferay.portal.model.RoleSoap
273: .toSoapModel(returnValue);
274: } catch (Exception e) {
275: _log.error(e, e);
276:
277: throw new RemoteException(e.getMessage());
278: }
279: }
280:
281: private static Log _log = LogFactoryUtil
282: .getLog(RoleServiceSoap.class);
283: }
|