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