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 ServiceContext#setAddGroupPermissions( 057 * boolean)} and {@link 058 * 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 * ServiceContext#setDeriveDefaultPermissions( 069 * boolean)}. 070 * </li> 071 * <li> 072 * Lastly group and guest permissions from the service 073 * context are applied. See {@link 074 * ServiceContext#setGroupPermissions(String[])} 075 * and {@link 076 * 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 */ 089 public void addModelResources( 090 com.liferay.portal.model.AuditedModel auditedModel, 091 com.liferay.portal.service.ServiceContext serviceContext) 092 throws PortalException; 093 094 /** 095 * Adds resources for the model with the name and primary key, always 096 * creating a resource at the individual scope and only creating resources 097 * at the group, group template, and company scope if such resources don't 098 * already exist. 099 * 100 * @param companyId the primary key of the portal instance 101 * @param groupId the primary key of the group 102 * @param userId the primary key of the user adding the resources 103 * @param name a name for the resource, typically the model's class name 104 * @param primKey the primary key of the model instance, optionally 105 <code>0</code> if no instance exists 106 * @param groupPermissions the group permissions to be applied 107 * @param guestPermissions the guest permissions to be applied 108 */ 109 public void addModelResources(long companyId, long groupId, long userId, 110 java.lang.String name, long primKey, 111 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 112 throws PortalException; 113 114 /** 115 * Adds resources for the model with the name and primary key string, always 116 * creating a resource at the individual scope and only creating resources 117 * at the group, group template, and company scope if such resources don't 118 * already exist. 119 * 120 * @param companyId the primary key of the portal instance 121 * @param groupId the primary key of the group 122 * @param userId the primary key of the user adding the resources 123 * @param name a name for the resource, typically the model's class name 124 * @param primKey the primary key string of the model instance, optionally 125 an empty string if no instance exists 126 * @param groupPermissions the group permissions to be applied 127 * @param guestPermissions the guest permissions to be applied 128 */ 129 public void addModelResources(long companyId, long groupId, long userId, 130 java.lang.String name, java.lang.String primKey, 131 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 132 throws PortalException; 133 134 public void addModelResources(long companyId, long groupId, long userId, 135 java.lang.String name, long primKey, 136 com.liferay.portal.service.permission.ModelPermissions modelPermissions) 137 throws PortalException; 138 139 public void addModelResources(long companyId, long groupId, long userId, 140 java.lang.String name, java.lang.String primKey, 141 com.liferay.portal.service.permission.ModelPermissions modelPermissions) 142 throws PortalException; 143 144 /** 145 * Adds resources for the entity with the name. Use this method if the user 146 * is unknown or irrelevant and there is no current entity instance. 147 * 148 * @param companyId the primary key of the portal instance 149 * @param groupId the primary key of the group 150 * @param name a name for the resource, which should be a portlet ID if the 151 resource is a portlet or the resource's class name otherwise 152 * @param portletActions whether to associate portlet actions with the 153 resource 154 */ 155 public void addResources(long companyId, long groupId, 156 java.lang.String name, boolean portletActions) 157 throws PortalException; 158 159 /** 160 * Adds resources for the entity with the name and primary key string, 161 * always creating a resource at the individual scope and only creating 162 * resources at the group, group template, and company scope if such 163 * resources don't already exist. 164 * 165 * @param companyId the primary key of the portal instance 166 * @param groupId the primary key of the group 167 * @param userId the primary key of the user adding the resources 168 * @param name a name for the resource, which should be a portlet ID if the 169 resource is a portlet or the resource's class name otherwise 170 * @param primKey the primary key string of the resource instance, 171 optionally an empty string if no instance exists 172 * @param portletActions whether to associate portlet actions with the 173 resource 174 * @param addGroupPermissions whether to add group permissions 175 * @param addGuestPermissions whether to add guest permissions 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) throws PortalException; 181 182 /** 183 * Adds resources for the entity with the name and primary key, always 184 * creating a resource at the individual scope and only creating resources 185 * at the group, group template, and company scope if such resources don't 186 * already exist. 187 * 188 * @param companyId the primary key of the portal instance 189 * @param groupId the primary key of the group 190 * @param userId the primary key of the user adding the resources 191 * @param name a name for the resource, which should be a portlet ID if the 192 resource is a portlet or the resource's class name otherwise 193 * @param primKey the primary key of the resource instance, optionally 194 <code>0</code> if no instance exists 195 * @param portletActions whether to associate portlet actions with the 196 resource 197 * @param addGroupPermissions whether to add group permissions 198 * @param addGuestPermissions whether to add guest permissions 199 */ 200 public void addResources(long companyId, long groupId, long userId, 201 java.lang.String name, long primKey, boolean portletActions, 202 boolean addGroupPermissions, boolean addGuestPermissions) 203 throws PortalException; 204 205 /** 206 * Deletes the resource associated with the model at the scope. 207 * 208 * @param auditedModel the model associated with the resource 209 * @param scope the scope of the resource. For more information see {@link 210 ResourceConstants}. 211 */ 212 public void deleteResource( 213 com.liferay.portal.model.AuditedModel auditedModel, int scope) 214 throws PortalException; 215 216 /** 217 * Deletes the resource matching the primary key at the scope. 218 * 219 * @param companyId the primary key of the portal instance 220 * @param name the resource's name, which should be a portlet ID if the 221 resource is a portlet or the resource's class name otherwise 222 * @param scope the scope of the resource. For more information see {@link 223 ResourceConstants}. 224 * @param primKey the primary key of the resource instance 225 */ 226 public void deleteResource(long companyId, java.lang.String name, 227 int scope, long primKey) throws PortalException; 228 229 /** 230 * Deletes the resource matching the primary key at the scope. 231 * 232 * @param companyId the primary key of the portal instance 233 * @param name the resource's name, which should be a portlet ID if the 234 resource is a portlet or the resource's class name otherwise 235 * @param scope the scope of the resource. For more information see {@link 236 ResourceConstants}. 237 * @param primKey the primary key string of the resource instance 238 */ 239 public void deleteResource(long companyId, java.lang.String name, 240 int scope, java.lang.String primKey) throws PortalException; 241 242 /** 243 * Returns the OSGi service identifier. 244 * 245 * @return the OSGi service identifier 246 */ 247 public java.lang.String getOSGiServiceIdentifier(); 248 249 /** 250 * Returns a new resource with the name and primary key at the scope. 251 * 252 * @param companyId the primary key of the portal instance 253 * @param name a name for the resource, which should be a portlet ID if the 254 resource is a portlet or the resource's class name otherwise 255 * @param scope the scope of the resource. For more information see {@link 256 ResourceConstants}. 257 * @param primKey the primary key string of the resource 258 * @return the new resource 259 */ 260 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 261 public com.liferay.portal.model.Resource getResource(long companyId, 262 java.lang.String name, int scope, java.lang.String primKey); 263 264 /** 265 * Returns <code>true</code> if the roles have permission to perform the 266 * action on the resources. 267 * 268 * @param userId the primary key of the user performing the permission 269 check 270 * @param resourceId the primary key of the resource, typically the scope 271 group ID representing the scope in which the permission check is 272 being performed 273 * @param resources the resources for which permissions are to be checked 274 * @param actionId the primary key of the action to be performed on the 275 resources 276 * @param roleIds the primary keys of the roles 277 * @return <code>true</code> if the roles have permission to perform the 278 action on the resources;<code>false</code> otherwise 279 */ 280 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 281 public boolean hasUserPermissions(long userId, long resourceId, 282 java.util.List<com.liferay.portal.model.Resource> resources, 283 java.lang.String actionId, long[] roleIds) throws PortalException; 284 285 /** 286 * Updates the resources for the model, replacing their group and guest 287 * permissions with new ones from the service context. 288 * 289 * @param auditedModel the model associated with the resources 290 * @param serviceContext the service context to be applied. Can set group 291 and guest permissions. 292 */ 293 public void updateModelResources( 294 com.liferay.portal.model.AuditedModel auditedModel, 295 com.liferay.portal.service.ServiceContext serviceContext) 296 throws PortalException; 297 298 /** 299 * Updates resources matching the group, name, and primary key string at the 300 * individual scope, setting new group and guest permissions. 301 * 302 * @param companyId the primary key of the portal instance 303 * @param groupId the primary key of the group 304 * @param name the resource's name, which should be a portlet ID if the 305 resource is a portlet or the resource's class name otherwise 306 * @param primKey the primary key string of the resource instance 307 * @param groupPermissions the group permissions to be applied 308 * @param guestPermissions the guest permissions to be applied 309 */ 310 public void updateResources(long companyId, long groupId, 311 java.lang.String name, java.lang.String primKey, 312 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 313 throws PortalException; 314 315 /** 316 * Updates resources matching the group, name, and primary key at the 317 * individual scope, setting new group and guest permissions. 318 * 319 * @param companyId the primary key of the portal instance 320 * @param groupId the primary key of the group 321 * @param name the resource's name, which should be a portlet ID if the 322 resource is a portlet or the resource's class name otherwise 323 * @param primKey the primary key of the resource instance 324 * @param groupPermissions the group permissions to be applied 325 * @param guestPermissions the guest permissions to be applied 326 */ 327 public void updateResources(long companyId, long groupId, 328 java.lang.String name, long primKey, 329 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 330 throws PortalException; 331 332 /** 333 * Updates resources matching the group, name, and primary key at the 334 * individual scope, setting new permissions. 335 * 336 * @param companyId the primary key of the portal instance 337 * @param groupId the primary key of the group 338 * @param name the resource's name, which should be a portlet ID if the 339 resource is a portlet or the resource's class name otherwise 340 * @param primKey the primary key of the resource instance 341 * @param modelPermissions the model permissions to be applied 342 */ 343 public void updateResources(long companyId, long groupId, 344 java.lang.String name, long primKey, 345 com.liferay.portal.service.permission.ModelPermissions modelPermissions) 346 throws PortalException; 347 348 /** 349 * Updates resources matching the group, name, and primary key string at the 350 * individual scope, setting new permissions. 351 * 352 * @param companyId the primary key of the portal instance 353 * @param groupId the primary key of the group 354 * @param name the resource's name, which should be a portlet ID if the 355 resource is a portlet or the resource's class name otherwise 356 * @param primKey the primary key string of the resource instance 357 * @param modelPermissions the model permissions to be applied 358 */ 359 public void updateResources(long companyId, long groupId, 360 java.lang.String name, java.lang.String primKey, 361 com.liferay.portal.service.permission.ModelPermissions modelPermissions) 362 throws PortalException; 363 364 /** 365 * Updates resources matching the name, primary key string and scope, 366 * replacing the primary key of their resource permissions with the new 367 * primary key. 368 * 369 * @param companyId the primary key of the portal instance 370 * @param name the resource's name, which should be a portlet ID if the 371 resource is a portlet or the resource's class name otherwise 372 * @param scope the scope of the resource. For more information see {@link 373 ResourceConstants}. 374 * @param primKey the primary key string of the resource instance 375 * @param newPrimKey the new primary key string of the resource 376 */ 377 public void updateResources(long companyId, java.lang.String name, 378 int scope, java.lang.String primKey, java.lang.String newPrimKey); 379 }