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 * <p> 328 * <ul> <li> Class name "User" includes the user's layout set 329 * group. </li> <li> Class name "Organization" includes the user's 330 * immediate organization groups and inherited organization groups. </li> 331 * <li> Class name "Group" includes the user's immediate 332 * organization groups and site groups. </li> <li> A <code>classNames</code> 333 * value of <code>null</code> includes the user's layout set group, 334 * organization groups, inherited organization groups, and site groups. 335 * </li> </ul> 336 * </p> 337 * 338 * @param userId the primary key of the user 339 * @param classNames the group entity class names (optionally 340 <code>null</code>). For more information see {@link 341 #getUserPlaces(long, String[], int)} 342 * @param max the maximum number of groups to return 343 * @return the user's group "places" 344 * @throws PortalException if a portal exception occurred 345 * @throws SystemException if a system exception occurred 346 */ 347 public static java.util.List<com.liferay.portal.model.Group> getUserPlaces( 348 long userId, java.lang.String[] classNames, int max) 349 throws com.liferay.portal.kernel.exception.PortalException, 350 com.liferay.portal.kernel.exception.SystemException { 351 return getService().getUserPlaces(userId, classNames, max); 352 } 353 354 public static java.util.List<com.liferay.portal.model.Group> getUserPlaces( 355 long userId, java.lang.String[] classNames, java.lang.String name, 356 boolean active, boolean includeControlPanel, int start, int end) 357 throws com.liferay.portal.kernel.exception.PortalException, 358 com.liferay.portal.kernel.exception.SystemException { 359 return getService() 360 .getUserPlaces(userId, classNames, name, active, 361 includeControlPanel, start, end); 362 } 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 * <p> 370 * <ul> <li> Class name "User" includes the user's layout set 371 * group. </li> <li> Class name "Organization" includes the user's 372 * immediate organization groups and inherited organization groups. </li> 373 * <li> Class name "Group" includes the user's immediate 374 * organization groups and site groups. </li> <li> A <code>classNames</code> 375 * value of <code>null</code> includes the user's layout set group, 376 * organization groups, inherited organization groups, and site groups. 377 * </li> </ul> 378 * </p> 379 * 380 * @param classNames the group entity class names (optionally 381 <code>null</code>). For more information see {@link 382 #getUserPlaces(String[], int)} 383 * @param max the maximum number of groups to return 384 * @return the user's group "places" 385 * @throws PortalException if a portal exception occurred 386 * @throws SystemException if a system exception occurred 387 */ 388 public static java.util.List<com.liferay.portal.model.Group> getUserPlaces( 389 java.lang.String[] classNames, int max) 390 throws com.liferay.portal.kernel.exception.PortalException, 391 com.liferay.portal.kernel.exception.SystemException { 392 return getService().getUserPlaces(classNames, max); 393 } 394 395 /** 396 * Returns the number of the guest or current user's group 397 * "places" associated with the group entity class names, 398 * including the Control Panel group if the user is permitted to view the 399 * Control Panel. 400 * 401 * @return the number of user's group "places" 402 * @throws PortalException if a portal exception occurred 403 * @throws SystemException if a system exception occurred 404 */ 405 public static int getUserPlacesCount() 406 throws com.liferay.portal.kernel.exception.PortalException, 407 com.liferay.portal.kernel.exception.SystemException { 408 return getService().getUserPlacesCount(); 409 } 410 411 /** 412 * Returns the guest or current user's layout set group, organization 413 * groups, inherited organization groups, and site groups. 414 * 415 * @return the user's layout set group, organization groups, and inherited 416 organization groups, and site groups 417 * @throws PortalException if a portal exception occurred 418 * @throws SystemException if a system exception occurred 419 */ 420 public static java.util.List<com.liferay.portal.model.Group> getUserSites() 421 throws com.liferay.portal.kernel.exception.PortalException, 422 com.liferay.portal.kernel.exception.SystemException { 423 return getService().getUserSites(); 424 } 425 426 /** 427 * Returns <code>true</code> if the user is associated with the group, 428 * including the user's inherited organizations and user groups. System and 429 * staged groups are not included. 430 * 431 * @param userId the primary key of the user 432 * @param groupId the primary key of the group 433 * @return <code>true</code> if the user is associated with the group; 434 <code>false</code> otherwise 435 * @throws PortalException if the current user did not have permission to 436 view the user or group members 437 * @throws SystemException if a system exception occurred 438 */ 439 public static boolean hasUserGroup(long userId, long groupId) 440 throws com.liferay.portal.kernel.exception.PortalException, 441 com.liferay.portal.kernel.exception.SystemException { 442 return getService().hasUserGroup(userId, groupId); 443 } 444 445 /** 446 * Returns an ordered range of all the site groups and organization groups 447 * that match the name and description, optionally including the user's 448 * inherited organization groups and user groups. System and staged groups 449 * are not included. 450 * 451 * <p> 452 * Useful when paginating results. Returns a maximum of <code>end - 453 * start</code> instances. <code>start</code> and <code>end</code> are not 454 * primary keys, they are indexes in the result set. Thus, <code>0</code> 455 * refers to the first result in the set. Setting both <code>start</code> 456 * and <code>end</code> to {@link 457 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 458 * result set. 459 * </p> 460 * 461 * @param companyId the primary key of the company 462 * @param name the group's name (optionally <code>null</code>) 463 * @param description the group's description (optionally 464 <code>null</code>) 465 * @param params the finder params (optionally <code>null</code>). To 466 include the user's inherited organizations and user groups in the 467 search, add entries having "usersGroups" and 468 "inherit" as keys mapped to the the user's ID. For more 469 information see {@link 470 com.liferay.portal.service.persistence.GroupFinder} 471 * @param start the lower bound of the range of groups to return 472 * @param end the upper bound of the range of groups to return (not 473 inclusive) 474 * @return the matching groups ordered by name 475 * @throws PortalException if a portal exception occurred 476 * @throws SystemException if a system exception occurred 477 */ 478 public static java.util.List<com.liferay.portal.model.Group> search( 479 long companyId, java.lang.String name, java.lang.String description, 480 java.lang.String[] params, int start, int end) 481 throws com.liferay.portal.kernel.exception.PortalException, 482 com.liferay.portal.kernel.exception.SystemException { 483 return getService() 484 .search(companyId, name, description, params, start, end); 485 } 486 487 /** 488 * Returns the number of groups and organization groups that match the name 489 * and description, optionally including the user's inherited organizations 490 * and user groups. System and staged groups are not included. 491 * 492 * @param companyId the primary key of the company 493 * @param name the group's name (optionally <code>null</code>) 494 * @param description the group's description (optionally 495 <code>null</code>) 496 * @param params the finder params (optionally <code>null</code>). To 497 include the user's inherited organizations and user groups in the 498 search, add entries having "usersGroups" and 499 "inherit" as keys mapped to the the user's ID. For more 500 information see {@link 501 com.liferay.portal.service.persistence.GroupFinder} 502 * @return the number of matching groups 503 * @throws SystemException if a system exception occurred 504 */ 505 public static int searchCount(long companyId, java.lang.String name, 506 java.lang.String description, java.lang.String[] params) 507 throws com.liferay.portal.kernel.exception.SystemException { 508 return getService().searchCount(companyId, name, description, params); 509 } 510 511 /** 512 * Sets the groups associated with the role, removing and adding 513 * associations as necessary. 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 518 update the role 519 * @throws SystemException if a system exception occurred 520 */ 521 public static void setRoleGroups(long roleId, long[] groupIds) 522 throws com.liferay.portal.kernel.exception.PortalException, 523 com.liferay.portal.kernel.exception.SystemException { 524 getService().setRoleGroups(roleId, groupIds); 525 } 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 static void unsetRoleGroups(long roleId, long[] groupIds) 537 throws com.liferay.portal.kernel.exception.PortalException, 538 com.liferay.portal.kernel.exception.SystemException { 539 getService().unsetRoleGroups(roleId, groupIds); 540 } 541 542 /** 543 * Updates the group's friendly URL. 544 * 545 * @param groupId the primary key of the group 546 * @param friendlyURL the group's new friendlyURL (optionally 547 <code>null</code>) 548 * @return the group 549 * @throws PortalException if the user did not have permission to update the 550 group, if a group with the primary key could not be found, or if 551 a valid friendly URL could not be created for the group 552 * @throws SystemException if a system exception occurred 553 */ 554 public static com.liferay.portal.model.Group updateFriendlyURL( 555 long groupId, java.lang.String friendlyURL) 556 throws com.liferay.portal.kernel.exception.PortalException, 557 com.liferay.portal.kernel.exception.SystemException { 558 return getService().updateFriendlyURL(groupId, friendlyURL); 559 } 560 561 /** 562 * Updates the group. 563 * 564 * @param groupId the primary key of the group 565 * @param parentGroupId the primary key of the parent group 566 * @param name the group's new name 567 * @param description the group's new description (optionally 568 <code>null</code>) 569 * @param type the group's new type. For more information see {@link 570 com.liferay.portal.model.GroupConstants} 571 * @param friendlyURL the group's new friendlyURL (optionally 572 <code>null</code>) 573 * @param active whether the group is active 574 * @param serviceContext the service context to be applied (optionally 575 <code>null</code>). Can set the asset category IDs and asset tag 576 names for the group. 577 * @return the group 578 * @throws PortalException if the user did not have permission to update the 579 group, if a group with the primary key could not be found, if the 580 friendly URL was invalid or could one not be created 581 * @throws SystemException if a system exception occurred 582 */ 583 public static com.liferay.portal.model.Group updateGroup(long groupId, 584 long parentGroupId, java.lang.String name, 585 java.lang.String description, int type, java.lang.String friendlyURL, 586 boolean active, com.liferay.portal.service.ServiceContext serviceContext) 587 throws com.liferay.portal.kernel.exception.PortalException, 588 com.liferay.portal.kernel.exception.SystemException { 589 return getService() 590 .updateGroup(groupId, parentGroupId, name, description, 591 type, friendlyURL, active, serviceContext); 592 } 593 594 /** 595 * Updates the group's type settings. 596 * 597 * @param groupId the primary key of the group 598 * @param typeSettings the group's new type settings (optionally 599 <code>null</code>) 600 * @return the group 601 * @throws PortalException if the user did not have permission to update the 602 group or if a group with the primary key could not be found 603 * @throws SystemException if a system exception occurred 604 */ 605 public static com.liferay.portal.model.Group updateGroup(long groupId, 606 java.lang.String typeSettings) 607 throws com.liferay.portal.kernel.exception.PortalException, 608 com.liferay.portal.kernel.exception.SystemException { 609 return getService().updateGroup(groupId, typeSettings); 610 } 611 612 public static GroupService getService() { 613 if (_service == null) { 614 _service = (GroupService)PortalBeanLocatorUtil.locate(GroupService.class.getName()); 615 616 ReferenceRegistry.registerReference(GroupServiceUtil.class, 617 "_service"); 618 } 619 620 return _service; 621 } 622 623 /** 624 * @deprecated 625 */ 626 public void setService(GroupService service) { 627 } 628 629 private static GroupService _service; 630 }