001 /** 002 * Copyright (c) 2000-present 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; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.exception.PortalException; 020 import com.liferay.portal.kernel.exception.SystemException; 021 import com.liferay.portal.kernel.transaction.Isolation; 022 import com.liferay.portal.kernel.transaction.Propagation; 023 import com.liferay.portal.kernel.transaction.Transactional; 024 025 /** 026 * Provides the local service interface for Resource. Methods of this 027 * service will not have security checks based on the propagated JAAS 028 * credentials because this service can only be accessed from within the same 029 * VM. 030 * 031 * @author Brian Wing Shun Chan 032 * @see ResourceLocalServiceUtil 033 * @see com.liferay.portal.service.base.ResourceLocalServiceBaseImpl 034 * @see com.liferay.portal.service.impl.ResourceLocalServiceImpl 035 * @generated 036 */ 037 @ProviderType 038 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 039 PortalException.class, SystemException.class}) 040 public interface ResourceLocalService extends BaseLocalService { 041 /* 042 * NOTE FOR DEVELOPERS: 043 * 044 * Never modify or reference this interface directly. Always use {@link ResourceLocalServiceUtil} to access the resource local service. Add custom service methods to {@link com.liferay.portal.service.impl.ResourceLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 045 */ 046 047 /** 048 * Adds resources for the model, always creating a resource at the 049 * individual scope and only creating resources at the group, group 050 * template, and company scope if such resources don't already exist. 051 * 052 * <ol> 053 * <li> 054 * If the service context specifies that default group or default guest 055 * permissions are to be added, then only default permissions are added. See 056 * {@link com.liferay.portal.service.ServiceContext#setAddGroupPermissions( 057 * boolean)} and {@link 058 * com.liferay.portal.service.ServiceContext#setAddGuestPermissions( 059 * boolean)}. 060 * </li> 061 * <li> 062 * Else ... 063 * <ol> 064 * <li> 065 * If the service context specifies to derive default permissions, then 066 * default group and guest permissions are derived from the model and 067 * added. See {@link 068 * com.liferay.portal.service.ServiceContext#setDeriveDefaultPermissions( 069 * boolean)}. 070 * </li> 071 * <li> 072 * Lastly group and guest permissions from the service 073 * context are applied. See {@link 074 * com.liferay.portal.service.ServiceContext#setGroupPermissions(String[])} 075 * and {@link 076 * com.liferay.portal.service.ServiceContext#setGuestPermissions(String[])}. 077 * </li> 078 * </ol> 079 * 080 * </li> 081 * </ol> 082 * 083 * @param auditedModel the model to associate with the resources 084 * @param serviceContext the service context to apply. Can set whether to 085 add the model's default group and guest permissions, set whether 086 to derive default group and guest permissions from the model, set 087 group permissions to apply, and set guest permissions to apply. 088 * @throws PortalException if no portal actions could be found associated 089 with the model or if a portal exception occurred 090 */ 091 public void addModelResources( 092 com.liferay.portal.model.AuditedModel auditedModel, 093 com.liferay.portal.service.ServiceContext serviceContext) 094 throws com.liferay.portal.kernel.exception.PortalException; 095 096 /** 097 * Adds resources for the model with the name and primary key, always 098 * creating a resource at the individual scope and only creating resources 099 * at the group, group template, and company scope if such resources don't 100 * already exist. 101 * 102 * @param companyId the primary key of the portal instance 103 * @param groupId the primary key of the group 104 * @param userId the primary key of the user adding the resources 105 * @param name a name for the resource, typically the model's class name 106 * @param primKey the primary key of the model instance, optionally 107 <code>0</code> if no instance exists 108 * @param groupPermissions the group permissions to be applied 109 * @param guestPermissions the guest permissions to be applied 110 * @throws PortalException if no portal actions could be found associated 111 with the model or if a portal exception occurred 112 */ 113 public void addModelResources(long companyId, long groupId, long userId, 114 java.lang.String name, long primKey, 115 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 116 throws com.liferay.portal.kernel.exception.PortalException; 117 118 /** 119 * Adds resources for the model with the name and primary key string, always 120 * creating a resource at the individual scope and only creating resources 121 * at the group, group template, and company scope if such resources don't 122 * already exist. 123 * 124 * @param companyId the primary key of the portal instance 125 * @param groupId the primary key of the group 126 * @param userId the primary key of the user adding the resources 127 * @param name a name for the resource, typically the model's class name 128 * @param primKey the primary key string of the model instance, optionally 129 an empty string if no instance exists 130 * @param groupPermissions the group permissions to be applied 131 * @param guestPermissions the guest permissions to be applied 132 * @throws PortalException if no portal actions could be found associated 133 with the model or if a portal exception occurred 134 */ 135 public void addModelResources(long companyId, long groupId, long userId, 136 java.lang.String name, java.lang.String primKey, 137 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 138 throws com.liferay.portal.kernel.exception.PortalException; 139 140 /** 141 * Adds resources for the entity with the name. Use this method if the user 142 * is unknown or irrelevant and there is no current entity instance. 143 * 144 * @param companyId the primary key of the portal instance 145 * @param groupId the primary key of the group 146 * @param name a name for the resource, which should be a portlet ID if the 147 resource is a portlet or the resource's class name otherwise 148 * @param portletActions whether to associate portlet actions with the 149 resource 150 * @throws PortalException if no portal actions could be found associated 151 with the resource or if a portal exception occurred 152 */ 153 public void addResources(long companyId, long groupId, 154 java.lang.String name, boolean portletActions) 155 throws com.liferay.portal.kernel.exception.PortalException; 156 157 /** 158 * Adds resources for the entity with the name and primary key string, 159 * always creating a resource at the individual scope and only creating 160 * resources at the group, group template, and company scope if such 161 * resources don't already exist. 162 * 163 * @param companyId the primary key of the portal instance 164 * @param groupId the primary key of the group 165 * @param userId the primary key of the user adding the resources 166 * @param name a name for the resource, which should be a portlet ID if the 167 resource is a portlet or the resource's class name otherwise 168 * @param primKey the primary key string of the resource instance, 169 optionally an empty string if no instance exists 170 * @param portletActions whether to associate portlet actions with the 171 resource 172 * @param addGroupPermissions whether to add group permissions 173 * @param addGuestPermissions whether to add guest permissions 174 * @throws PortalException if no portal actions could be found associated 175 with the resource or if a portal exception occurred 176 */ 177 public void addResources(long companyId, long groupId, long userId, 178 java.lang.String name, java.lang.String primKey, 179 boolean portletActions, boolean addGroupPermissions, 180 boolean addGuestPermissions) 181 throws com.liferay.portal.kernel.exception.PortalException; 182 183 /** 184 * Adds resources for the entity with the name and primary key, always 185 * creating a resource at the individual scope and only creating resources 186 * at the group, group template, and company scope if such resources don't 187 * already exist. 188 * 189 * @param companyId the primary key of the portal instance 190 * @param groupId the primary key of the group 191 * @param userId the primary key of the user adding the resources 192 * @param name a name for the resource, which should be a portlet ID if the 193 resource is a portlet or the resource's class name otherwise 194 * @param primKey the primary key of the resource instance, optionally 195 <code>0</code> if no instance exists 196 * @param portletActions whether to associate portlet actions with the 197 resource 198 * @param addGroupPermissions whether to add group permissions 199 * @param addGuestPermissions whether to add guest permissions 200 * @throws PortalException if no portal actions could be found associated 201 with the resource or if a portal exception occurred 202 */ 203 public void addResources(long companyId, long groupId, long userId, 204 java.lang.String name, long primKey, boolean portletActions, 205 boolean addGroupPermissions, boolean addGuestPermissions) 206 throws com.liferay.portal.kernel.exception.PortalException; 207 208 /** 209 * Deletes the resource associated with the model at the scope. 210 * 211 * @param auditedModel the model associated with the resource 212 * @param scope the scope of the resource. For more information see {@link 213 com.liferay.portal.model.ResourceConstants}. 214 * @throws PortalException if a portal exception occurred 215 */ 216 public void deleteResource( 217 com.liferay.portal.model.AuditedModel auditedModel, int scope) 218 throws com.liferay.portal.kernel.exception.PortalException; 219 220 /** 221 * Deletes the resource matching the primary key at the scope. 222 * 223 * @param companyId the primary key of the portal instance 224 * @param name the resource's name, which should be a portlet ID if the 225 resource is a portlet or the resource's class name otherwise 226 * @param scope the scope of the resource. For more information see {@link 227 com.liferay.portal.model.ResourceConstants}. 228 * @param primKey the primary key of the resource instance 229 * @throws PortalException if a portal exception occurred 230 */ 231 public void deleteResource(long companyId, java.lang.String name, 232 int scope, long primKey) 233 throws com.liferay.portal.kernel.exception.PortalException; 234 235 /** 236 * Deletes the resource matching the primary key at the scope. 237 * 238 * @param companyId the primary key of the portal instance 239 * @param name the resource's name, which should be a portlet ID if the 240 resource is a portlet or the resource's class name otherwise 241 * @param scope the scope of the resource. For more information see {@link 242 com.liferay.portal.model.ResourceConstants}. 243 * @param primKey the primary key string of the resource instance 244 * @throws PortalException if a portal exception occurred 245 */ 246 public void deleteResource(long companyId, java.lang.String name, 247 int scope, java.lang.String primKey) 248 throws com.liferay.portal.kernel.exception.PortalException; 249 250 /** 251 * Returns the Spring bean ID for this bean. 252 * 253 * @return the Spring bean ID for this bean 254 */ 255 public java.lang.String getBeanIdentifier(); 256 257 /** 258 * Returns a new resource with the name and primary key at the scope. 259 * 260 * @param companyId the primary key of the portal instance 261 * @param name a name for the resource, which should be a portlet ID if the 262 resource is a portlet or the resource's class name otherwise 263 * @param scope the scope of the resource. For more information see {@link 264 com.liferay.portal.model.ResourceConstants}. 265 * @param primKey the primary key string of the resource 266 * @return the new resource 267 */ 268 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 269 public com.liferay.portal.model.Resource getResource(long companyId, 270 java.lang.String name, int scope, java.lang.String primKey); 271 272 /** 273 * Returns <code>true</code> if the roles have permission to perform the 274 * action on the resources. 275 * 276 * @param userId the primary key of the user performing the permission 277 check 278 * @param resourceId the primary key of the resource, typically the scope 279 group ID representing the scope in which the permission check is 280 being performed 281 * @param resources the resources for which permissions are to be checked 282 * @param actionId the primary key of the action to be performed on the 283 resources 284 * @param roleIds the primary keys of the roles 285 * @return <code>true</code> if the roles have permission to perform the 286 action on the resources;<code>false</code> otherwise 287 * @throws PortalException if any one of the roles with the primary keys 288 could not be found or if a resource action with the action ID 289 could not be found 290 */ 291 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 292 public boolean hasUserPermissions(long userId, long resourceId, 293 java.util.List<com.liferay.portal.model.Resource> resources, 294 java.lang.String actionId, long[] roleIds) 295 throws com.liferay.portal.kernel.exception.PortalException; 296 297 /** 298 * Sets the Spring bean ID for this bean. 299 * 300 * @param beanIdentifier the Spring bean ID for this bean 301 */ 302 public void setBeanIdentifier(java.lang.String beanIdentifier); 303 304 /** 305 * Updates the resources for the model, replacing their group and guest 306 * permissions with new ones from the service context. 307 * 308 * @param auditedModel the model associated with the resources 309 * @param serviceContext the service context to be applied. Can set group 310 and guest permissions. 311 * @throws PortalException if a portal exception occurred 312 */ 313 public void updateModelResources( 314 com.liferay.portal.model.AuditedModel auditedModel, 315 com.liferay.portal.service.ServiceContext serviceContext) 316 throws com.liferay.portal.kernel.exception.PortalException; 317 318 /** 319 * Updates resources matching the group, name, and primary key string at the 320 * individual scope, setting new group and guest permissions. 321 * 322 * @param companyId the primary key of the portal instance 323 * @param groupId the primary key of the group 324 * @param name the resource's name, which should be a portlet ID if the 325 resource is a portlet or the resource's class name otherwise 326 * @param primKey the primary key string of the resource instance 327 * @param groupPermissions the group permissions to be applied 328 * @param guestPermissions the guest permissions to be applied 329 * @throws PortalException if a portal exception occurred 330 */ 331 public void updateResources(long companyId, long groupId, 332 java.lang.String name, java.lang.String primKey, 333 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 334 throws com.liferay.portal.kernel.exception.PortalException; 335 336 /** 337 * Updates resources matching the group, name, and primary key at the 338 * individual scope, setting new group and guest permissions. 339 * 340 * @param companyId the primary key of the portal instance 341 * @param groupId the primary key of the group 342 * @param name the resource's name, which should be a portlet ID if the 343 resource is a portlet or the resource's class name otherwise 344 * @param primKey the primary key of the resource instance 345 * @param groupPermissions the group permissions to be applied 346 * @param guestPermissions the guest permissions to be applied 347 * @throws PortalException if a portal exception occurred 348 */ 349 public void updateResources(long companyId, long groupId, 350 java.lang.String name, long primKey, 351 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 352 throws com.liferay.portal.kernel.exception.PortalException; 353 354 /** 355 * Updates resources matching the name, primary key string and scope, 356 * replacing the primary key of their resource permissions with the new 357 * primary key. 358 * 359 * @param companyId the primary key of the portal instance 360 * @param name the resource's name, which should be a portlet ID if the 361 resource is a portlet or the resource's class name otherwise 362 * @param scope the scope of the resource. For more information see {@link 363 com.liferay.portal.model.ResourceConstants}. 364 * @param primKey the primary key string of the resource instance 365 * @param newPrimKey the new primary key string of the resource 366 */ 367 public void updateResources(long companyId, java.lang.String name, 368 int scope, java.lang.String primKey, java.lang.String newPrimKey); 369 }