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