001 /** 002 * Copyright (c) 2000-2012 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 {@link #addGroup(long, long, String, String, int, String, 117 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 {@link #addGroup(long, String, String, int, String, boolean, 128 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 * Deletes the group. 152 * 153 * <p> 154 * The group is unstaged and its assets and resources including layouts, 155 * membership requests, subscriptions, teams, blogs, bookmarks, calendar 156 * events, image gallery, journals, message boards, polls, shopping related 157 * entities, software catalog, and wikis are also deleted. 158 * </p> 159 * 160 * @param groupId the primary key of the group 161 * @throws PortalException if the user did not have permission to delete the 162 group or its assets or resources, if a group with the primary key 163 could not be found, or if the group was a system group 164 * @throws SystemException if a system exception occurred 165 */ 166 public void deleteGroup(long groupId) 167 throws com.liferay.portal.kernel.exception.PortalException, 168 com.liferay.portal.kernel.exception.SystemException; 169 170 /** 171 * Returns the group with the primary key. 172 * 173 * @param groupId the primary key of the group 174 * @return the group with the primary key 175 * @throws PortalException if a group with the primary key could not be 176 found or if the current user did not have permission to view the 177 group 178 * @throws SystemException if a system exception occurred 179 */ 180 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 181 public com.liferay.portal.model.Group getGroup(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 name. 187 * 188 * @param companyId the primary key of the company 189 * @param name the group's name 190 * @return the group with the name 191 * @throws PortalException if a matching group could not be found or if the 192 current user did not have permission to view the 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 companyId, 197 java.lang.String name) 198 throws com.liferay.portal.kernel.exception.PortalException, 199 com.liferay.portal.kernel.exception.SystemException; 200 201 /** 202 * Returns a range of all the site groups for which the user has control 203 * panel access. 204 * 205 * @param portlets the portlets to manage 206 * @param max the upper bound of the range of groups to consider (not 207 inclusive) 208 * @return the range of site groups for which the user has Control Panel 209 access 210 * @throws PortalException if a portal exception occurred 211 * @throws SystemException if a system exception occurred 212 */ 213 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 214 public java.util.List<com.liferay.portal.model.Group> getManageableSites( 215 java.util.Collection<com.liferay.portal.model.Portlet> portlets, int max) 216 throws com.liferay.portal.kernel.exception.PortalException, 217 com.liferay.portal.kernel.exception.SystemException; 218 219 /** 220 * Returns the groups associated with the organizations. 221 * 222 * @param organizations the organizations 223 * @return the groups associated with the organizations 224 * @throws PortalException if a portal exception occurred 225 * @throws SystemException if a system exception occurred 226 */ 227 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 228 public java.util.List<com.liferay.portal.model.Group> getOrganizationsGroups( 229 java.util.List<com.liferay.portal.model.Organization> organizations) 230 throws com.liferay.portal.kernel.exception.PortalException, 231 com.liferay.portal.kernel.exception.SystemException; 232 233 /** 234 * Returns the group associated with the user. 235 * 236 * @param companyId the primary key of the company 237 * @param userId the primary key of the user 238 * @return the group associated with the user 239 * @throws PortalException if a matching group could not be found or if the 240 current user did not have permission to view the group 241 * @throws SystemException if a system exception occurred 242 */ 243 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 244 public com.liferay.portal.model.Group getUserGroup(long companyId, 245 long userId) 246 throws com.liferay.portal.kernel.exception.PortalException, 247 com.liferay.portal.kernel.exception.SystemException; 248 249 /** 250 * Returns the groups associated with the user groups. 251 * 252 * @param userGroups the user groups 253 * @return the groups associated with the user groups 254 * @throws PortalException if any one of the user group's group could not be 255 found 256 * @throws SystemException if a system exception occurred 257 */ 258 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 259 public java.util.List<com.liferay.portal.model.Group> getUserGroupsGroups( 260 java.util.List<com.liferay.portal.model.UserGroup> userGroups) 261 throws com.liferay.portal.kernel.exception.PortalException, 262 com.liferay.portal.kernel.exception.SystemException; 263 264 /** 265 * Returns the range of all groups associated with the user's organization 266 * groups, including the ancestors of the organization groups, unless portal 267 * property <code>organizations.membership.strict</code> is set to 268 * <code>true</code>. 269 * 270 * <p> 271 * Useful when paginating results. Returns a maximum of <code>end - 272 * start</code> instances. <code>start</code> and <code>end</code> are not 273 * primary keys, they are indexes in the result set. Thus, <code>0</code> 274 * refers to the first result in the set. Setting both <code>start</code> 275 * and <code>end</code> to {@link 276 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 277 * result set. 278 * </p> 279 * 280 * @param userId the primary key of the user 281 * @param start the lower bound of the range of groups to consider 282 * @param end the upper bound of the range of groups to consider (not 283 inclusive) 284 * @return the range of groups associated with the user's organizations 285 * @throws PortalException if a user with the primary key could not be found 286 or if another portal exception occurred 287 * @throws SystemException if a system exception occurred 288 */ 289 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 290 public java.util.List<com.liferay.portal.model.Group> getUserOrganizationsGroups( 291 long userId, int start, int end) 292 throws com.liferay.portal.kernel.exception.PortalException, 293 com.liferay.portal.kernel.exception.SystemException; 294 295 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 296 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 297 long userId, java.lang.String[] classNames, 298 boolean includeControlPanel, int max) 299 throws com.liferay.portal.kernel.exception.PortalException, 300 com.liferay.portal.kernel.exception.SystemException; 301 302 /** 303 * Returns the user's group "places" associated with the group 304 * entity class names, including the Control Panel group if the user is 305 * permitted to view the Control Panel. 306 * 307 * <ul> 308 * <li> 309 * Class name "User" includes the user's layout set 310 * group. 311 * </li> 312 * <li> 313 * Class name "Organization" includes the user's 314 * immediate organization groups and inherited organization groups. 315 * </li> 316 * <li> 317 * Class name "Group" includes the user's immediate 318 * organization groups and site groups. 319 * </li> 320 * <li> 321 * A <code>classNames</code> 322 * value of <code>null</code> includes the user's layout set group, 323 * organization groups, inherited organization groups, and site groups. 324 * </li> 325 * </ul> 326 * 327 * @param userId the primary key of the user 328 * @param classNames the group entity class names (optionally 329 <code>null</code>). For more information see {@link 330 #getUserPlaces(long, String[], int)} 331 * @param max the maximum number of groups to return 332 * @return the user's group "places" 333 * @throws PortalException if a portal exception occurred 334 * @throws SystemException if a system exception occurred 335 */ 336 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 337 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 338 long userId, java.lang.String[] classNames, int max) 339 throws com.liferay.portal.kernel.exception.PortalException, 340 com.liferay.portal.kernel.exception.SystemException; 341 342 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 343 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 344 long userId, java.lang.String[] classNames, java.lang.String name, 345 boolean active, boolean includeControlPanel, int start, int end) 346 throws com.liferay.portal.kernel.exception.PortalException, 347 com.liferay.portal.kernel.exception.SystemException; 348 349 /** 350 * Returns the guest or current user's group "places" associated 351 * with the group entity class names, including the Control Panel group if 352 * the user is permitted to view the Control Panel. 353 * 354 * <ul> 355 * <li> 356 * Class name "User" includes the user's layout set 357 * group. 358 * </li> 359 * <li> 360 * Class name "Organization" includes the user's 361 * immediate organization groups and inherited organization groups. 362 * </li> 363 * <li> 364 * Class name "Group" includes the user's immediate 365 * organization groups and site groups. 366 * </li> 367 * <li> 368 * A <code>classNames</code> 369 * value of <code>null</code> includes the user's layout set group, 370 * organization groups, inherited organization groups, and site groups. 371 * </li> 372 * </ul> 373 * 374 * @param classNames the group entity class names (optionally 375 <code>null</code>). For more information see {@link 376 #getUserPlaces(String[], int)} 377 * @param max the maximum number of groups to return 378 * @return the user's group "places" 379 * @throws PortalException if a portal exception occurred 380 * @throws SystemException if a system exception occurred 381 */ 382 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 383 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 384 java.lang.String[] classNames, int max) 385 throws com.liferay.portal.kernel.exception.PortalException, 386 com.liferay.portal.kernel.exception.SystemException; 387 388 /** 389 * Returns the number of the guest or current user's group 390 * "places" associated with the group entity class names, 391 * including the Control Panel group if the user is permitted to view the 392 * Control Panel. 393 * 394 * @return the number of user's group "places" 395 * @throws PortalException if a portal exception occurred 396 * @throws SystemException if a system exception occurred 397 */ 398 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 399 public int getUserPlacesCount() 400 throws com.liferay.portal.kernel.exception.PortalException, 401 com.liferay.portal.kernel.exception.SystemException; 402 403 /** 404 * Returns the guest or current user's layout set group, organization 405 * groups, inherited organization groups, and site groups. 406 * 407 * @return the user's layout set group, organization groups, and inherited 408 organization groups, and site groups 409 * @throws PortalException if a portal exception occurred 410 * @throws SystemException if a system exception occurred 411 */ 412 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 413 public java.util.List<com.liferay.portal.model.Group> getUserSites() 414 throws com.liferay.portal.kernel.exception.PortalException, 415 com.liferay.portal.kernel.exception.SystemException; 416 417 /** 418 * Returns <code>true</code> if the user is associated with the group, 419 * including the user's inherited organizations and user groups. System and 420 * staged groups are not included. 421 * 422 * @param userId the primary key of the user 423 * @param groupId the primary key of the group 424 * @return <code>true</code> if the user is associated with the group; 425 <code>false</code> otherwise 426 * @throws PortalException if the current user did not have permission to 427 view the user or group members 428 * @throws SystemException if a system exception occurred 429 */ 430 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 431 public boolean hasUserGroup(long userId, long groupId) 432 throws com.liferay.portal.kernel.exception.PortalException, 433 com.liferay.portal.kernel.exception.SystemException; 434 435 /** 436 * Returns an ordered range of all the site groups and organization groups 437 * that match the name and description, optionally including the user's 438 * inherited organization groups and user groups. System and staged groups 439 * are not included. 440 * 441 * <p> 442 * Useful when paginating results. Returns a maximum of <code>end - 443 * start</code> instances. <code>start</code> and <code>end</code> are not 444 * primary keys, they are indexes in the result set. Thus, <code>0</code> 445 * refers to the first result in the set. Setting both <code>start</code> 446 * and <code>end</code> to {@link 447 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 448 * result set. 449 * </p> 450 * 451 * @param companyId the primary key of the company 452 * @param name the group's name (optionally <code>null</code>) 453 * @param description the group's description (optionally 454 <code>null</code>) 455 * @param params the finder params (optionally <code>null</code>). To 456 include the user's inherited organizations and user groups in the 457 search, add entries having "usersGroups" and 458 "inherit" as keys mapped to the the user's ID. For more 459 information see {@link 460 com.liferay.portal.service.persistence.GroupFinder} 461 * @param start the lower bound of the range of groups to return 462 * @param end the upper bound of the range of groups to return (not 463 inclusive) 464 * @return the matching groups ordered by name 465 * @throws PortalException if a portal exception occurred 466 * @throws SystemException if a system exception occurred 467 */ 468 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 469 public java.util.List<com.liferay.portal.model.Group> search( 470 long companyId, java.lang.String name, java.lang.String description, 471 java.lang.String[] params, int start, int end) 472 throws com.liferay.portal.kernel.exception.PortalException, 473 com.liferay.portal.kernel.exception.SystemException; 474 475 /** 476 * Returns the number of groups and organization groups that match the name 477 * and description, optionally including the user's inherited organizations 478 * and user groups. System and staged groups are not included. 479 * 480 * @param companyId the primary key of the company 481 * @param name the group's name (optionally <code>null</code>) 482 * @param description the group's description (optionally 483 <code>null</code>) 484 * @param params the finder params (optionally <code>null</code>). To 485 include the user's inherited organizations and user groups in the 486 search, add entries having "usersGroups" and 487 "inherit" as keys mapped to the the user's ID. For more 488 information see {@link 489 com.liferay.portal.service.persistence.GroupFinder} 490 * @return the number of matching groups 491 * @throws SystemException if a system exception occurred 492 */ 493 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 494 public int searchCount(long companyId, java.lang.String name, 495 java.lang.String description, java.lang.String[] params) 496 throws com.liferay.portal.kernel.exception.SystemException; 497 498 /** 499 * Sets the groups associated with the role, removing and adding 500 * associations as necessary. 501 * 502 * @param roleId the primary key of the role 503 * @param groupIds the primary keys of the groups 504 * @throws PortalException if the user did not have permission to update 505 update the role 506 * @throws SystemException if a system exception occurred 507 */ 508 public void setRoleGroups(long roleId, long[] groupIds) 509 throws com.liferay.portal.kernel.exception.PortalException, 510 com.liferay.portal.kernel.exception.SystemException; 511 512 /** 513 * Removes the groups from the role. 514 * 515 * @param roleId the primary key of the role 516 * @param groupIds the primary keys of the groups 517 * @throws PortalException if the user did not have permission to update the 518 role 519 * @throws SystemException if a system exception occurred 520 */ 521 public void unsetRoleGroups(long roleId, long[] groupIds) 522 throws com.liferay.portal.kernel.exception.PortalException, 523 com.liferay.portal.kernel.exception.SystemException; 524 525 /** 526 * Updates the group's friendly URL. 527 * 528 * @param groupId the primary key of the group 529 * @param friendlyURL the group's new friendlyURL (optionally 530 <code>null</code>) 531 * @return the group 532 * @throws PortalException if the user did not have permission to update the 533 group, if a group with the primary key could not be found, or if 534 a valid friendly URL could not be created for the group 535 * @throws SystemException if a system exception occurred 536 */ 537 public com.liferay.portal.model.Group updateFriendlyURL(long groupId, 538 java.lang.String friendlyURL) 539 throws com.liferay.portal.kernel.exception.PortalException, 540 com.liferay.portal.kernel.exception.SystemException; 541 542 /** 543 * Updates the group. 544 * 545 * @param groupId the primary key of the group 546 * @param parentGroupId the primary key of the parent group 547 * @param name the group's new name 548 * @param description the group's new description (optionally 549 <code>null</code>) 550 * @param type the group's new type. For more information see {@link 551 com.liferay.portal.model.GroupConstants} 552 * @param friendlyURL the group's new friendlyURL (optionally 553 <code>null</code>) 554 * @param active whether the group is active 555 * @param serviceContext the service context to be applied (optionally 556 <code>null</code>). Can set the asset category IDs and asset tag 557 names for the group. 558 * @return the group 559 * @throws PortalException if the user did not have permission to update the 560 group, if a group with the primary key could not be found, if the 561 friendly URL was invalid or could one not be created 562 * @throws SystemException if a system exception occurred 563 */ 564 public com.liferay.portal.model.Group updateGroup(long groupId, 565 long parentGroupId, java.lang.String name, 566 java.lang.String description, int type, java.lang.String friendlyURL, 567 boolean active, com.liferay.portal.service.ServiceContext serviceContext) 568 throws com.liferay.portal.kernel.exception.PortalException, 569 com.liferay.portal.kernel.exception.SystemException; 570 571 /** 572 * Updates the group's type settings. 573 * 574 * @param groupId the primary key of the group 575 * @param typeSettings the group's new type settings (optionally 576 <code>null</code>) 577 * @return the group 578 * @throws PortalException if the user did not have permission to update the 579 group or if a group with the primary key could not be found 580 * @throws SystemException if a system exception occurred 581 */ 582 public com.liferay.portal.model.Group updateGroup(long groupId, 583 java.lang.String typeSettings) 584 throws com.liferay.portal.kernel.exception.PortalException, 585 com.liferay.portal.kernel.exception.SystemException; 586 }