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.jsonwebservice.JSONWebService; 020 import com.liferay.portal.kernel.transaction.Isolation; 021 import com.liferay.portal.kernel.transaction.Propagation; 022 import com.liferay.portal.kernel.transaction.Transactional; 023 import com.liferay.portal.security.ac.AccessControlled; 024 025 /** 026 * The interface for the group remote service. 027 * 028 * <p> 029 * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely. 030 * </p> 031 * 032 * @author Brian Wing Shun Chan 033 * @see GroupServiceUtil 034 * @see com.liferay.portal.service.base.GroupServiceBaseImpl 035 * @see com.liferay.portal.service.impl.GroupServiceImpl 036 * @generated 037 */ 038 @AccessControlled 039 @JSONWebService 040 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 041 PortalException.class, SystemException.class}) 042 public interface GroupService extends BaseService { 043 /* 044 * NOTE FOR DEVELOPERS: 045 * 046 * Never modify or reference this interface directly. Always use {@link GroupServiceUtil} to access the group remote service. Add custom service methods to {@link com.liferay.portal.service.impl.GroupServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 047 */ 048 049 /** 050 * Returns the Spring bean ID for this bean. 051 * 052 * @return the Spring bean ID for this bean 053 */ 054 public java.lang.String getBeanIdentifier(); 055 056 /** 057 * Sets the Spring bean ID for this bean. 058 * 059 * @param beanIdentifier the Spring bean ID for this bean 060 */ 061 public void setBeanIdentifier(java.lang.String beanIdentifier); 062 063 /** 064 * Adds a group. 065 * 066 * @param parentGroupId the primary key of the parent group 067 * @param liveGroupId the primary key of the live group 068 * @param name the entity's name 069 * @param description the group's description (optionally 070 <code>null</code>) 071 * @param type the group's type. For more information see {@link 072 com.liferay.portal.model.GroupConstants} 073 * @param friendlyURL the group's friendlyURL (optionally 074 <code>null</code>) 075 * @param site whether the group is to be associated with a main site 076 * @param active whether the group is active 077 * @param serviceContext the service context to be applied (optionally 078 <code>null</code>). Can set the asset category IDs and asset tag 079 names for the group, and can set whether the group is for staging 080 * @return the group 081 * @throws PortalException if the user did not have permission to add the 082 group, if a creator could not be found, if the group's 083 information was invalid, if a layout could not be found, or if a 084 valid friendly URL could not be created for the group 085 * @throws SystemException if a system exception occurred 086 */ 087 public com.liferay.portal.model.Group addGroup(long parentGroupId, 088 long liveGroupId, java.lang.String name, java.lang.String description, 089 int type, java.lang.String friendlyURL, boolean site, boolean active, 090 com.liferay.portal.service.ServiceContext serviceContext) 091 throws com.liferay.portal.kernel.exception.PortalException, 092 com.liferay.portal.kernel.exception.SystemException; 093 094 /** 095 * Adds the group using the group default live group ID. 096 * 097 * @param parentGroupId the primary key of the parent group 098 * @param name the entity's name 099 * @param description the group's description (optionally 100 <code>null</code>) 101 * @param type the group's type. For more information see {@link 102 com.liferay.portal.model.GroupConstants} 103 * @param friendlyURL the group's friendlyURL 104 * @param site whether the group is to be associated with a main site 105 * @param active whether the group is active 106 * @param serviceContext the service context to be applied (optionally 107 <code>null</code>). Can set asset category IDs and asset tag 108 names for the group, and can set whether the group is for 109 staging 110 * @return the group 111 * @throws PortalException if the user did not have permission to add 112 the group, if a creator could not be found, if the group's 113 information was invalid, if a layout could not be found, or 114 if a valid friendly URL could not be created for the group 115 * @throws SystemException if a system exception occurred 116 * @deprecated As of 6.2.0, replaced by {@link #addGroup(long, long, String, 117 String, int, String, boolean, boolean, ServiceContext)} 118 */ 119 public com.liferay.portal.model.Group addGroup(long parentGroupId, 120 java.lang.String name, java.lang.String description, int type, 121 java.lang.String friendlyURL, boolean site, boolean active, 122 com.liferay.portal.service.ServiceContext serviceContext) 123 throws com.liferay.portal.kernel.exception.PortalException, 124 com.liferay.portal.kernel.exception.SystemException; 125 126 /** 127 * @deprecated As of 6.2.0, replaced by {@link #addGroup(long, String, 128 String, int, String, boolean, boolean, ServiceContext)} 129 */ 130 public com.liferay.portal.model.Group addGroup(java.lang.String name, 131 java.lang.String description, int type, java.lang.String friendlyURL, 132 boolean site, boolean active, 133 com.liferay.portal.service.ServiceContext serviceContext) 134 throws com.liferay.portal.kernel.exception.PortalException, 135 com.liferay.portal.kernel.exception.SystemException; 136 137 /** 138 * Adds the groups to the role. 139 * 140 * @param roleId the primary key of the role 141 * @param groupIds the primary keys of the groups 142 * @throws PortalException if the user did not have permission to update the 143 role 144 * @throws SystemException if a system exception occurred 145 */ 146 public void addRoleGroups(long roleId, long[] groupIds) 147 throws com.liferay.portal.kernel.exception.PortalException, 148 com.liferay.portal.kernel.exception.SystemException; 149 150 /** 151 * Checks that the current user is permitted to use the group for Remote 152 * Staging. 153 * 154 * @param groupId the primary key of the group 155 * @throws PortalException if a group with the primary key could not be 156 found, if the current user did not have permission to view the 157 group, or if the group's company was different from the current 158 user's company 159 * @throws SystemException if a system exception occurred 160 */ 161 public void checkRemoteStagingGroup(long groupId) 162 throws com.liferay.portal.kernel.exception.PortalException, 163 com.liferay.portal.kernel.exception.SystemException; 164 165 /** 166 * Deletes the group. 167 * 168 * <p> 169 * The group is unstaged and its assets and resources including layouts, 170 * membership requests, subscriptions, teams, blogs, bookmarks, calendar 171 * events, image gallery, journals, message boards, polls, shopping related 172 * entities, software catalog, and wikis are also deleted. 173 * </p> 174 * 175 * @param groupId the primary key of the group 176 * @throws PortalException if the user did not have permission to delete the 177 group or its assets or resources, if a group with the primary key 178 could not be found, or if the group was a system group 179 * @throws SystemException if a system exception occurred 180 */ 181 public void deleteGroup(long groupId) 182 throws com.liferay.portal.kernel.exception.PortalException, 183 com.liferay.portal.kernel.exception.SystemException; 184 185 /** 186 * Returns the group with the primary key. 187 * 188 * @param groupId the primary key of the group 189 * @return the group with the primary key 190 * @throws PortalException if a group with the primary key could not be 191 found or if the current user did not have permission to view the 192 group 193 * @throws SystemException if a system exception occurred 194 */ 195 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 196 public com.liferay.portal.model.Group getGroup(long groupId) 197 throws com.liferay.portal.kernel.exception.PortalException, 198 com.liferay.portal.kernel.exception.SystemException; 199 200 /** 201 * Returns the group with the name. 202 * 203 * @param companyId the primary key of the company 204 * @param name the group's name 205 * @return the group with the name 206 * @throws PortalException if a matching group could not be found or if the 207 current user did not have permission to view the group 208 * @throws SystemException if a system exception occurred 209 */ 210 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 211 public com.liferay.portal.model.Group getGroup(long companyId, 212 java.lang.String name) 213 throws com.liferay.portal.kernel.exception.PortalException, 214 com.liferay.portal.kernel.exception.SystemException; 215 216 /** 217 * Returns a range of all the site groups for which the user has control 218 * panel access. 219 * 220 * @param portlets the portlets to manage 221 * @param max the upper bound of the range of groups to consider (not 222 inclusive) 223 * @return the range of site groups for which the user has Control Panel 224 access 225 * @throws PortalException if a portal exception occurred 226 * @throws SystemException if a system exception occurred 227 */ 228 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 229 public java.util.List<com.liferay.portal.model.Group> getManageableSites( 230 java.util.Collection<com.liferay.portal.model.Portlet> portlets, int max) 231 throws com.liferay.portal.kernel.exception.PortalException, 232 com.liferay.portal.kernel.exception.SystemException; 233 234 /** 235 * Returns the groups associated with the organizations. 236 * 237 * @param organizations the organizations 238 * @return the groups associated with the organizations 239 * @throws PortalException if a portal exception occurred 240 * @throws SystemException if a system exception occurred 241 */ 242 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 243 public java.util.List<com.liferay.portal.model.Group> getOrganizationsGroups( 244 java.util.List<com.liferay.portal.model.Organization> organizations) 245 throws com.liferay.portal.kernel.exception.PortalException, 246 com.liferay.portal.kernel.exception.SystemException; 247 248 /** 249 * Returns the group associated with the user. 250 * 251 * @param companyId the primary key of the company 252 * @param userId the primary key of the user 253 * @return the group associated with the user 254 * @throws PortalException if a matching group could not be found or if the 255 current user did not have permission to view the group 256 * @throws SystemException if a system exception occurred 257 */ 258 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 259 public com.liferay.portal.model.Group getUserGroup(long companyId, 260 long userId) 261 throws com.liferay.portal.kernel.exception.PortalException, 262 com.liferay.portal.kernel.exception.SystemException; 263 264 /** 265 * Returns the groups associated with the user groups. 266 * 267 * @param userGroups the user groups 268 * @return the groups associated with the user groups 269 * @throws PortalException if any one of the user group's group could not be 270 found 271 * @throws SystemException if a system exception occurred 272 */ 273 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 274 public java.util.List<com.liferay.portal.model.Group> getUserGroupsGroups( 275 java.util.List<com.liferay.portal.model.UserGroup> userGroups) 276 throws com.liferay.portal.kernel.exception.PortalException, 277 com.liferay.portal.kernel.exception.SystemException; 278 279 /** 280 * Returns the range of all groups associated with the user's organization 281 * groups, including the ancestors of the organization groups, unless portal 282 * property <code>organizations.membership.strict</code> is set to 283 * <code>true</code>. 284 * 285 * <p> 286 * Useful when paginating results. Returns a maximum of <code>end - 287 * start</code> instances. <code>start</code> and <code>end</code> are not 288 * primary keys, they are indexes in the result set. Thus, <code>0</code> 289 * refers to the first result in the set. Setting both <code>start</code> 290 * and <code>end</code> to {@link 291 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 292 * result set. 293 * </p> 294 * 295 * @param userId the primary key of the user 296 * @param start the lower bound of the range of groups to consider 297 * @param end the upper bound of the range of groups to consider (not 298 inclusive) 299 * @return the range of groups associated with the user's organizations 300 * @throws PortalException if a user with the primary key could not be found 301 or if another portal exception occurred 302 * @throws SystemException if a system exception occurred 303 */ 304 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 305 public java.util.List<com.liferay.portal.model.Group> getUserOrganizationsGroups( 306 long userId, int start, int end) 307 throws com.liferay.portal.kernel.exception.PortalException, 308 com.liferay.portal.kernel.exception.SystemException; 309 310 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 311 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 312 long userId, java.lang.String[] classNames, 313 boolean includeControlPanel, int max) 314 throws com.liferay.portal.kernel.exception.PortalException, 315 com.liferay.portal.kernel.exception.SystemException; 316 317 /** 318 * Returns the user's group "places" associated with the group 319 * entity class names, including the Control Panel group if the user is 320 * permitted to view the Control Panel. 321 * 322 * <ul> 323 * <li> 324 * Class name "User" includes the user's layout set 325 * group. 326 * </li> 327 * <li> 328 * Class name "Organization" includes the user's 329 * immediate organization groups and inherited organization groups. 330 * </li> 331 * <li> 332 * Class name "Group" includes the user's immediate 333 * organization groups and site groups. 334 * </li> 335 * <li> 336 * A <code>classNames</code> 337 * value of <code>null</code> includes the user's layout set group, 338 * organization groups, inherited organization groups, and site groups. 339 * </li> 340 * </ul> 341 * 342 * @param userId the primary key of the user 343 * @param classNames the group entity class names (optionally 344 <code>null</code>). For more information see {@link 345 #getUserPlaces(long, String[], int)} 346 * @param max the maximum number of groups to return 347 * @return the user's group "places" 348 * @throws PortalException if a portal exception occurred 349 * @throws SystemException if a system exception occurred 350 */ 351 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 352 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 353 long userId, java.lang.String[] classNames, int max) 354 throws com.liferay.portal.kernel.exception.PortalException, 355 com.liferay.portal.kernel.exception.SystemException; 356 357 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 358 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 359 long userId, java.lang.String[] classNames, java.lang.String name, 360 boolean active, boolean includeControlPanel, int start, int end) 361 throws com.liferay.portal.kernel.exception.PortalException, 362 com.liferay.portal.kernel.exception.SystemException; 363 364 /** 365 * Returns the guest or current user's group "places" associated 366 * with the group entity class names, including the Control Panel group if 367 * the user is permitted to view the Control Panel. 368 * 369 * <ul> 370 * <li> 371 * Class name "User" includes the user's layout set 372 * group. 373 * </li> 374 * <li> 375 * Class name "Organization" includes the user's 376 * immediate organization groups and inherited organization groups. 377 * </li> 378 * <li> 379 * Class name "Group" includes the user's immediate 380 * organization groups and site groups. 381 * </li> 382 * <li> 383 * A <code>classNames</code> 384 * value of <code>null</code> includes the user's layout set group, 385 * organization groups, inherited organization groups, and site groups. 386 * </li> 387 * </ul> 388 * 389 * @param classNames the group entity class names (optionally 390 <code>null</code>). For more information see {@link 391 #getUserPlaces(String[], int)} 392 * @param max the maximum number of groups to return 393 * @return the user's group "places" 394 * @throws PortalException if a portal exception occurred 395 * @throws SystemException if a system exception occurred 396 */ 397 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 398 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 399 java.lang.String[] classNames, int max) 400 throws com.liferay.portal.kernel.exception.PortalException, 401 com.liferay.portal.kernel.exception.SystemException; 402 403 /** 404 * Returns the number of the guest or current user's group 405 * "places" associated with the group entity class names, 406 * including the Control Panel group if the user is permitted to view the 407 * Control Panel. 408 * 409 * @return the number of user's group "places" 410 * @throws PortalException if a portal exception occurred 411 * @throws SystemException if a system exception occurred 412 */ 413 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 414 public int getUserPlacesCount() 415 throws com.liferay.portal.kernel.exception.PortalException, 416 com.liferay.portal.kernel.exception.SystemException; 417 418 /** 419 * Returns the guest or current user's layout set group, organization 420 * groups, inherited organization groups, and site groups. 421 * 422 * @return the user's layout set group, organization groups, and inherited 423 organization groups, and site groups 424 * @throws PortalException if a portal exception occurred 425 * @throws SystemException if a system exception occurred 426 */ 427 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 428 public java.util.List<com.liferay.portal.model.Group> getUserSites() 429 throws com.liferay.portal.kernel.exception.PortalException, 430 com.liferay.portal.kernel.exception.SystemException; 431 432 /** 433 * Returns <code>true</code> if the user is associated with the group, 434 * including the user's inherited organizations and user groups. System and 435 * staged groups are not included. 436 * 437 * @param userId the primary key of the user 438 * @param groupId the primary key of the group 439 * @return <code>true</code> if the user is associated with the group; 440 <code>false</code> otherwise 441 * @throws PortalException if the current user did not have permission to 442 view the user or group members 443 * @throws SystemException if a system exception occurred 444 */ 445 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 446 public boolean hasUserGroup(long userId, long groupId) 447 throws com.liferay.portal.kernel.exception.PortalException, 448 com.liferay.portal.kernel.exception.SystemException; 449 450 /** 451 * Returns an ordered range of all the site groups and organization groups 452 * that match the name and description, optionally including the user's 453 * inherited organization groups and user groups. System and staged groups 454 * are not included. 455 * 456 * <p> 457 * Useful when paginating results. Returns a maximum of <code>end - 458 * start</code> instances. <code>start</code> and <code>end</code> are not 459 * primary keys, they are indexes in the result set. Thus, <code>0</code> 460 * refers to the first result in the set. Setting both <code>start</code> 461 * and <code>end</code> to {@link 462 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 463 * result set. 464 * </p> 465 * 466 * @param companyId the primary key of the company 467 * @param name the group's name (optionally <code>null</code>) 468 * @param description the group's description (optionally 469 <code>null</code>) 470 * @param params the finder params (optionally <code>null</code>). To 471 include the user's inherited organizations and user groups in the 472 search, add entries having "usersGroups" and 473 "inherit" as keys mapped to the the user's ID. For more 474 information see {@link 475 com.liferay.portal.service.persistence.GroupFinder} 476 * @param start the lower bound of the range of groups to return 477 * @param end the upper bound of the range of groups to return (not 478 inclusive) 479 * @return the matching groups ordered by name 480 * @throws PortalException if a portal exception occurred 481 * @throws SystemException if a system exception occurred 482 */ 483 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 484 public java.util.List<com.liferay.portal.model.Group> search( 485 long companyId, java.lang.String name, java.lang.String description, 486 java.lang.String[] params, int start, int end) 487 throws com.liferay.portal.kernel.exception.PortalException, 488 com.liferay.portal.kernel.exception.SystemException; 489 490 /** 491 * Returns the number of groups and organization groups that match the name 492 * and description, optionally including the user's inherited organizations 493 * and user groups. System and staged groups are not included. 494 * 495 * @param companyId the primary key of the company 496 * @param name the group's name (optionally <code>null</code>) 497 * @param description the group's description (optionally 498 <code>null</code>) 499 * @param params the finder params (optionally <code>null</code>). To 500 include the user's inherited organizations and user groups in the 501 search, add entries having "usersGroups" and 502 "inherit" as keys mapped to the the user's ID. For more 503 information see {@link 504 com.liferay.portal.service.persistence.GroupFinder} 505 * @return the number of matching groups 506 * @throws SystemException if a system exception occurred 507 */ 508 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 509 public int searchCount(long companyId, java.lang.String name, 510 java.lang.String description, java.lang.String[] params) 511 throws com.liferay.portal.kernel.exception.SystemException; 512 513 /** 514 * Sets the groups associated with the role, removing and adding 515 * associations as necessary. 516 * 517 * @param roleId the primary key of the role 518 * @param groupIds the primary keys of the groups 519 * @throws PortalException if the user did not have permission to update 520 update the role 521 * @throws SystemException if a system exception occurred 522 */ 523 public void setRoleGroups(long roleId, long[] groupIds) 524 throws com.liferay.portal.kernel.exception.PortalException, 525 com.liferay.portal.kernel.exception.SystemException; 526 527 /** 528 * Removes the groups from the role. 529 * 530 * @param roleId the primary key of the role 531 * @param groupIds the primary keys of the groups 532 * @throws PortalException if the user did not have permission to update the 533 role 534 * @throws SystemException if a system exception occurred 535 */ 536 public void unsetRoleGroups(long roleId, long[] groupIds) 537 throws com.liferay.portal.kernel.exception.PortalException, 538 com.liferay.portal.kernel.exception.SystemException; 539 540 /** 541 * Updates the group's friendly URL. 542 * 543 * @param groupId the primary key of the group 544 * @param friendlyURL the group's new friendlyURL (optionally 545 <code>null</code>) 546 * @return the group 547 * @throws PortalException if the user did not have permission to update the 548 group, if a group with the primary key could not be found, or if 549 a valid friendly URL could not be created for the group 550 * @throws SystemException if a system exception occurred 551 */ 552 public com.liferay.portal.model.Group updateFriendlyURL(long groupId, 553 java.lang.String friendlyURL) 554 throws com.liferay.portal.kernel.exception.PortalException, 555 com.liferay.portal.kernel.exception.SystemException; 556 557 /** 558 * Updates the group. 559 * 560 * @param groupId the primary key of the group 561 * @param parentGroupId the primary key of the parent group 562 * @param name the group's new name 563 * @param description the group's new description (optionally 564 <code>null</code>) 565 * @param type the group's new type. For more information see {@link 566 com.liferay.portal.model.GroupConstants} 567 * @param friendlyURL the group's new friendlyURL (optionally 568 <code>null</code>) 569 * @param active whether the group is active 570 * @param serviceContext the service context to be applied (optionally 571 <code>null</code>). Can set the asset category IDs and asset tag 572 names for the group. 573 * @return the group 574 * @throws PortalException if the user did not have permission to update the 575 group, if a group with the primary key could not be found, if the 576 friendly URL was invalid or could one not be created 577 * @throws SystemException if a system exception occurred 578 */ 579 public com.liferay.portal.model.Group updateGroup(long groupId, 580 long parentGroupId, java.lang.String name, 581 java.lang.String description, int type, java.lang.String friendlyURL, 582 boolean active, com.liferay.portal.service.ServiceContext serviceContext) 583 throws com.liferay.portal.kernel.exception.PortalException, 584 com.liferay.portal.kernel.exception.SystemException; 585 586 /** 587 * Updates the group's type settings. 588 * 589 * @param groupId the primary key of the group 590 * @param typeSettings the group's new type settings (optionally 591 <code>null</code>) 592 * @return the group 593 * @throws PortalException if the user did not have permission to update the 594 group or if a group with the primary key could not be found 595 * @throws SystemException if a system exception occurred 596 */ 597 public com.liferay.portal.model.Group updateGroup(long groupId, 598 java.lang.String typeSettings) 599 throws com.liferay.portal.kernel.exception.PortalException, 600 com.liferay.portal.kernel.exception.SystemException; 601 }