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; 016 017 import com.liferay.portal.kernel.exception.PortalException; 018 import com.liferay.portal.kernel.exception.SystemException; 019 import com.liferay.portal.kernel.transaction.Isolation; 020 import com.liferay.portal.kernel.transaction.Propagation; 021 import com.liferay.portal.kernel.transaction.Transactional; 022 023 /** 024 * The interface for the resource local service. 025 * 026 * <p> 027 * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM. 028 * </p> 029 * 030 * @author Brian Wing Shun Chan 031 * @see ResourceLocalServiceUtil 032 * @see com.liferay.portal.service.base.ResourceLocalServiceBaseImpl 033 * @see com.liferay.portal.service.impl.ResourceLocalServiceImpl 034 * @generated 035 */ 036 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 037 PortalException.class, SystemException.class}) 038 public interface ResourceLocalService extends BaseLocalService, 039 PersistedModelLocalService { 040 /* 041 * NOTE FOR DEVELOPERS: 042 * 043 * 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. 044 */ 045 046 /** 047 * Adds the resource to the database. Also notifies the appropriate model listeners. 048 * 049 * @param resource the resource 050 * @return the resource that was added 051 * @throws SystemException if a system exception occurred 052 */ 053 public com.liferay.portal.model.Resource addResource( 054 com.liferay.portal.model.Resource resource) 055 throws com.liferay.portal.kernel.exception.SystemException; 056 057 /** 058 * Creates a new resource with the primary key. Does not add the resource to the database. 059 * 060 * @param resourceId the primary key for the new resource 061 * @return the new resource 062 */ 063 public com.liferay.portal.model.Resource createResource(long resourceId); 064 065 /** 066 * Deletes the resource with the primary key from the database. Also notifies the appropriate model listeners. 067 * 068 * @param resourceId the primary key of the resource 069 * @return the resource that was removed 070 * @throws PortalException if a resource with the primary key could not be found 071 * @throws SystemException if a system exception occurred 072 */ 073 public com.liferay.portal.model.Resource deleteResource(long resourceId) 074 throws com.liferay.portal.kernel.exception.PortalException, 075 com.liferay.portal.kernel.exception.SystemException; 076 077 /** 078 * Deletes the resource from the database. Also notifies the appropriate model listeners. 079 * 080 * @param resource the resource 081 * @return the resource that was removed 082 * @throws SystemException if a system exception occurred 083 */ 084 public com.liferay.portal.model.Resource deleteResource( 085 com.liferay.portal.model.Resource resource) 086 throws com.liferay.portal.kernel.exception.SystemException; 087 088 public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery(); 089 090 /** 091 * Performs a dynamic query on the database and returns the matching rows. 092 * 093 * @param dynamicQuery the dynamic query 094 * @return the matching rows 095 * @throws SystemException if a system exception occurred 096 */ 097 @SuppressWarnings("rawtypes") 098 public java.util.List dynamicQuery( 099 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 100 throws com.liferay.portal.kernel.exception.SystemException; 101 102 /** 103 * Performs a dynamic query on the database and returns a range of the matching rows. 104 * 105 * <p> 106 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 107 * </p> 108 * 109 * @param dynamicQuery the dynamic query 110 * @param start the lower bound of the range of model instances 111 * @param end the upper bound of the range of model instances (not inclusive) 112 * @return the range of matching rows 113 * @throws SystemException if a system exception occurred 114 */ 115 @SuppressWarnings("rawtypes") 116 public java.util.List dynamicQuery( 117 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 118 int end) throws com.liferay.portal.kernel.exception.SystemException; 119 120 /** 121 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 122 * 123 * <p> 124 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 125 * </p> 126 * 127 * @param dynamicQuery the dynamic query 128 * @param start the lower bound of the range of model instances 129 * @param end the upper bound of the range of model instances (not inclusive) 130 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 131 * @return the ordered range of matching rows 132 * @throws SystemException if a system exception occurred 133 */ 134 @SuppressWarnings("rawtypes") 135 public java.util.List dynamicQuery( 136 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 137 int end, 138 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 139 throws com.liferay.portal.kernel.exception.SystemException; 140 141 /** 142 * Returns the number of rows that match the dynamic query. 143 * 144 * @param dynamicQuery the dynamic query 145 * @return the number of rows that match the dynamic query 146 * @throws SystemException if a system exception occurred 147 */ 148 public long dynamicQueryCount( 149 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 150 throws com.liferay.portal.kernel.exception.SystemException; 151 152 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 153 public com.liferay.portal.model.Resource fetchResource(long resourceId) 154 throws com.liferay.portal.kernel.exception.SystemException; 155 156 /** 157 * Returns the resource with the primary key. 158 * 159 * @param resourceId the primary key of the resource 160 * @return the resource 161 * @throws PortalException if a resource with the primary key could not be found 162 * @throws SystemException if a system exception occurred 163 */ 164 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 165 public com.liferay.portal.model.Resource getResource(long resourceId) 166 throws com.liferay.portal.kernel.exception.PortalException, 167 com.liferay.portal.kernel.exception.SystemException; 168 169 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 170 public com.liferay.portal.model.PersistedModel getPersistedModel( 171 java.io.Serializable primaryKeyObj) 172 throws com.liferay.portal.kernel.exception.PortalException, 173 com.liferay.portal.kernel.exception.SystemException; 174 175 /** 176 * Returns a range of all the resources. 177 * 178 * <p> 179 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 180 * </p> 181 * 182 * @param start the lower bound of the range of resources 183 * @param end the upper bound of the range of resources (not inclusive) 184 * @return the range of resources 185 * @throws SystemException if a system exception occurred 186 */ 187 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 188 public java.util.List<com.liferay.portal.model.Resource> getResources( 189 int start, int end) 190 throws com.liferay.portal.kernel.exception.SystemException; 191 192 /** 193 * Returns the number of resources. 194 * 195 * @return the number of resources 196 * @throws SystemException if a system exception occurred 197 */ 198 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 199 public int getResourcesCount() 200 throws com.liferay.portal.kernel.exception.SystemException; 201 202 /** 203 * Updates the resource in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 204 * 205 * @param resource the resource 206 * @return the resource that was updated 207 * @throws SystemException if a system exception occurred 208 */ 209 public com.liferay.portal.model.Resource updateResource( 210 com.liferay.portal.model.Resource resource) 211 throws com.liferay.portal.kernel.exception.SystemException; 212 213 /** 214 * Updates the resource in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 215 * 216 * @param resource the resource 217 * @param merge whether to merge the resource with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation. 218 * @return the resource that was updated 219 * @throws SystemException if a system exception occurred 220 */ 221 public com.liferay.portal.model.Resource updateResource( 222 com.liferay.portal.model.Resource resource, boolean merge) 223 throws com.liferay.portal.kernel.exception.SystemException; 224 225 /** 226 * Returns the Spring bean ID for this bean. 227 * 228 * @return the Spring bean ID for this bean 229 */ 230 public java.lang.String getBeanIdentifier(); 231 232 /** 233 * Sets the Spring bean ID for this bean. 234 * 235 * @param beanIdentifier the Spring bean ID for this bean 236 */ 237 public void setBeanIdentifier(java.lang.String beanIdentifier); 238 239 /** 240 * Adds resources for the model, always creating a resource at the 241 * individual scope and only creating resources at the group, group 242 * template, and company scope if such resources don't already exist. 243 * 244 * <ol> 245 * <li> 246 * If the service context specifies that default group or default guest 247 * permissions are to be added, then only default permissions are added. See 248 * {@link com.liferay.portal.service.ServiceContext#setAddGroupPermissions( 249 * boolean)} and {@link 250 * com.liferay.portal.service.ServiceContext#setAddGuestPermissions( 251 * boolean)}. 252 * </li> 253 * <li> 254 * Else ... 255 * <ol> 256 * <li> 257 * If the service context specifies to derive default permissions, then 258 * default group and guest permissions are derived from the model and 259 * added. See {@link 260 * com.liferay.portal.service.ServiceContext#setDeriveDefaultPermissions( 261 * boolean)}. 262 * </li> 263 * <li> 264 * Lastly group and guest permissions from the service 265 * context are applied. See {@link 266 * com.liferay.portal.service.ServiceContext#setGroupPermissions(String[])} 267 * and {@link 268 * com.liferay.portal.service.ServiceContext#setGuesPermissions(String[])}. 269 * </li> 270 * </ol> 271 * 272 * </li> 273 * </ol> 274 * 275 * @param auditedModel the model to associate with the resources 276 * @param serviceContext the service context to apply. Can set whether to 277 add the model's default group and guest permissions, set whether 278 to derive default group and guest permissions from the model, set 279 group permissions to apply, and set guest permissions to apply. 280 * @throws PortalException if no portal actions could be found associated 281 with the model or if a portal exception occurred 282 * @throws SystemException if a system exception occurred 283 */ 284 public void addModelResources( 285 com.liferay.portal.model.AuditedModel auditedModel, 286 com.liferay.portal.service.ServiceContext serviceContext) 287 throws com.liferay.portal.kernel.exception.PortalException, 288 com.liferay.portal.kernel.exception.SystemException; 289 290 /** 291 * Adds resources for the model with the name and primary key, always 292 * creating a resource at the individual scope and only creating resources 293 * at the group, group template, and company scope if such resources don't 294 * already exist. 295 * 296 * @param companyId the primary key of the portal instance 297 * @param groupId the primary key of the group 298 * @param userId the primary key of the user adding the resources 299 * @param name a name for the resource, typically the model's class name 300 * @param primKey the primary key of the model instance, optionally 301 <code>0</code> if no instance exists 302 * @param groupPermissions the group permissions to be applied 303 * @param guestPermissions the guest permissions to be applied 304 * @throws PortalException if no portal actions could be found associated 305 with the model or if a portal exception occurred 306 * @throws SystemException if a system exception occurred 307 */ 308 public void addModelResources(long companyId, long groupId, long userId, 309 java.lang.String name, long primKey, 310 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 311 throws com.liferay.portal.kernel.exception.PortalException, 312 com.liferay.portal.kernel.exception.SystemException; 313 314 /** 315 * Adds resources for the model with the name and primary key string, always 316 * creating a resource at the individual scope and only creating resources 317 * at the group, group template, and company scope if such resources don't 318 * already exist. 319 * 320 * @param companyId the primary key of the portal instance 321 * @param groupId the primary key of the group 322 * @param userId the primary key of the user adding the resources 323 * @param name a name for the resource, typically the model's class name 324 * @param primKey the primary key string of the model instance, optionally 325 an empty string if no instance exists 326 * @param groupPermissions the group permissions to be applied 327 * @param guestPermissions the guest permissions to be applied 328 * @throws PortalException if no portal actions could be found associated 329 with the model or if a portal exception occurred 330 * @throws SystemException if a system exception occurred 331 */ 332 public void addModelResources(long companyId, long groupId, long userId, 333 java.lang.String name, java.lang.String primKey, 334 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 335 throws com.liferay.portal.kernel.exception.PortalException, 336 com.liferay.portal.kernel.exception.SystemException; 337 338 public com.liferay.portal.model.Resource addResource(long companyId, 339 java.lang.String name, int scope, java.lang.String primKey) 340 throws com.liferay.portal.kernel.exception.SystemException; 341 342 /** 343 * Adds resources for the entity with the name and primary key, always 344 * creating a resource at the individual scope and only creating resources 345 * at the group, group template, and company scope if such resources don't 346 * already exist. 347 * 348 * @param companyId the primary key of the portal instance 349 * @param groupId the primary key of the group 350 * @param userId the primary key of the user adding the resources 351 * @param name a name for the resource, which should be a portlet ID if the 352 resource is a portlet or the resource's class name otherwise 353 * @param primKey the primary key of the resource instance, optionally 354 <code>0</code> if no instance exists 355 * @param portletActions whether to associate portlet actions with the 356 resource 357 * @param addGroupPermissions whether to add group permissions 358 * @param addGuestPermissions whether to add guest permissions 359 * @throws PortalException if no portal actions could be found associated 360 with the resource or if a portal exception occurred 361 * @throws SystemException if a system exception occurred 362 */ 363 public void addResources(long companyId, long groupId, long userId, 364 java.lang.String name, long primKey, boolean portletActions, 365 boolean addGroupPermissions, boolean addGuestPermissions) 366 throws com.liferay.portal.kernel.exception.PortalException, 367 com.liferay.portal.kernel.exception.SystemException; 368 369 /** 370 * Adds resources for the entity with the name and primary key string, 371 * always creating a resource at the individual scope and only creating 372 * resources at the group, group template, and company scope if such 373 * resources don't already exist. 374 * 375 * @param companyId the primary key of the portal instance 376 * @param groupId the primary key of the group 377 * @param userId the primary key of the user adding the resources 378 * @param name a name for the resource, which should be a portlet ID if the 379 resource is a portlet or the resource's class name otherwise 380 * @param primKey the primary key string of the resource instance, 381 optionally an empty string if no instance exists 382 * @param portletActions whether to associate portlet actions with the 383 resource 384 * @param addGroupPermissions whether to add group permissions 385 * @param addGuestPermissions whether to add guest permissions 386 * @throws PortalException if no portal actions could be found associated 387 with the resource or if a portal exception occurred 388 * @throws SystemException if a system exception occurred 389 */ 390 public void addResources(long companyId, long groupId, long userId, 391 java.lang.String name, java.lang.String primKey, 392 boolean portletActions, boolean addGroupPermissions, 393 boolean addGuestPermissions) 394 throws com.liferay.portal.kernel.exception.PortalException, 395 com.liferay.portal.kernel.exception.SystemException; 396 397 /** 398 * Adds resources for the entity with the name. Use this method if the user 399 * is unknown or irrelevant and there is no current entity instance. 400 * 401 * @param companyId the primary key of the portal instance 402 * @param groupId the primary key of the group 403 * @param name a name for the resource, which should be a portlet ID if the 404 resource is a portlet or the resource's class name otherwise 405 * @param portletActions whether to associate portlet actions with the 406 resource 407 * @throws PortalException if no portal actions could be found associated 408 with the resource or if a portal exception occurred 409 * @throws SystemException if a system exception occurred 410 */ 411 public void addResources(long companyId, long groupId, 412 java.lang.String name, boolean portletActions) 413 throws com.liferay.portal.kernel.exception.PortalException, 414 com.liferay.portal.kernel.exception.SystemException; 415 416 /** 417 * Deletes the resource associated with the model at the scope. 418 * 419 * @param auditedModel the model associated with the resource 420 * @param scope the scope of the resource. For more information see {@link 421 com.liferay.portal.model.ResourceConstants}. 422 * @throws PortalException if a portal exception occurred 423 * @throws SystemException if a system exception occurred 424 */ 425 public void deleteResource( 426 com.liferay.portal.model.AuditedModel auditedModel, int scope) 427 throws com.liferay.portal.kernel.exception.PortalException, 428 com.liferay.portal.kernel.exception.SystemException; 429 430 /** 431 * Deletes the resource matching the primary key at the scope. 432 * 433 * @param companyId the primary key of the portal instance 434 * @param name the resource's name, which should be a portlet ID if the 435 resource is a portlet or the resource's class name otherwise 436 * @param scope the scope of the resource. For more information see {@link 437 com.liferay.portal.model.ResourceConstants}. 438 * @param primKey the primary key of the resource instance 439 * @throws PortalException if a portal exception occurred 440 * @throws SystemException if a system exception occurred 441 */ 442 public void deleteResource(long companyId, java.lang.String name, 443 int scope, long primKey) 444 throws com.liferay.portal.kernel.exception.PortalException, 445 com.liferay.portal.kernel.exception.SystemException; 446 447 /** 448 * Deletes the resource matching the primary key at the scope. 449 * 450 * @param companyId the primary key of the portal instance 451 * @param name the resource's name, which should be a portlet ID if the 452 resource is a portlet or the resource's class name otherwise 453 * @param scope the scope of the resource. For more information see {@link 454 com.liferay.portal.model.ResourceConstants}. 455 * @param primKey the primary key string of the resource instance 456 * @throws PortalException if a portal exception occurred 457 * @throws SystemException if a system exception occurred 458 */ 459 public void deleteResource(long companyId, java.lang.String name, 460 int scope, java.lang.String primKey) 461 throws com.liferay.portal.kernel.exception.PortalException, 462 com.liferay.portal.kernel.exception.SystemException; 463 464 public void deleteResources(java.lang.String name) 465 throws com.liferay.portal.kernel.exception.SystemException; 466 467 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 468 public com.liferay.portal.model.Resource fetchResource(long companyId, 469 java.lang.String name, int scope, java.lang.String primKey) 470 throws com.liferay.portal.kernel.exception.SystemException; 471 472 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 473 public long getLatestResourceId() 474 throws com.liferay.portal.kernel.exception.SystemException; 475 476 /** 477 * Returns a new resource with the name and primary key at the scope. 478 * 479 * @param companyId the primary key of the portal instance 480 * @param name a name for the resource, which should be a portlet ID if the 481 resource is a portlet or the resource's class name otherwise 482 * @param scope the scope of the resource. For more information see {@link 483 com.liferay.portal.model.ResourceConstants}. 484 * @param primKey the primary key string of the resource 485 * @return the new resource 486 * @throws PortalException if a portal exception occurred 487 * @throws SystemException if a system exception occurred 488 */ 489 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 490 public com.liferay.portal.model.Resource getResource(long companyId, 491 java.lang.String name, int scope, java.lang.String primKey) 492 throws com.liferay.portal.kernel.exception.PortalException, 493 com.liferay.portal.kernel.exception.SystemException; 494 495 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 496 public java.util.List<com.liferay.portal.model.Resource> getResources() 497 throws com.liferay.portal.kernel.exception.SystemException; 498 499 /** 500 * Updates the resources for the model, replacing their group and guest 501 * permissions with new ones from the service context. 502 * 503 * @param auditedModel the model associated with the resources 504 * @param serviceContext the service context to be applied. Can set group 505 and guest permissions. 506 * @throws PortalException if a portal exception occurred 507 * @throws SystemException if a system exception occurred 508 */ 509 public void updateModelResources( 510 com.liferay.portal.model.AuditedModel auditedModel, 511 com.liferay.portal.service.ServiceContext serviceContext) 512 throws com.liferay.portal.kernel.exception.PortalException, 513 com.liferay.portal.kernel.exception.SystemException; 514 515 /** 516 * Updates resources matching the group, name, and primary key at the 517 * individual scope, setting new group and guest permissions. 518 * 519 * @param companyId the primary key of the portal instance 520 * @param groupId the primary key of the group 521 * @param name the resource's name, which should be a portlet ID if the 522 resource is a portlet or the resource's class name otherwise 523 * @param primKey the primary key of the resource instance 524 * @param groupPermissions the group permissions to be applied 525 * @param guestPermissions the guest permissions to be applied 526 * @throws PortalException if a portal exception occurred 527 * @throws SystemException if a system exception occurred 528 */ 529 public void updateResources(long companyId, long groupId, 530 java.lang.String name, long primKey, 531 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 532 throws com.liferay.portal.kernel.exception.PortalException, 533 com.liferay.portal.kernel.exception.SystemException; 534 535 /** 536 * Updates resources matching the group, name, and primary key string at the 537 * individual scope, setting new group and guest permissions. 538 * 539 * @param companyId the primary key of the portal instance 540 * @param groupId the primary key of the group 541 * @param name the resource's name, which should be a portlet ID if the 542 resource is a portlet or the resource's class name otherwise 543 * @param primKey the primary key string of the resource instance 544 * @param groupPermissions the group permissions to be applied 545 * @param guestPermissions the guest permissions to be applied 546 * @throws PortalException if a portal exception occurred 547 * @throws SystemException if a system exception occurred 548 */ 549 public void updateResources(long companyId, long groupId, 550 java.lang.String name, java.lang.String primKey, 551 java.lang.String[] groupPermissions, java.lang.String[] guestPermissions) 552 throws com.liferay.portal.kernel.exception.PortalException, 553 com.liferay.portal.kernel.exception.SystemException; 554 555 /** 556 * Updates resources matching the name, primary key string and scope, 557 * replacing the primary key of their resource permissions with the new 558 * primary key. 559 * 560 * @param companyId the primary key of the portal instance 561 * @param name the resource's name, which should be a portlet ID if the 562 resource is a portlet or the resource's class name otherwise 563 * @param scope the scope of the resource. For more information see {@link 564 com.liferay.portal.model.ResourceConstants}. 565 * @param primKey the primary key string of the resource instance 566 * @param newPrimKey the new primary key string of the resource 567 * @throws PortalException if a portal exception occurred 568 * @throws SystemException if a system exception occurred 569 */ 570 public void updateResources(long companyId, java.lang.String name, 571 int scope, java.lang.String primKey, java.lang.String newPrimKey) 572 throws com.liferay.portal.kernel.exception.PortalException, 573 com.liferay.portal.kernel.exception.SystemException; 574 }