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 * <p> 308 * <ul> <li> Class name "User" includes the user's layout set 309 * group. </li> <li> Class name "Organization" includes the user's 310 * immediate organization groups and inherited organization groups. </li> 311 * <li> Class name "Group" includes the user's immediate 312 * organization groups and site groups. </li> <li> A <code>classNames</code> 313 * value of <code>null</code> includes the user's layout set group, 314 * organization groups, inherited organization groups, and site groups. 315 * </li> </ul> 316 * </p> 317 * 318 * @param userId the primary key of the user 319 * @param classNames the group entity class names (optionally 320 <code>null</code>). For more information see {@link 321 #getUserPlaces(long, String[], int)} 322 * @param max the maximum number of groups to return 323 * @return the user's group "places" 324 * @throws PortalException if a portal exception occurred 325 * @throws SystemException if a system exception occurred 326 */ 327 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 328 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 329 long userId, java.lang.String[] classNames, int max) 330 throws com.liferay.portal.kernel.exception.PortalException, 331 com.liferay.portal.kernel.exception.SystemException; 332 333 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 334 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 335 long userId, java.lang.String[] classNames, java.lang.String name, 336 boolean active, boolean includeControlPanel, int start, int end) 337 throws com.liferay.portal.kernel.exception.PortalException, 338 com.liferay.portal.kernel.exception.SystemException; 339 340 /** 341 * Returns the guest or current user's group "places" associated 342 * with the group entity class names, including the Control Panel group if 343 * the user is permitted to view the Control Panel. 344 * 345 * <p> 346 * <ul> <li> Class name "User" includes the user's layout set 347 * group. </li> <li> Class name "Organization" includes the user's 348 * immediate organization groups and inherited organization groups. </li> 349 * <li> Class name "Group" includes the user's immediate 350 * organization groups and site groups. </li> <li> A <code>classNames</code> 351 * value of <code>null</code> includes the user's layout set group, 352 * organization groups, inherited organization groups, and site groups. 353 * </li> </ul> 354 * </p> 355 * 356 * @param classNames the group entity class names (optionally 357 <code>null</code>). For more information see {@link 358 #getUserPlaces(String[], int)} 359 * @param max the maximum number of groups to return 360 * @return the user's group "places" 361 * @throws PortalException if a portal exception occurred 362 * @throws SystemException if a system exception occurred 363 */ 364 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 365 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 366 java.lang.String[] classNames, int max) 367 throws com.liferay.portal.kernel.exception.PortalException, 368 com.liferay.portal.kernel.exception.SystemException; 369 370 /** 371 * Returns the number of the guest or current user's group 372 * "places" associated with the group entity class names, 373 * including the Control Panel group if the user is permitted to view the 374 * Control Panel. 375 * 376 * @return the number of user's group "places" 377 * @throws PortalException if a portal exception occurred 378 * @throws SystemException if a system exception occurred 379 */ 380 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 381 public int getUserPlacesCount() 382 throws com.liferay.portal.kernel.exception.PortalException, 383 com.liferay.portal.kernel.exception.SystemException; 384 385 /** 386 * Returns the guest or current user's layout set group, organization 387 * groups, inherited organization groups, and site groups. 388 * 389 * @return the user's layout set group, organization groups, and inherited 390 organization groups, and site groups 391 * @throws PortalException if a portal exception occurred 392 * @throws SystemException if a system exception occurred 393 */ 394 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 395 public java.util.List<com.liferay.portal.model.Group> getUserSites() 396 throws com.liferay.portal.kernel.exception.PortalException, 397 com.liferay.portal.kernel.exception.SystemException; 398 399 /** 400 * Returns <code>true</code> if the user is associated with the group, 401 * including the user's inherited organizations and user groups. System and 402 * staged groups are not included. 403 * 404 * @param userId the primary key of the user 405 * @param groupId the primary key of the group 406 * @return <code>true</code> if the user is associated with the group; 407 <code>false</code> otherwise 408 * @throws PortalException if the current user did not have permission to 409 view the user or group members 410 * @throws SystemException if a system exception occurred 411 */ 412 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 413 public boolean hasUserGroup(long userId, long groupId) 414 throws com.liferay.portal.kernel.exception.PortalException, 415 com.liferay.portal.kernel.exception.SystemException; 416 417 /** 418 * Returns an ordered range of all the site groups and organization groups 419 * that match the name and description, optionally including the user's 420 * inherited organization groups and user groups. System and staged groups 421 * are not included. 422 * 423 * <p> 424 * Useful when paginating results. Returns a maximum of <code>end - 425 * start</code> instances. <code>start</code> and <code>end</code> are not 426 * primary keys, they are indexes in the result set. Thus, <code>0</code> 427 * refers to the first result in the set. Setting both <code>start</code> 428 * and <code>end</code> to {@link 429 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 430 * result set. 431 * </p> 432 * 433 * @param companyId the primary key of the company 434 * @param name the group's name (optionally <code>null</code>) 435 * @param description the group's description (optionally 436 <code>null</code>) 437 * @param params the finder params (optionally <code>null</code>). To 438 include the user's inherited organizations and user groups in the 439 search, add entries having "usersGroups" and 440 "inherit" as keys mapped to the the user's ID. For more 441 information see {@link 442 com.liferay.portal.service.persistence.GroupFinder} 443 * @param start the lower bound of the range of groups to return 444 * @param end the upper bound of the range of groups to return (not 445 inclusive) 446 * @return the matching groups ordered by name 447 * @throws PortalException if a portal exception occurred 448 * @throws SystemException if a system exception occurred 449 */ 450 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 451 public java.util.List<com.liferay.portal.model.Group> search( 452 long companyId, java.lang.String name, java.lang.String description, 453 java.lang.String[] params, int start, int end) 454 throws com.liferay.portal.kernel.exception.PortalException, 455 com.liferay.portal.kernel.exception.SystemException; 456 457 /** 458 * Returns the number of groups and organization groups that match the name 459 * and description, optionally including the user's inherited organizations 460 * and user groups. System and staged groups are not included. 461 * 462 * @param companyId the primary key of the company 463 * @param name the group's name (optionally <code>null</code>) 464 * @param description the group's description (optionally 465 <code>null</code>) 466 * @param params the finder params (optionally <code>null</code>). To 467 include the user's inherited organizations and user groups in the 468 search, add entries having "usersGroups" and 469 "inherit" as keys mapped to the the user's ID. For more 470 information see {@link 471 com.liferay.portal.service.persistence.GroupFinder} 472 * @return the number of matching groups 473 * @throws SystemException if a system exception occurred 474 */ 475 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 476 public int searchCount(long companyId, java.lang.String name, 477 java.lang.String description, java.lang.String[] params) 478 throws com.liferay.portal.kernel.exception.SystemException; 479 480 /** 481 * Sets the groups associated with the role, removing and adding 482 * associations as necessary. 483 * 484 * @param roleId the primary key of the role 485 * @param groupIds the primary keys of the groups 486 * @throws PortalException if the user did not have permission to update 487 update the role 488 * @throws SystemException if a system exception occurred 489 */ 490 public void setRoleGroups(long roleId, long[] groupIds) 491 throws com.liferay.portal.kernel.exception.PortalException, 492 com.liferay.portal.kernel.exception.SystemException; 493 494 /** 495 * Removes the groups from the role. 496 * 497 * @param roleId the primary key of the role 498 * @param groupIds the primary keys of the groups 499 * @throws PortalException if the user did not have permission to update the 500 role 501 * @throws SystemException if a system exception occurred 502 */ 503 public void unsetRoleGroups(long roleId, long[] groupIds) 504 throws com.liferay.portal.kernel.exception.PortalException, 505 com.liferay.portal.kernel.exception.SystemException; 506 507 /** 508 * Updates the group's friendly URL. 509 * 510 * @param groupId the primary key of the group 511 * @param friendlyURL the group's new friendlyURL (optionally 512 <code>null</code>) 513 * @return the group 514 * @throws PortalException if the user did not have permission to update the 515 group, if a group with the primary key could not be found, or if 516 a valid friendly URL could not be created for the group 517 * @throws SystemException if a system exception occurred 518 */ 519 public com.liferay.portal.model.Group updateFriendlyURL(long groupId, 520 java.lang.String friendlyURL) 521 throws com.liferay.portal.kernel.exception.PortalException, 522 com.liferay.portal.kernel.exception.SystemException; 523 524 /** 525 * Updates the group. 526 * 527 * @param groupId the primary key of the group 528 * @param parentGroupId the primary key of the parent group 529 * @param name the group's new name 530 * @param description the group's new description (optionally 531 <code>null</code>) 532 * @param type the group's new type. For more information see {@link 533 com.liferay.portal.model.GroupConstants} 534 * @param friendlyURL the group's new friendlyURL (optionally 535 <code>null</code>) 536 * @param active whether the group is active 537 * @param serviceContext the service context to be applied (optionally 538 <code>null</code>). Can set the asset category IDs and asset tag 539 names for the group. 540 * @return the group 541 * @throws PortalException if the user did not have permission to update the 542 group, if a group with the primary key could not be found, if the 543 friendly URL was invalid or could one not be created 544 * @throws SystemException if a system exception occurred 545 */ 546 public com.liferay.portal.model.Group updateGroup(long groupId, 547 long parentGroupId, java.lang.String name, 548 java.lang.String description, int type, java.lang.String friendlyURL, 549 boolean active, com.liferay.portal.service.ServiceContext serviceContext) 550 throws com.liferay.portal.kernel.exception.PortalException, 551 com.liferay.portal.kernel.exception.SystemException; 552 553 /** 554 * Updates the group's type settings. 555 * 556 * @param groupId the primary key of the group 557 * @param typeSettings the group's new type settings (optionally 558 <code>null</code>) 559 * @return the group 560 * @throws PortalException if the user did not have permission to update the 561 group or if a group with the primary key could not be found 562 * @throws SystemException if a system exception occurred 563 */ 564 public com.liferay.portal.model.Group updateGroup(long groupId, 565 java.lang.String typeSettings) 566 throws com.liferay.portal.kernel.exception.PortalException, 567 com.liferay.portal.kernel.exception.SystemException; 568 }