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.portlet.social.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 social relation local service. This utility wraps {@link com.liferay.portlet.social.service.impl.SocialRelationLocalServiceImpl} 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 SocialRelationLocalService 030 * @see com.liferay.portlet.social.service.base.SocialRelationLocalServiceBaseImpl 031 * @see com.liferay.portlet.social.service.impl.SocialRelationLocalServiceImpl 032 * @generated 033 */ 034 public class SocialRelationLocalServiceUtil { 035 /* 036 * NOTE FOR DEVELOPERS: 037 * 038 * Never modify this class directly. Add custom service methods to {@link com.liferay.portlet.social.service.impl.SocialRelationLocalServiceImpl} and rerun ServiceBuilder to regenerate this class. 039 */ 040 041 /** 042 * Adds the social relation to the database. Also notifies the appropriate model listeners. 043 * 044 * @param socialRelation the social relation 045 * @return the social relation that was added 046 * @throws SystemException if a system exception occurred 047 */ 048 public static com.liferay.portlet.social.model.SocialRelation addSocialRelation( 049 com.liferay.portlet.social.model.SocialRelation socialRelation) 050 throws com.liferay.portal.kernel.exception.SystemException { 051 return getService().addSocialRelation(socialRelation); 052 } 053 054 /** 055 * Creates a new social relation with the primary key. Does not add the social relation to the database. 056 * 057 * @param relationId the primary key for the new social relation 058 * @return the new social relation 059 */ 060 public static com.liferay.portlet.social.model.SocialRelation createSocialRelation( 061 long relationId) { 062 return getService().createSocialRelation(relationId); 063 } 064 065 /** 066 * Deletes the social relation with the primary key from the database. Also notifies the appropriate model listeners. 067 * 068 * @param relationId the primary key of the social relation 069 * @throws PortalException if a social relation with the primary key could not be found 070 * @throws SystemException if a system exception occurred 071 */ 072 public static void deleteSocialRelation(long relationId) 073 throws com.liferay.portal.kernel.exception.PortalException, 074 com.liferay.portal.kernel.exception.SystemException { 075 getService().deleteSocialRelation(relationId); 076 } 077 078 /** 079 * Deletes the social relation from the database. Also notifies the appropriate model listeners. 080 * 081 * @param socialRelation the social relation 082 * @throws SystemException if a system exception occurred 083 */ 084 public static void deleteSocialRelation( 085 com.liferay.portlet.social.model.SocialRelation socialRelation) 086 throws com.liferay.portal.kernel.exception.SystemException { 087 getService().deleteSocialRelation(socialRelation); 088 } 089 090 /** 091 * Performs a dynamic query on the database and returns the matching rows. 092 * 093 * @param dynamicQuery the dynamic query 094 * @return the matching rows 095 * @throws SystemException if a system exception occurred 096 */ 097 @SuppressWarnings("rawtypes") 098 public static java.util.List dynamicQuery( 099 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 100 throws com.liferay.portal.kernel.exception.SystemException { 101 return getService().dynamicQuery(dynamicQuery); 102 } 103 104 /** 105 * Performs a dynamic query on the database and returns a range of the matching rows. 106 * 107 * <p> 108 * 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. 109 * </p> 110 * 111 * @param dynamicQuery the dynamic query 112 * @param start the lower bound of the range of model instances 113 * @param end the upper bound of the range of model instances (not inclusive) 114 * @return the range of matching rows 115 * @throws SystemException if a system exception occurred 116 */ 117 @SuppressWarnings("rawtypes") 118 public static java.util.List dynamicQuery( 119 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 120 int end) throws com.liferay.portal.kernel.exception.SystemException { 121 return getService().dynamicQuery(dynamicQuery, start, end); 122 } 123 124 /** 125 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 126 * 127 * <p> 128 * 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. 129 * </p> 130 * 131 * @param dynamicQuery the dynamic query 132 * @param start the lower bound of the range of model instances 133 * @param end the upper bound of the range of model instances (not inclusive) 134 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 135 * @return the ordered range of matching rows 136 * @throws SystemException if a system exception occurred 137 */ 138 @SuppressWarnings("rawtypes") 139 public static java.util.List dynamicQuery( 140 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 141 int end, 142 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 143 throws com.liferay.portal.kernel.exception.SystemException { 144 return getService() 145 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 146 } 147 148 /** 149 * Returns the number of rows that match the dynamic query. 150 * 151 * @param dynamicQuery the dynamic query 152 * @return the number of rows that match the dynamic query 153 * @throws SystemException if a system exception occurred 154 */ 155 public static long dynamicQueryCount( 156 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 157 throws com.liferay.portal.kernel.exception.SystemException { 158 return getService().dynamicQueryCount(dynamicQuery); 159 } 160 161 public static com.liferay.portlet.social.model.SocialRelation fetchSocialRelation( 162 long relationId) 163 throws com.liferay.portal.kernel.exception.SystemException { 164 return getService().fetchSocialRelation(relationId); 165 } 166 167 /** 168 * Returns the social relation with the primary key. 169 * 170 * @param relationId the primary key of the social relation 171 * @return the social relation 172 * @throws PortalException if a social relation with the primary key could not be found 173 * @throws SystemException if a system exception occurred 174 */ 175 public static com.liferay.portlet.social.model.SocialRelation getSocialRelation( 176 long relationId) 177 throws com.liferay.portal.kernel.exception.PortalException, 178 com.liferay.portal.kernel.exception.SystemException { 179 return getService().getSocialRelation(relationId); 180 } 181 182 public static com.liferay.portal.model.PersistedModel getPersistedModel( 183 java.io.Serializable primaryKeyObj) 184 throws com.liferay.portal.kernel.exception.PortalException, 185 com.liferay.portal.kernel.exception.SystemException { 186 return getService().getPersistedModel(primaryKeyObj); 187 } 188 189 /** 190 * Returns a range of all the social relations. 191 * 192 * <p> 193 * 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. 194 * </p> 195 * 196 * @param start the lower bound of the range of social relations 197 * @param end the upper bound of the range of social relations (not inclusive) 198 * @return the range of social relations 199 * @throws SystemException if a system exception occurred 200 */ 201 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getSocialRelations( 202 int start, int end) 203 throws com.liferay.portal.kernel.exception.SystemException { 204 return getService().getSocialRelations(start, end); 205 } 206 207 /** 208 * Returns the number of social relations. 209 * 210 * @return the number of social relations 211 * @throws SystemException if a system exception occurred 212 */ 213 public static int getSocialRelationsCount() 214 throws com.liferay.portal.kernel.exception.SystemException { 215 return getService().getSocialRelationsCount(); 216 } 217 218 /** 219 * Updates the social relation in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 220 * 221 * @param socialRelation the social relation 222 * @return the social relation that was updated 223 * @throws SystemException if a system exception occurred 224 */ 225 public static com.liferay.portlet.social.model.SocialRelation updateSocialRelation( 226 com.liferay.portlet.social.model.SocialRelation socialRelation) 227 throws com.liferay.portal.kernel.exception.SystemException { 228 return getService().updateSocialRelation(socialRelation); 229 } 230 231 /** 232 * Updates the social relation in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 233 * 234 * @param socialRelation the social relation 235 * @param merge whether to merge the social relation 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. 236 * @return the social relation that was updated 237 * @throws SystemException if a system exception occurred 238 */ 239 public static com.liferay.portlet.social.model.SocialRelation updateSocialRelation( 240 com.liferay.portlet.social.model.SocialRelation socialRelation, 241 boolean merge) 242 throws com.liferay.portal.kernel.exception.SystemException { 243 return getService().updateSocialRelation(socialRelation, merge); 244 } 245 246 /** 247 * Returns the Spring bean ID for this bean. 248 * 249 * @return the Spring bean ID for this bean 250 */ 251 public static java.lang.String getBeanIdentifier() { 252 return getService().getBeanIdentifier(); 253 } 254 255 /** 256 * Sets the Spring bean ID for this bean. 257 * 258 * @param beanIdentifier the Spring bean ID for this bean 259 */ 260 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 261 getService().setBeanIdentifier(beanIdentifier); 262 } 263 264 /** 265 * Adds a social relation between the two users to the database. 266 * 267 * @param userId1 the user that is the subject of the relation 268 * @param userId2 the user at the other end of the relation 269 * @param type the type of the relation 270 * @return the social relation 271 * @throws PortalException if the users could not be found, if the users 272 were not from the same company, or if either of the users was the 273 default user 274 * @throws SystemException if a system exception occurred 275 */ 276 public static com.liferay.portlet.social.model.SocialRelation addRelation( 277 long userId1, long userId2, int type) 278 throws com.liferay.portal.kernel.exception.PortalException, 279 com.liferay.portal.kernel.exception.SystemException { 280 return getService().addRelation(userId1, userId2, type); 281 } 282 283 /** 284 * Removes the relation (and its inverse in case of a bidirectional 285 * relation) from the database. 286 * 287 * @param relationId the primary key of the relation 288 * @throws PortalException if the relation could not be found 289 * @throws SystemException if a system exception occurred 290 */ 291 public static void deleteRelation(long relationId) 292 throws com.liferay.portal.kernel.exception.PortalException, 293 com.liferay.portal.kernel.exception.SystemException { 294 getService().deleteRelation(relationId); 295 } 296 297 /** 298 * Removes the matching relation (and its inverse in case of a bidirectional 299 * relation) from the database. 300 * 301 * @param userId1 the user that is the subject of the relation 302 * @param userId2 the user at the other end of the relation 303 * @param type the relation's type 304 * @throws PortalException if the relation or its inverse relation (if 305 applicable) could not be found 306 * @throws SystemException if a system exception occurred 307 */ 308 public static void deleteRelation(long userId1, long userId2, int type) 309 throws com.liferay.portal.kernel.exception.PortalException, 310 com.liferay.portal.kernel.exception.SystemException { 311 getService().deleteRelation(userId1, userId2, type); 312 } 313 314 /** 315 * Removes the relation (and its inverse in case of a bidirectional 316 * relation) from the database. 317 * 318 * @param relation the relation to be removed 319 * @throws PortalException if the relation is bidirectional and its inverse 320 relation could not be found 321 * @throws SystemException if a system exception occurred 322 */ 323 public static void deleteRelation( 324 com.liferay.portlet.social.model.SocialRelation relation) 325 throws com.liferay.portal.kernel.exception.PortalException, 326 com.liferay.portal.kernel.exception.SystemException { 327 getService().deleteRelation(relation); 328 } 329 330 /** 331 * Removes all relations involving the user from the database. 332 * 333 * @param userId the primary key of the user 334 * @throws SystemException if a system exception occurred 335 */ 336 public static void deleteRelations(long userId) 337 throws com.liferay.portal.kernel.exception.SystemException { 338 getService().deleteRelations(userId); 339 } 340 341 /** 342 * Removes all relations between User1 and User2. 343 * 344 * @param userId1 the user that is the subject of the relation 345 * @param userId2 the user at the other end of the relation 346 * @throws PortalException if the inverse relation could not be found 347 * @throws SystemException if a system exception occurred 348 */ 349 public static void deleteRelations(long userId1, long userId2) 350 throws com.liferay.portal.kernel.exception.PortalException, 351 com.liferay.portal.kernel.exception.SystemException { 352 getService().deleteRelations(userId1, userId2); 353 } 354 355 /** 356 * Returns a range of all the inverse relations of the given type for which 357 * the user is User2 of the relation. 358 * 359 * <p> 360 * Useful when paginating results. Returns a maximum of <code>end - 361 * start</code> instances. <code>start</code> and <code>end</code> are not 362 * primary keys, they are indexes in the result set. Thus, <code>0</code> 363 * refers to the first result in the set. Setting both <code>start</code> 364 * and <code>end</code> to {@link 365 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 366 * result set. 367 * </p> 368 * 369 * @param userId the primary key of the user 370 * @param type the relation's type 371 * @param start the lower bound of the range of results 372 * @param end the upper bound of the range of results (not inclusive) 373 * @return the range of matching relations 374 * @throws SystemException if a system exception occurred 375 */ 376 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getInverseRelations( 377 long userId, int type, int start, int end) 378 throws com.liferay.portal.kernel.exception.SystemException { 379 return getService().getInverseRelations(userId, type, start, end); 380 } 381 382 /** 383 * Returns the number of inverse relations of the given type for which the 384 * user is User2 of the relation. 385 * 386 * @param userId the primary key of the user 387 * @param type the relation's type 388 * @return the number of matching relations 389 * @throws SystemException if a system exception occurred 390 */ 391 public static int getInverseRelationsCount(long userId, int type) 392 throws com.liferay.portal.kernel.exception.SystemException { 393 return getService().getInverseRelationsCount(userId, type); 394 } 395 396 /** 397 * Returns the relation identified by its primary key. 398 * 399 * @param relationId the primary key of the relation 400 * @return Returns the relation 401 * @throws PortalException if the relation could not be found 402 * @throws SystemException if a system exception occurred 403 */ 404 public static com.liferay.portlet.social.model.SocialRelation getRelation( 405 long relationId) 406 throws com.liferay.portal.kernel.exception.PortalException, 407 com.liferay.portal.kernel.exception.SystemException { 408 return getService().getRelation(relationId); 409 } 410 411 /** 412 * Returns the relation of the given type between User1 and User2. 413 * 414 * @param userId1 the user that is the subject of the relation 415 * @param userId2 the user at the other end of the relation 416 * @param type the relation's type 417 * @return Returns the relation 418 * @throws PortalException if the relation could not be found 419 * @throws SystemException if a system exception occurred 420 */ 421 public static com.liferay.portlet.social.model.SocialRelation getRelation( 422 long userId1, long userId2, int type) 423 throws com.liferay.portal.kernel.exception.PortalException, 424 com.liferay.portal.kernel.exception.SystemException { 425 return getService().getRelation(userId1, userId2, type); 426 } 427 428 /** 429 * Returns a range of all the relations of the given type where the user is 430 * the subject of the relation. 431 * 432 * <p> 433 * Useful when paginating results. Returns a maximum of <code>end - 434 * start</code> instances. <code>start</code> and <code>end</code> are not 435 * primary keys, they are indexes in the result set. Thus, <code>0</code> 436 * refers to the first result in the set. Setting both <code>start</code> 437 * and <code>end</code> to {@link 438 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 439 * result set. 440 * </p> 441 * 442 * @param userId the primary key of the user 443 * @param type the relation's type 444 * @param start the lower bound of the range of results 445 * @param end the upper bound of the range of results (not inclusive) 446 * @return the range of relations 447 * @throws SystemException if a system exception occurred 448 */ 449 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 450 long userId, int type, int start, int end) 451 throws com.liferay.portal.kernel.exception.SystemException { 452 return getService().getRelations(userId, type, start, end); 453 } 454 455 /** 456 * Returns a range of all the relations between User1 and User2. 457 * 458 * <p> 459 * Useful when paginating results. Returns a maximum of <code>end - 460 * start</code> instances. <code>start</code> and <code>end</code> are not 461 * primary keys, they are indexes in the result set. Thus, <code>0</code> 462 * refers to the first result in the set. Setting both <code>start</code> 463 * and <code>end</code> to {@link 464 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 465 * result set. 466 * </p> 467 * 468 * @param userId1 the user that is the subject of the relation 469 * @param userId2 the user at the other end of the relation 470 * @param start the lower bound of the range of results 471 * @param end the upper bound of the range of results (not inclusive) 472 * @return the range of relations 473 * @throws SystemException if a system exception occurred 474 */ 475 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 476 long userId1, long userId2, int start, int end) 477 throws com.liferay.portal.kernel.exception.SystemException { 478 return getService().getRelations(userId1, userId2, start, end); 479 } 480 481 /** 482 * Returns the number of relations of the given type where the user is the 483 * subject of the relation. 484 * 485 * @param userId the primary key of the user 486 * @param type the relation's type 487 * @return the number of relations 488 * @throws SystemException if a system exception occurred 489 */ 490 public static int getRelationsCount(long userId, int type) 491 throws com.liferay.portal.kernel.exception.SystemException { 492 return getService().getRelationsCount(userId, type); 493 } 494 495 /** 496 * Returns the number of relations between User1 and User2. 497 * 498 * @param userId1 the user that is the subject of the relation 499 * @param userId2 the user at the other end of the relation 500 * @return the number of relations 501 * @throws SystemException if a system exception occurred 502 */ 503 public static int getRelationsCount(long userId1, long userId2) 504 throws com.liferay.portal.kernel.exception.SystemException { 505 return getService().getRelationsCount(userId1, userId2); 506 } 507 508 /** 509 * Returns <code>true</code> if a relation of the given type exists where 510 * the user with primary key <code>userId1</code> is User1 of the relation 511 * and the user with the primary key <code>userId2</code> is User2 of the 512 * relation. 513 * 514 * @param userId1 the user that is the subject of the relation 515 * @param userId2 the user at the other end of the relation 516 * @param type the relation's type 517 * @return <code>true</code> if the relation exists; <code>false</code> 518 otherwise 519 * @throws SystemException if a system exception occurred 520 */ 521 public static boolean hasRelation(long userId1, long userId2, int type) 522 throws com.liferay.portal.kernel.exception.SystemException { 523 return getService().hasRelation(userId1, userId2, type); 524 } 525 526 /** 527 * Returns <code>true</code> if the users can be in a relation of the given 528 * type where the user with primary key <code>userId1</code> is User1 of the 529 * relation and the user with the primary key <code>userId2</code> is User2 530 * of the relation. 531 * 532 * <p> 533 * This method returns <code>false</code> if User1 and User2 are the same, 534 * if either user is the default user, or if a matching relation already 535 * exists. 536 * </p> 537 * 538 * @param userId1 the user that is the subject of the relation 539 * @param userId2 the user at the other end of the relation 540 * @param type the relation's type 541 * @return <code>true</code> if the two users can be in a new relation of 542 the given type; <code>false</code> otherwise 543 * @throws SystemException if a system exception occurred 544 */ 545 public static boolean isRelatable(long userId1, long userId2, int type) 546 throws com.liferay.portal.kernel.exception.SystemException { 547 return getService().isRelatable(userId1, userId2, type); 548 } 549 550 public static SocialRelationLocalService getService() { 551 if (_service == null) { 552 _service = (SocialRelationLocalService)PortalBeanLocatorUtil.locate(SocialRelationLocalService.class.getName()); 553 554 ReferenceRegistry.registerReference(SocialRelationLocalServiceUtil.class, 555 "_service"); 556 MethodCache.remove(SocialRelationLocalService.class); 557 } 558 559 return _service; 560 } 561 562 public void setService(SocialRelationLocalService service) { 563 MethodCache.remove(SocialRelationLocalService.class); 564 565 _service = service; 566 567 ReferenceRegistry.registerReference(SocialRelationLocalServiceUtil.class, 568 "_service"); 569 MethodCache.remove(SocialRelationLocalService.class); 570 } 571 572 private static SocialRelationLocalService _service; 573 }