001 /** 002 * Copyright (c) 2000-2011 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 /** 164 * Returns the user group with the primary key. 165 * 166 * @param userGroupId the primary key of the user group 167 * @return the user group 168 * @throws PortalException if a user group with the primary key could not be found 169 * @throws SystemException if a system exception occurred 170 */ 171 public static com.liferay.portal.model.UserGroup getUserGroup( 172 long userGroupId) 173 throws com.liferay.portal.kernel.exception.PortalException, 174 com.liferay.portal.kernel.exception.SystemException { 175 return getService().getUserGroup(userGroupId); 176 } 177 178 public static com.liferay.portal.model.PersistedModel getPersistedModel( 179 java.io.Serializable primaryKeyObj) 180 throws com.liferay.portal.kernel.exception.PortalException, 181 com.liferay.portal.kernel.exception.SystemException { 182 return getService().getPersistedModel(primaryKeyObj); 183 } 184 185 /** 186 * Returns a range of all the user groups. 187 * 188 * <p> 189 * 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. 190 * </p> 191 * 192 * @param start the lower bound of the range of user groups 193 * @param end the upper bound of the range of user groups (not inclusive) 194 * @return the range of user groups 195 * @throws SystemException if a system exception occurred 196 */ 197 public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups( 198 int start, int end) 199 throws com.liferay.portal.kernel.exception.SystemException { 200 return getService().getUserGroups(start, end); 201 } 202 203 /** 204 * Returns the number of user groups. 205 * 206 * @return the number of user groups 207 * @throws SystemException if a system exception occurred 208 */ 209 public static int getUserGroupsCount() 210 throws com.liferay.portal.kernel.exception.SystemException { 211 return getService().getUserGroupsCount(); 212 } 213 214 /** 215 * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 216 * 217 * @param userGroup the user group 218 * @return the user group that was updated 219 * @throws SystemException if a system exception occurred 220 */ 221 public static com.liferay.portal.model.UserGroup updateUserGroup( 222 com.liferay.portal.model.UserGroup userGroup) 223 throws com.liferay.portal.kernel.exception.SystemException { 224 return getService().updateUserGroup(userGroup); 225 } 226 227 /** 228 * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 229 * 230 * @param userGroup the user group 231 * @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. 232 * @return the user group that was updated 233 * @throws SystemException if a system exception occurred 234 */ 235 public static com.liferay.portal.model.UserGroup updateUserGroup( 236 com.liferay.portal.model.UserGroup userGroup, boolean merge) 237 throws com.liferay.portal.kernel.exception.SystemException { 238 return getService().updateUserGroup(userGroup, merge); 239 } 240 241 /** 242 * Returns the Spring bean ID for this bean. 243 * 244 * @return the Spring bean ID for this bean 245 */ 246 public static java.lang.String getBeanIdentifier() { 247 return getService().getBeanIdentifier(); 248 } 249 250 /** 251 * Sets the Spring bean ID for this bean. 252 * 253 * @param beanIdentifier the Spring bean ID for this bean 254 */ 255 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 256 getService().setBeanIdentifier(beanIdentifier); 257 } 258 259 /** 260 * Adds the user groups to the group. 261 * 262 * @param groupId the primary key of the group 263 * @param userGroupIds the primary keys of the user groups 264 * @throws SystemException if a system exception occurred 265 */ 266 public static void addGroupUserGroups(long groupId, long[] userGroupIds) 267 throws com.liferay.portal.kernel.exception.SystemException { 268 getService().addGroupUserGroups(groupId, userGroupIds); 269 } 270 271 /** 272 * Adds the user groups to the team. 273 * 274 * @param teamId the primary key of the team 275 * @param userGroupIds the primary keys of the user groups 276 * @throws SystemException if a system exception occurred 277 */ 278 public static void addTeamUserGroups(long teamId, long[] userGroupIds) 279 throws com.liferay.portal.kernel.exception.SystemException { 280 getService().addTeamUserGroups(teamId, userGroupIds); 281 } 282 283 /** 284 * Adds a user group. 285 * 286 * <p> 287 * This method handles the creation and bookkeeping of the user group, 288 * including its resources, metadata, and internal data structures. It is 289 * not necessary to make subsequent calls to setup default groups and 290 * resources for the user group. 291 * </p> 292 * 293 * @param userId the primary key of the user 294 * @param companyId the primary key of the user group's company 295 * @param name the user group's name 296 * @param description the user group's description 297 * @param publicLayoutSetPrototypeId the primary key of the user group's 298 public layout set 299 * @param privateLayoutSetPrototypeId the primary key of the user group's 300 private layout set 301 * @return the user group 302 * @throws PortalException if the user group's information was invalid 303 * @throws SystemException if a system exception occurred 304 */ 305 public static com.liferay.portal.model.UserGroup addUserGroup(long userId, 306 long companyId, java.lang.String name, java.lang.String description, 307 long publicLayoutSetPrototypeId, long privateLayoutSetPrototypeId) 308 throws com.liferay.portal.kernel.exception.PortalException, 309 com.liferay.portal.kernel.exception.SystemException { 310 return getService() 311 .addUserGroup(userId, companyId, name, description, 312 publicLayoutSetPrototypeId, privateLayoutSetPrototypeId); 313 } 314 315 /** 316 * Clears all associations between the user and its user groups and clears 317 * the permissions cache. 318 * 319 * <p> 320 * This method is called from {@link #deleteUserGroup(UserGroup)}. 321 * </p> 322 * 323 * @param userId the primary key of the user 324 * @throws SystemException if a system exception occurred 325 */ 326 public static void clearUserUserGroups(long userId) 327 throws com.liferay.portal.kernel.exception.SystemException { 328 getService().clearUserUserGroups(userId); 329 } 330 331 /** 332 * Copies the user group's layouts to the users who are not already members 333 * of the user group. 334 * 335 * @param userGroupId the primary key of the user group 336 * @param userIds the primary keys of the users 337 * @throws PortalException if any one of the users could not be found or if 338 a portal exception occurred 339 * @throws SystemException if a system exception occurred 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 */ 356 public static void copyUserGroupLayouts(long[] userGroupIds, long userId) 357 throws com.liferay.portal.kernel.exception.PortalException, 358 com.liferay.portal.kernel.exception.SystemException { 359 getService().copyUserGroupLayouts(userGroupIds, userId); 360 } 361 362 /** 363 * Copies the user group's layout to the user. 364 * 365 * @param userGroupId the primary key of the user group 366 * @param userId the primary key of the user 367 * @throws PortalException if a user with the primary key could not be 368 found or if a portal exception occurred 369 * @throws SystemException if a system exception occurred 370 */ 371 public static void copyUserGroupLayouts(long userGroupId, long userId) 372 throws com.liferay.portal.kernel.exception.PortalException, 373 com.liferay.portal.kernel.exception.SystemException { 374 getService().copyUserGroupLayouts(userGroupId, userId); 375 } 376 377 /** 378 * Returns the user group with the name. 379 * 380 * @param companyId the primary key of the user group's company 381 * @param name the user group's name 382 * @return Returns the user group with the name 383 * @throws PortalException if a user group with the name could not be found 384 * @throws SystemException if a system exception occurred 385 */ 386 public static com.liferay.portal.model.UserGroup getUserGroup( 387 long companyId, java.lang.String name) 388 throws com.liferay.portal.kernel.exception.PortalException, 389 com.liferay.portal.kernel.exception.SystemException { 390 return getService().getUserGroup(companyId, name); 391 } 392 393 /** 394 * Returns all the user groups belonging to the company. 395 * 396 * @param companyId the primary key of the user groups' company 397 * @return the user groups belonging to the company 398 * @throws SystemException if a system exception occurred 399 */ 400 public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups( 401 long companyId) 402 throws com.liferay.portal.kernel.exception.SystemException { 403 return getService().getUserGroups(companyId); 404 } 405 406 /** 407 * Returns all the user groups with the primary keys. 408 * 409 * @param userGroupIds the primary keys of the user groups 410 * @return the user groups with the primary keys 411 * @throws PortalException if any one of the user groups could not be found 412 * @throws SystemException if a system exception occurred 413 */ 414 public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups( 415 long[] userGroupIds) 416 throws com.liferay.portal.kernel.exception.PortalException, 417 com.liferay.portal.kernel.exception.SystemException { 418 return getService().getUserGroups(userGroupIds); 419 } 420 421 /** 422 * Returns all the user groups to which the user belongs. 423 * 424 * @param userId the primary key of the user 425 * @return the user groups to which the user belongs 426 * @throws SystemException if a system exception occurred 427 */ 428 public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups( 429 long userId) throws com.liferay.portal.kernel.exception.SystemException { 430 return getService().getUserUserGroups(userId); 431 } 432 433 /** 434 * Returns <code>true</code> if the user group is associated with the 435 * group. 436 * 437 * @param groupId the primary key of the group 438 * @param userGroupId the primary key of the user group 439 * @return <code>true</code> if the user group belongs to the group; 440 <code>false</code> otherwise 441 * @throws SystemException if a system exception occurred 442 */ 443 public static boolean hasGroupUserGroup(long groupId, long userGroupId) 444 throws com.liferay.portal.kernel.exception.SystemException { 445 return getService().hasGroupUserGroup(groupId, userGroupId); 446 } 447 448 /** 449 * Returns <code>true</code> if the user group belongs to the team. 450 * 451 * @param teamId the primary key of the team 452 * @param userGroupId the primary key of the user group 453 * @return <code>true</code> if the user group belongs to the team; 454 <code>false</code> otherwise 455 * @throws SystemException if a system exception occurred 456 */ 457 public static boolean hasTeamUserGroup(long teamId, long userGroupId) 458 throws com.liferay.portal.kernel.exception.SystemException { 459 return getService().hasTeamUserGroup(teamId, userGroupId); 460 } 461 462 /** 463 * Returns an ordered range of all the user groups that match the name and 464 * description. 465 * 466 * <p> 467 * Useful when paginating results. Returns a maximum of <code>end - 468 * start</code> instances. <code>start</code> and <code>end</code> are not 469 * primary keys, they are indexes in the result set. Thus, <code>0</code> 470 * refers to the first result in the set. Setting both <code>start</code> 471 * and <code>end</code> to {@link 472 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 473 * full result set. 474 * </p> 475 * 476 * @param companyId the primary key of the user group's company 477 * @param name the user group's name (optionally <code>null</code>) 478 * @param description the user group's description (optionally 479 <code>null</code>) 480 * @param params the finder params (optionally <code>null</code>). For 481 more information see {@link 482 com.liferay.portal.service.persistence.UserGroupFinder} 483 * @param start the lower bound of the range of user groups to return 484 * @param end the upper bound of the range of user groups to return (not 485 inclusive) 486 * @param obc the comparator to order the user groups (optionally 487 <code>null</code>) 488 * @return the matching user groups ordered by comparator <code>obc</code> 489 * @throws SystemException if a system exception occurred 490 * @see com.liferay.portal.service.persistence.UserGroupFinder 491 */ 492 public static java.util.List<com.liferay.portal.model.UserGroup> search( 493 long companyId, java.lang.String name, java.lang.String description, 494 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params, 495 int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) 496 throws com.liferay.portal.kernel.exception.SystemException { 497 return getService() 498 .search(companyId, name, description, params, start, end, obc); 499 } 500 501 /** 502 * Returns the number of user groups that match the name and description. 503 * 504 * @param companyId the primary key of the user group's company 505 * @param name the user group's name (optionally <code>null</code>) 506 * @param description the user group's description (optionally 507 <code>null</code>) 508 * @param params the finder params (optionally <code>null</code>). For 509 more information see {@link 510 com.liferay.portal.service.persistence.UserGroupFinder} 511 * @return the number of matching user groups 512 * @throws SystemException if a system exception occurred 513 * @see com.liferay.portal.service.persistence.UserGroupFinder 514 */ 515 public static int searchCount(long companyId, java.lang.String name, 516 java.lang.String description, 517 java.util.LinkedHashMap<java.lang.String, java.lang.Object> params) 518 throws com.liferay.portal.kernel.exception.SystemException { 519 return getService().searchCount(companyId, name, description, params); 520 } 521 522 /** 523 * Sets the user groups associated with the user copying the user group 524 * layouts and removing and adding user group associations for the user as 525 * necessary. 526 * 527 * @param userId the primary key of the user 528 * @param userGroupIds the primary keys of the user groups 529 * @throws PortalException if a portal exception occurred 530 * @throws SystemException if a system exception occurred 531 */ 532 public static void setUserUserGroups(long userId, long[] userGroupIds) 533 throws com.liferay.portal.kernel.exception.PortalException, 534 com.liferay.portal.kernel.exception.SystemException { 535 getService().setUserUserGroups(userId, userGroupIds); 536 } 537 538 /** 539 * Removes the user groups from the group. 540 * 541 * @param groupId the primary key of the group 542 * @param userGroupIds the primary keys of the user groups 543 * @throws SystemException if a system exception occurred 544 */ 545 public static void unsetGroupUserGroups(long groupId, long[] userGroupIds) 546 throws com.liferay.portal.kernel.exception.SystemException { 547 getService().unsetGroupUserGroups(groupId, userGroupIds); 548 } 549 550 /** 551 * Removes the user groups from the team. 552 * 553 * @param teamId the primary key of the team 554 * @param userGroupIds the primary keys of the user groups 555 * @throws SystemException if a system exception occurred 556 */ 557 public static void unsetTeamUserGroups(long teamId, long[] userGroupIds) 558 throws com.liferay.portal.kernel.exception.SystemException { 559 getService().unsetTeamUserGroups(teamId, userGroupIds); 560 } 561 562 /** 563 * Updates the user group. 564 * 565 * @param companyId the primary key of the user group's company 566 * @param userGroupId the primary key of the user group 567 * @param name the user group's name 568 * @param description the user group's description 569 * @param publicLayoutSetPrototypeId the primary key of the user group's 570 public layout set 571 * @param privateLayoutSetPrototypeId the primary key of the user group's 572 private layout set 573 * @return the user group 574 * @throws PortalException if a user group with the primary key could not 575 be found or if the new information was invalid 576 * @throws SystemException if a system exception occurred 577 */ 578 public static com.liferay.portal.model.UserGroup updateUserGroup( 579 long companyId, long userGroupId, java.lang.String name, 580 java.lang.String description, long publicLayoutSetPrototypeId, 581 long privateLayoutSetPrototypeId) 582 throws com.liferay.portal.kernel.exception.PortalException, 583 com.liferay.portal.kernel.exception.SystemException { 584 return getService() 585 .updateUserGroup(companyId, userGroupId, name, description, 586 publicLayoutSetPrototypeId, privateLayoutSetPrototypeId); 587 } 588 589 public static UserGroupLocalService getService() { 590 if (_service == null) { 591 _service = (UserGroupLocalService)PortalBeanLocatorUtil.locate(UserGroupLocalService.class.getName()); 592 593 ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class, 594 "_service"); 595 MethodCache.remove(UserGroupLocalService.class); 596 } 597 598 return _service; 599 } 600 601 public void setService(UserGroupLocalService service) { 602 MethodCache.remove(UserGroupLocalService.class); 603 604 _service = service; 605 606 ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class, 607 "_service"); 608 MethodCache.remove(UserGroupLocalService.class); 609 } 610 611 private static UserGroupLocalService _service; 612 }