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 user group local service. This utility wraps {@link com.liferay.portal.service.impl.UserGroupLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server. 023 * 024 * <p> 025 * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM. 026 * </p> 027 * 028 * @author Brian Wing Shun Chan 029 * @see UserGroupLocalService 030 * @see com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl 031 * @see com.liferay.portal.service.impl.UserGroupLocalServiceImpl 032 * @generated 033 */ 034 public class UserGroupLocalServiceUtil { 035 /* 036 * NOTE FOR DEVELOPERS: 037 * 038 * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.UserGroupLocalServiceImpl} and rerun ServiceBuilder to regenerate this class. 039 */ 040 041 /** 042 * Adds the user group to the database. Also notifies the appropriate model listeners. 043 * 044 * @param userGroup the user group 045 * @return the user group that was added 046 * @throws SystemException if a system exception occurred 047 */ 048 public static com.liferay.portal.model.UserGroup addUserGroup( 049 com.liferay.portal.model.UserGroup userGroup) 050 throws com.liferay.portal.kernel.exception.SystemException { 051 return getService().addUserGroup(userGroup); 052 } 053 054 /** 055 * Creates a new user group with the primary key. Does not add the user group to the database. 056 * 057 * @param userGroupId the primary key for the new user group 058 * @return the new user group 059 */ 060 public static com.liferay.portal.model.UserGroup createUserGroup( 061 long userGroupId) { 062 return getService().createUserGroup(userGroupId); 063 } 064 065 /** 066 * Deletes the user group with the primary key from the database. Also notifies the appropriate model listeners. 067 * 068 * @param userGroupId the primary key of the user group 069 * @throws PortalException if a user group with the primary key could not be found 070 * @throws SystemException if a system exception occurred 071 */ 072 public static void deleteUserGroup(long userGroupId) 073 throws com.liferay.portal.kernel.exception.PortalException, 074 com.liferay.portal.kernel.exception.SystemException { 075 getService().deleteUserGroup(userGroupId); 076 } 077 078 /** 079 * Deletes the user group from the database. Also notifies the appropriate model listeners. 080 * 081 * @param userGroup the user group 082 * @throws PortalException 083 * @throws SystemException if a system exception occurred 084 */ 085 public static void deleteUserGroup( 086 com.liferay.portal.model.UserGroup userGroup) 087 throws com.liferay.portal.kernel.exception.PortalException, 088 com.liferay.portal.kernel.exception.SystemException { 089 getService().deleteUserGroup(userGroup); 090 } 091 092 /** 093 * Performs a dynamic query on the database and returns the matching rows. 094 * 095 * @param dynamicQuery the dynamic query 096 * @return the matching rows 097 * @throws SystemException if a system exception occurred 098 */ 099 @SuppressWarnings("rawtypes") 100 public static java.util.List dynamicQuery( 101 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 102 throws com.liferay.portal.kernel.exception.SystemException { 103 return getService().dynamicQuery(dynamicQuery); 104 } 105 106 /** 107 * Performs a dynamic query on the database and returns a range of the matching rows. 108 * 109 * <p> 110 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 111 * </p> 112 * 113 * @param dynamicQuery the dynamic query 114 * @param start the lower bound of the range of model instances 115 * @param end the upper bound of the range of model instances (not inclusive) 116 * @return the range of matching rows 117 * @throws SystemException if a system exception occurred 118 */ 119 @SuppressWarnings("rawtypes") 120 public static java.util.List dynamicQuery( 121 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 122 int end) throws com.liferay.portal.kernel.exception.SystemException { 123 return getService().dynamicQuery(dynamicQuery, start, end); 124 } 125 126 /** 127 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 128 * 129 * <p> 130 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 131 * </p> 132 * 133 * @param dynamicQuery the dynamic query 134 * @param start the lower bound of the range of model instances 135 * @param end the upper bound of the range of model instances (not inclusive) 136 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 137 * @return the ordered range of matching rows 138 * @throws SystemException if a system exception occurred 139 */ 140 @SuppressWarnings("rawtypes") 141 public static java.util.List dynamicQuery( 142 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 143 int end, 144 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 145 throws com.liferay.portal.kernel.exception.SystemException { 146 return getService() 147 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 148 } 149 150 /** 151 * Returns the number of rows that match the dynamic query. 152 * 153 * @param dynamicQuery the dynamic query 154 * @return the number of rows that match the dynamic query 155 * @throws SystemException if a system exception occurred 156 */ 157 public static long dynamicQueryCount( 158 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 159 throws com.liferay.portal.kernel.exception.SystemException { 160 return getService().dynamicQueryCount(dynamicQuery); 161 } 162 163 public static com.liferay.portal.model.UserGroup fetchUserGroup( 164 long userGroupId) 165 throws com.liferay.portal.kernel.exception.SystemException { 166 return getService().fetchUserGroup(userGroupId); 167 } 168 169 /** 170 * Returns the user group with the primary key. 171 * 172 * @param userGroupId the primary key of the user group 173 * @return the user group 174 * @throws PortalException if a user group with the primary key could not be found 175 * @throws SystemException if a system exception occurred 176 */ 177 public static com.liferay.portal.model.UserGroup getUserGroup( 178 long userGroupId) 179 throws com.liferay.portal.kernel.exception.PortalException, 180 com.liferay.portal.kernel.exception.SystemException { 181 return getService().getUserGroup(userGroupId); 182 } 183 184 public static com.liferay.portal.model.PersistedModel getPersistedModel( 185 java.io.Serializable primaryKeyObj) 186 throws com.liferay.portal.kernel.exception.PortalException, 187 com.liferay.portal.kernel.exception.SystemException { 188 return getService().getPersistedModel(primaryKeyObj); 189 } 190 191 /** 192 * Returns a range of all the user groups. 193 * 194 * <p> 195 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 196 * </p> 197 * 198 * @param start the lower bound of the range of user groups 199 * @param end the upper bound of the range of user groups (not inclusive) 200 * @return the range of user groups 201 * @throws SystemException if a system exception occurred 202 */ 203 public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups( 204 int start, int end) 205 throws com.liferay.portal.kernel.exception.SystemException { 206 return getService().getUserGroups(start, end); 207 } 208 209 /** 210 * Returns the number of user groups. 211 * 212 * @return the number of user groups 213 * @throws SystemException if a system exception occurred 214 */ 215 public static int getUserGroupsCount() 216 throws com.liferay.portal.kernel.exception.SystemException { 217 return getService().getUserGroupsCount(); 218 } 219 220 /** 221 * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 222 * 223 * @param userGroup the user group 224 * @return the user group that was updated 225 * @throws SystemException if a system exception occurred 226 */ 227 public static com.liferay.portal.model.UserGroup updateUserGroup( 228 com.liferay.portal.model.UserGroup userGroup) 229 throws com.liferay.portal.kernel.exception.SystemException { 230 return getService().updateUserGroup(userGroup); 231 } 232 233 /** 234 * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 235 * 236 * @param userGroup the user group 237 * @param merge whether to merge the user group with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation. 238 * @return the user group that was updated 239 * @throws SystemException if a system exception occurred 240 */ 241 public static com.liferay.portal.model.UserGroup updateUserGroup( 242 com.liferay.portal.model.UserGroup userGroup, boolean merge) 243 throws com.liferay.portal.kernel.exception.SystemException { 244 return getService().updateUserGroup(userGroup, merge); 245 } 246 247 /** 248 * Returns the Spring bean ID for this bean. 249 * 250 * @return the Spring bean ID for this bean 251 */ 252 public static java.lang.String getBeanIdentifier() { 253 return getService().getBeanIdentifier(); 254 } 255 256 /** 257 * Sets the Spring bean ID for this bean. 258 * 259 * @param beanIdentifier the Spring bean ID for this bean 260 */ 261 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 262 getService().setBeanIdentifier(beanIdentifier); 263 } 264 265 /** 266 * Adds the user groups to the group. 267 * 268 * @param groupId the primary key of the group 269 * @param userGroupIds the primary keys of the user groups 270 * @throws SystemException if a system exception occurred 271 */ 272 public static void addGroupUserGroups(long groupId, long[] userGroupIds) 273 throws com.liferay.portal.kernel.exception.SystemException { 274 getService().addGroupUserGroups(groupId, userGroupIds); 275 } 276 277 /** 278 * Adds the user groups to the team. 279 * 280 * @param teamId the primary key of the team 281 * @param userGroupIds the primary keys of the user groups 282 * @throws SystemException if a system exception occurred 283 */ 284 public static void addTeamUserGroups(long teamId, long[] userGroupIds) 285 throws com.liferay.portal.kernel.exception.SystemException { 286 getService().addTeamUserGroups(teamId, userGroupIds); 287 } 288 289 /** 290 * Adds a user group. 291 * 292 * <p> 293 * This method handles the creation and bookkeeping of the user group, 294 * including its resources, metadata, and internal data structures. It is 295 * not necessary to make subsequent calls to setup default groups and 296 * resources for the user group. 297 * </p> 298 * 299 * @param userId the primary key of the user 300 * @param companyId the primary key of the user group's company 301 * @param name the user group's name 302 * @param description the user group's description 303 * @return the user group 304 * @throws PortalException if the user group's information was invalid 305 * @throws SystemException if a system exception occurred 306 */ 307 public static com.liferay.portal.model.UserGroup addUserGroup(long userId, 308 long companyId, java.lang.String name, java.lang.String description) 309 throws com.liferay.portal.kernel.exception.PortalException, 310 com.liferay.portal.kernel.exception.SystemException { 311 return getService().addUserGroup(userId, companyId, name, description); 312 } 313 314 /** 315 * Clears all associations between the user and its user groups and clears 316 * the permissions cache. 317 * 318 * <p> 319 * This method is called from {@link #deleteUserGroup(UserGroup)}. 320 * </p> 321 * 322 * @param userId the primary key of the user 323 * @throws SystemException if a system exception occurred 324 */ 325 public static void clearUserUserGroups(long userId) 326 throws com.liferay.portal.kernel.exception.SystemException { 327 getService().clearUserUserGroups(userId); 328 } 329 330 /** 331 * Copies the user group's layouts to the users who are not already members 332 * of the user group. 333 * 334 * @param userGroupId the primary key of the user group 335 * @param userIds the primary keys of the users 336 * @throws PortalException if any one of the users could not be found or 337 if a portal exception occurred 338 * @throws SystemException if a system exception occurred 339 * @deprecated 340 */ 341 public static void copyUserGroupLayouts(long userGroupId, long[] userIds) 342 throws com.liferay.portal.kernel.exception.PortalException, 343 com.liferay.portal.kernel.exception.SystemException { 344 getService().copyUserGroupLayouts(userGroupId, userIds); 345 } 346 347 /** 348 * Copies the user groups' layouts to the user. 349 * 350 * @param userGroupIds the primary keys of the user groups 351 * @param userId the primary key of the user 352 * @throws PortalException if a user with the primary key could not be 353 found or if a portal exception occurred 354 * @throws SystemException if a system exception occurred 355 * @deprecated 356 */ 357 public static void copyUserGroupLayouts(long[] userGroupIds, long userId) 358 throws com.liferay.portal.kernel.exception.PortalException, 359 com.liferay.portal.kernel.exception.SystemException { 360 getService().copyUserGroupLayouts(userGroupIds, userId); 361 } 362 363 /** 364 * Copies the user group's layout to the user. 365 * 366 * @param userGroupId the primary key of the user group 367 * @param userId the primary key of the user 368 * @throws PortalException if a user with the primary key could not be 369 found or if a portal exception occurred 370 * @throws SystemException if a system exception occurred 371 * @deprecated 372 */ 373 public static void copyUserGroupLayouts(long userGroupId, long userId) 374 throws com.liferay.portal.kernel.exception.PortalException, 375 com.liferay.portal.kernel.exception.SystemException { 376 getService().copyUserGroupLayouts(userGroupId, userId); 377 } 378 379 /** 380 * Returns the user group with the name. 381 * 382 * @param companyId the primary key of the user group's company 383 * @param name the user group's name 384 * @return Returns the user group with the name 385 * @throws PortalException if a user group with the name could not be found 386 * @throws SystemException if a system exception occurred 387 */ 388 public static com.liferay.portal.model.UserGroup getUserGroup( 389 long companyId, java.lang.String name) 390 throws com.liferay.portal.kernel.exception.PortalException, 391 com.liferay.portal.kernel.exception.SystemException { 392 return getService().getUserGroup(companyId, name); 393 } 394 395 /** 396 * Returns all the user groups belonging to the company. 397 * 398 * @param companyId the primary key of the user groups' company 399 * @return the user groups belonging to the company 400 * @throws SystemException if a system exception occurred 401 */ 402 public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups( 403 long companyId) 404 throws com.liferay.portal.kernel.exception.SystemException { 405 return getService().getUserGroups(companyId); 406 } 407 408 /** 409 * Returns all the user groups with the primary keys. 410 * 411 * @param userGroupIds the primary keys of the user groups 412 * @return the user groups with the primary keys 413 * @throws PortalException if any one of the user groups could not be found 414 * @throws SystemException if a system exception occurred 415 */ 416 public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups( 417 long[] userGroupIds) 418 throws com.liferay.portal.kernel.exception.PortalException, 419 com.liferay.portal.kernel.exception.SystemException { 420 return getService().getUserGroups(userGroupIds); 421 } 422 423 /** 424 * Returns all the user groups to which the user belongs. 425 * 426 * @param userId the primary key of the user 427 * @return the user groups to which the user belongs 428 * @throws SystemException if a system exception occurred 429 */ 430 public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups( 431 long userId) throws com.liferay.portal.kernel.exception.SystemException { 432 return getService().getUserUserGroups(userId); 433 } 434 435 /** 436 * Returns <code>true</code> if the user group is associated with the group. 437 * 438 * @param groupId the primary key of the group 439 * @param userGroupId the primary key of the user group 440 * @return <code>true</code> if the user group belongs to the group; 441 <code>false</code> otherwise 442 * @throws SystemException if a system exception occurred 443 */ 444 public static boolean hasGroupUserGroup(long groupId, long userGroupId) 445 throws com.liferay.portal.kernel.exception.SystemException { 446 return getService().hasGroupUserGroup(groupId, userGroupId); 447 } 448 449 /** 450 * Returns <code>true</code> if the user group belongs to the team. 451 * 452 * @param teamId the primary key of the team 453 * @param userGroupId the primary key of the user group 454 * @return <code>true</code> if the user group belongs to the team; 455 <code>false</code> otherwise 456 * @throws SystemException if a system exception occurred 457 */ 458 public static boolean hasTeamUserGroup(long teamId, long userGroupId) 459 throws com.liferay.portal.kernel.exception.SystemException { 460 return getService().hasTeamUserGroup(teamId, userGroupId); 461 } 462 463 /** 464 * Returns an ordered range of all the user groups that match the name and 465 * description. 466 * 467 * <p> 468 * Useful when paginating results. Returns a maximum of <code>end - 469 * start</code> instances. <code>start</code> and <code>end</code> are not 470 * primary keys, they are indexes in the result set. Thus, <code>0</code> 471 * refers to the first result in the set. Setting both <code>start</code> 472 * and <code>end</code> to {@link 473 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 474 * result set. 475 * </p> 476 * 477 * @param companyId the primary key of the user group's company 478 * @param name the user group's name (optionally <code>null</code>) 479 * @param description the user group's description (optionally 480 <code>null</code>) 481 * @param params the finder params (optionally <code>null</code>). For more 482 information see {@link 483 com.liferay.portal.service.persistence.UserGroupFinder} 484 * @param start the lower bound of the range of user groups to return 485 * @param end the upper bound of the range of user groups to return (not 486 inclusive) 487 * @param obc the comparator to order the user groups (optionally 488 <code>null</code>) 489 * @return the matching user groups ordered by comparator <code>obc</code> 490 * @throws SystemException if a system exception occurred 491 * @see com.liferay.portal.service.persistence.UserGroupFinder 492 */ 493 public static java.util.List<com.liferay.portal.model.UserGroup> search( 494 long companyId, java.lang.String name, java.lang.String description, 495 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 496 int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) 497 throws com.liferay.portal.kernel.exception.SystemException { 498 return getService() 499 .search(companyId, name, description, params, start, end, obc); 500 } 501 502 /** 503 * Returns the number of user groups that match the name and description. 504 * 505 * @param companyId the primary key of the user group's company 506 * @param name the user group's name (optionally <code>null</code>) 507 * @param description the user group's description (optionally 508 <code>null</code>) 509 * @param params the finder params (optionally <code>null</code>). For more 510 information see {@link 511 com.liferay.portal.service.persistence.UserGroupFinder} 512 * @return the number of matching user groups 513 * @throws SystemException if a system exception occurred 514 * @see com.liferay.portal.service.persistence.UserGroupFinder 515 */ 516 public static int searchCount(long companyId, java.lang.String name, 517 java.lang.String description, 518 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) 519 throws com.liferay.portal.kernel.exception.SystemException { 520 return getService().searchCount(companyId, name, description, params); 521 } 522 523 /** 524 * Sets the user groups associated with the user copying the user group 525 * layouts and removing and adding user group associations for the user as 526 * necessary. 527 * 528 * @param userId the primary key of the user 529 * @param userGroupIds the primary keys of the user groups 530 * @throws PortalException if a portal exception occurred 531 * @throws SystemException if a system exception occurred 532 */ 533 public static void setUserUserGroups(long userId, long[] userGroupIds) 534 throws com.liferay.portal.kernel.exception.PortalException, 535 com.liferay.portal.kernel.exception.SystemException { 536 getService().setUserUserGroups(userId, userGroupIds); 537 } 538 539 /** 540 * Removes the user groups from the group. 541 * 542 * @param groupId the primary key of the group 543 * @param userGroupIds the primary keys of the user groups 544 * @throws SystemException if a system exception occurred 545 */ 546 public static void unsetGroupUserGroups(long groupId, long[] userGroupIds) 547 throws com.liferay.portal.kernel.exception.SystemException { 548 getService().unsetGroupUserGroups(groupId, userGroupIds); 549 } 550 551 /** 552 * Removes the user groups from the team. 553 * 554 * @param teamId the primary key of the team 555 * @param userGroupIds the primary keys of the user groups 556 * @throws SystemException if a system exception occurred 557 */ 558 public static void unsetTeamUserGroups(long teamId, long[] userGroupIds) 559 throws com.liferay.portal.kernel.exception.SystemException { 560 getService().unsetTeamUserGroups(teamId, userGroupIds); 561 } 562 563 /** 564 * Updates the user group. 565 * 566 * @param companyId the primary key of the user group's company 567 * @param userGroupId the primary key of the user group 568 * @param name the user group's name 569 * @param description the user group's description 570 * @return the user group 571 * @throws PortalException if a user group with the primary key could not be 572 found or if the new information was invalid 573 * @throws SystemException if a system exception occurred 574 */ 575 public static com.liferay.portal.model.UserGroup updateUserGroup( 576 long companyId, long userGroupId, java.lang.String name, 577 java.lang.String description) 578 throws com.liferay.portal.kernel.exception.PortalException, 579 com.liferay.portal.kernel.exception.SystemException { 580 return getService() 581 .updateUserGroup(companyId, userGroupId, name, description); 582 } 583 584 public static UserGroupLocalService getService() { 585 if (_service == null) { 586 _service = (UserGroupLocalService)PortalBeanLocatorUtil.locate(UserGroupLocalService.class.getName()); 587 588 ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class, 589 "_service"); 590 MethodCache.remove(UserGroupLocalService.class); 591 } 592 593 return _service; 594 } 595 596 public void setService(UserGroupLocalService service) { 597 MethodCache.remove(UserGroupLocalService.class); 598 599 _service = service; 600 601 ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class, 602 "_service"); 603 MethodCache.remove(UserGroupLocalService.class); 604 } 605 606 private static UserGroupLocalService _service; 607 }