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