001
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.kernel.util.MethodHandler;
020 import com.liferay.portal.kernel.util.MethodKey;
021 import com.liferay.portal.security.auth.HttpPrincipal;
022 import com.liferay.portal.service.ResourcePermissionServiceUtil;
023
024
054 public class ResourcePermissionServiceHttp {
055 public static void addResourcePermission(HttpPrincipal httpPrincipal,
056 long groupId, long companyId, java.lang.String name, int scope,
057 java.lang.String primKey, long roleId, java.lang.String actionId)
058 throws com.liferay.portal.kernel.exception.PortalException,
059 com.liferay.portal.kernel.exception.SystemException {
060 try {
061 MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
062 "addResourcePermission", long.class, long.class,
063 java.lang.String.class, int.class, java.lang.String.class,
064 long.class, java.lang.String.class);
065
066 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
067 companyId, name, scope, primKey, roleId, actionId);
068
069 try {
070 TunnelUtil.invoke(httpPrincipal, methodHandler);
071 }
072 catch (Exception e) {
073 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
074 throw (com.liferay.portal.kernel.exception.PortalException)e;
075 }
076
077 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
078 throw (com.liferay.portal.kernel.exception.SystemException)e;
079 }
080
081 throw new com.liferay.portal.kernel.exception.SystemException(e);
082 }
083 }
084 catch (com.liferay.portal.kernel.exception.SystemException se) {
085 _log.error(se, se);
086
087 throw se;
088 }
089 }
090
091 public static void setIndividualResourcePermissions(
092 HttpPrincipal httpPrincipal, long groupId, long companyId,
093 java.lang.String name, java.lang.String primKey, long roleId,
094 java.lang.String[] actionIds)
095 throws com.liferay.portal.kernel.exception.PortalException,
096 com.liferay.portal.kernel.exception.SystemException {
097 try {
098 MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
099 "setIndividualResourcePermissions", long.class, long.class,
100 java.lang.String.class, java.lang.String.class, long.class,
101 java.lang.String[].class);
102
103 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
104 companyId, name, primKey, roleId, actionIds);
105
106 try {
107 TunnelUtil.invoke(httpPrincipal, methodHandler);
108 }
109 catch (Exception e) {
110 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
111 throw (com.liferay.portal.kernel.exception.PortalException)e;
112 }
113
114 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
115 throw (com.liferay.portal.kernel.exception.SystemException)e;
116 }
117
118 throw new com.liferay.portal.kernel.exception.SystemException(e);
119 }
120 }
121 catch (com.liferay.portal.kernel.exception.SystemException se) {
122 _log.error(se, se);
123
124 throw se;
125 }
126 }
127
128 public static void removeResourcePermission(HttpPrincipal httpPrincipal,
129 long groupId, long companyId, java.lang.String name, int scope,
130 java.lang.String primKey, long roleId, java.lang.String actionId)
131 throws com.liferay.portal.kernel.exception.PortalException,
132 com.liferay.portal.kernel.exception.SystemException {
133 try {
134 MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
135 "removeResourcePermission", long.class, long.class,
136 java.lang.String.class, int.class, java.lang.String.class,
137 long.class, java.lang.String.class);
138
139 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
140 companyId, name, scope, primKey, roleId, actionId);
141
142 try {
143 TunnelUtil.invoke(httpPrincipal, methodHandler);
144 }
145 catch (Exception e) {
146 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
147 throw (com.liferay.portal.kernel.exception.PortalException)e;
148 }
149
150 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
151 throw (com.liferay.portal.kernel.exception.SystemException)e;
152 }
153
154 throw new com.liferay.portal.kernel.exception.SystemException(e);
155 }
156 }
157 catch (com.liferay.portal.kernel.exception.SystemException se) {
158 _log.error(se, se);
159
160 throw se;
161 }
162 }
163
164 public static void removeResourcePermissions(HttpPrincipal httpPrincipal,
165 long groupId, long companyId, java.lang.String name, int scope,
166 long roleId, java.lang.String actionId)
167 throws com.liferay.portal.kernel.exception.PortalException,
168 com.liferay.portal.kernel.exception.SystemException {
169 try {
170 MethodKey methodKey = new MethodKey(ResourcePermissionServiceUtil.class.getName(),
171 "removeResourcePermissions", long.class, long.class,
172 java.lang.String.class, int.class, long.class,
173 java.lang.String.class);
174
175 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
176 companyId, name, scope, roleId, actionId);
177
178 try {
179 TunnelUtil.invoke(httpPrincipal, methodHandler);
180 }
181 catch (Exception e) {
182 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
183 throw (com.liferay.portal.kernel.exception.PortalException)e;
184 }
185
186 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
187 throw (com.liferay.portal.kernel.exception.SystemException)e;
188 }
189
190 throw new com.liferay.portal.kernel.exception.SystemException(e);
191 }
192 }
193 catch (com.liferay.portal.kernel.exception.SystemException se) {
194 _log.error(se, se);
195
196 throw se;
197 }
198 }
199
200 private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceHttp.class);
201 }