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