001    /**
002     * Copyright (c) 2000-2013 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.service.ResourcePermissionServiceUtil;
020    
021    import java.rmi.RemoteException;
022    
023    /**
024     * Provides the SOAP utility for the
025     * {@link com.liferay.portal.service.ResourcePermissionServiceUtil} service utility. The
026     * static methods of this class calls the same methods of the service utility.
027     * However, the signatures are different because it is difficult for SOAP to
028     * support certain types.
029     *
030     * <p>
031     * ServiceBuilder follows certain rules in translating the methods. For example,
032     * if the method in the service utility returns a {@link java.util.List}, that
033     * is translated to an array of {@link com.liferay.portal.model.ResourcePermissionSoap}.
034     * If the method in the service utility returns a
035     * {@link com.liferay.portal.model.ResourcePermission}, that is translated to a
036     * {@link com.liferay.portal.model.ResourcePermissionSoap}. Methods that SOAP cannot
037     * safely wire are skipped.
038     * </p>
039     *
040     * <p>
041     * The benefits of using the SOAP utility is that it is cross platform
042     * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
043     * even Perl, to call the generated services. One drawback of SOAP is that it is
044     * slow because it needs to serialize all calls into a text format (XML).
045     * </p>
046     *
047     * <p>
048     * You can see a list of services at http://localhost:8080/api/axis. Set the
049     * property <b>axis.servlet.hosts.allowed</b> in portal.properties to configure
050     * security.
051     * </p>
052     *
053     * <p>
054     * The SOAP utility is only generated for remote services.
055     * </p>
056     *
057     * @author Brian Wing Shun Chan
058     * @see ResourcePermissionServiceHttp
059     * @see com.liferay.portal.model.ResourcePermissionSoap
060     * @see com.liferay.portal.service.ResourcePermissionServiceUtil
061     * @generated
062     */
063    public class ResourcePermissionServiceSoap {
064            /**
065            * Grants the role permission at the scope to perform the action on
066            * resources of the type. Existing actions are retained.
067            *
068            * <p>
069            * This method cannot be used to grant individual scope permissions, but is
070            * only intended for adding permissions at the company, group, and
071            * group-template scopes. For example, this method could be used to grant a
072            * company scope permission to edit message board posts.
073            * </p>
074            *
075            * <p>
076            * If a company scope permission is granted to resources that the role
077            * already had group scope permissions to, the group scope permissions are
078            * deleted. Likewise, if a group scope permission is granted to resources
079            * that the role already had company scope permissions to, the company scope
080            * permissions are deleted. Be aware that this latter behavior can result in
081            * an overall reduction in permissions for the role.
082            * </p>
083            *
084            * <p>
085            * Depending on the scope, the value of <code>primKey</code> will have
086            * different meanings. For more information, see {@link
087            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
088            * </p>
089            *
090            * @param groupId the primary key of the group
091            * @param companyId the primary key of the company
092            * @param name the resource's name, which can be either a class name or a
093            portlet ID
094            * @param scope the scope. This method only supports company, group, and
095            group-template scope.
096            * @param primKey the primary key
097            * @param roleId the primary key of the role
098            * @param actionId the action ID
099            * @throws PortalException if the user did not have permission to add
100            resource permissions, or if scope was set to individual scope or
101            if a role with the primary key or a resource action with the name
102            and action ID could not be found
103            * @throws SystemException if a system exception occurred
104            */
105            public static void addResourcePermission(long groupId, long companyId,
106                    java.lang.String name, int scope, java.lang.String primKey,
107                    long roleId, java.lang.String actionId) throws RemoteException {
108                    try {
109                            ResourcePermissionServiceUtil.addResourcePermission(groupId,
110                                    companyId, name, scope, primKey, roleId, actionId);
111                    }
112                    catch (Exception e) {
113                            _log.error(e, e);
114    
115                            throw new RemoteException(e.getMessage());
116                    }
117            }
118    
119            /**
120            * Revokes permission at the scope from the role to perform the action on
121            * resources of the type. For example, this method could be used to revoke a
122            * group scope permission to edit blog posts.
123            *
124            * <p>
125            * Depending on the scope, the value of <code>primKey</code> will have
126            * different meanings. For more information, see {@link
127            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
128            * </p>
129            *
130            * @param groupId the primary key of the group
131            * @param companyId the primary key of the company
132            * @param name the resource's name, which can be either a class name or a
133            portlet ID
134            * @param scope the scope
135            * @param primKey the primary key
136            * @param roleId the primary key of the role
137            * @param actionId the action ID
138            * @throws PortalException if the user did not have permission to remove
139            resource permissions, or if a role with the primary key or a
140            resource action with the name and action ID could not be found
141            * @throws SystemException if a system exception occurred
142            */
143            public static void removeResourcePermission(long groupId, long companyId,
144                    java.lang.String name, int scope, java.lang.String primKey,
145                    long roleId, java.lang.String actionId) throws RemoteException {
146                    try {
147                            ResourcePermissionServiceUtil.removeResourcePermission(groupId,
148                                    companyId, name, scope, primKey, roleId, actionId);
149                    }
150                    catch (Exception e) {
151                            _log.error(e, e);
152    
153                            throw new RemoteException(e.getMessage());
154                    }
155            }
156    
157            /**
158            * Revokes all permissions at the scope from the role to perform the action
159            * on resources of the type. For example, this method could be used to
160            * revoke all individual scope permissions to edit blog posts from site
161            * members.
162            *
163            * @param groupId the primary key of the group
164            * @param companyId the primary key of the company
165            * @param name the resource's name, which can be either a class name or a
166            portlet ID
167            * @param scope the scope
168            * @param roleId the primary key of the role
169            * @param actionId the action ID
170            * @throws PortalException if the user did not have permission to remove
171            resource permissions, or if a role with the primary key or a
172            resource action with the name and action ID could not be found
173            * @throws SystemException if a system exception occurred
174            */
175            public static void removeResourcePermissions(long groupId, long companyId,
176                    java.lang.String name, int scope, long roleId, java.lang.String actionId)
177                    throws RemoteException {
178                    try {
179                            ResourcePermissionServiceUtil.removeResourcePermissions(groupId,
180                                    companyId, name, scope, roleId, actionId);
181                    }
182                    catch (Exception e) {
183                            _log.error(e, e);
184    
185                            throw new RemoteException(e.getMessage());
186                    }
187            }
188    
189            /**
190            * Updates the role's permissions at the scope, setting the actions that can
191            * be performed on resources of the type. Existing actions are replaced.
192            *
193            * <p>
194            * This method can be used to set permissions at any scope, but it is
195            * generally only used at the individual scope. For example, it could be
196            * used to set the guest permissions on a blog post.
197            * </p>
198            *
199            * <p>
200            * Depending on the scope, the value of <code>primKey</code> will have
201            * different meanings. For more information, see {@link
202            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
203            * </p>
204            *
205            * @param groupId the primary key of the group
206            * @param companyId the primary key of the company
207            * @param name the resource's name, which can be either a class name or a
208            portlet ID
209            * @param primKey the primary key
210            * @param roleId the primary key of the role
211            * @param actionIds the action IDs of the actions
212            * @throws PortalException if the user did not have permission to set
213            resource permissions, or if a role with the primary key or a
214            resource action with the name and action ID could not be found
215            * @throws SystemException if a system exception occurred
216            */
217            public static void setIndividualResourcePermissions(long groupId,
218                    long companyId, java.lang.String name, java.lang.String primKey,
219                    long roleId, java.lang.String[] actionIds) throws RemoteException {
220                    try {
221                            ResourcePermissionServiceUtil.setIndividualResourcePermissions(groupId,
222                                    companyId, name, primKey, roleId, actionIds);
223                    }
224                    catch (Exception e) {
225                            _log.error(e, e);
226    
227                            throw new RemoteException(e.getMessage());
228                    }
229            }
230    
231            private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceSoap.class);
232    }