001 /** 002 * Copyright (c) 2000-present Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.portlet.social.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 020 import com.liferay.portal.kernel.util.ReferenceRegistry; 021 022 /** 023 * Provides the local service utility for SocialRelation. This utility wraps 024 * {@link com.liferay.portlet.social.service.impl.SocialRelationLocalServiceImpl} and is the 025 * primary access point for service operations in application layer code running 026 * on the local server. Methods of this service will not have security checks 027 * based on the propagated JAAS credentials because this service can only be 028 * accessed from within the same VM. 029 * 030 * @author Brian Wing Shun Chan 031 * @see SocialRelationLocalService 032 * @see com.liferay.portlet.social.service.base.SocialRelationLocalServiceBaseImpl 033 * @see com.liferay.portlet.social.service.impl.SocialRelationLocalServiceImpl 034 * @generated 035 */ 036 @ProviderType 037 public class SocialRelationLocalServiceUtil { 038 /* 039 * NOTE FOR DEVELOPERS: 040 * 041 * 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. 042 */ 043 044 /** 045 * Adds a social relation between the two users to the database. 046 * 047 * @param userId1 the user that is the subject of the relation 048 * @param userId2 the user at the other end of the relation 049 * @param type the type of the relation 050 * @return the social relation 051 */ 052 public static com.liferay.portlet.social.model.SocialRelation addRelation( 053 long userId1, long userId2, int type) 054 throws com.liferay.portal.kernel.exception.PortalException { 055 return getService().addRelation(userId1, userId2, type); 056 } 057 058 /** 059 * Adds the social relation to the database. Also notifies the appropriate model listeners. 060 * 061 * @param socialRelation the social relation 062 * @return the social relation that was added 063 */ 064 public static com.liferay.portlet.social.model.SocialRelation addSocialRelation( 065 com.liferay.portlet.social.model.SocialRelation socialRelation) { 066 return getService().addSocialRelation(socialRelation); 067 } 068 069 /** 070 * Creates a new social relation with the primary key. Does not add the social relation to the database. 071 * 072 * @param relationId the primary key for the new social relation 073 * @return the new social relation 074 */ 075 public static com.liferay.portlet.social.model.SocialRelation createSocialRelation( 076 long relationId) { 077 return getService().createSocialRelation(relationId); 078 } 079 080 /** 081 * @throws PortalException 082 */ 083 public static com.liferay.portal.model.PersistedModel deletePersistedModel( 084 com.liferay.portal.model.PersistedModel persistedModel) 085 throws com.liferay.portal.kernel.exception.PortalException { 086 return getService().deletePersistedModel(persistedModel); 087 } 088 089 /** 090 * Removes the relation (and its inverse in case of a bidirectional 091 * relation) from the database. 092 * 093 * @param relation the relation to be removed 094 */ 095 public static void deleteRelation( 096 com.liferay.portlet.social.model.SocialRelation relation) 097 throws com.liferay.portal.kernel.exception.PortalException { 098 getService().deleteRelation(relation); 099 } 100 101 /** 102 * Removes the relation (and its inverse in case of a bidirectional 103 * relation) from the database. 104 * 105 * @param relationId the primary key of the relation 106 */ 107 public static void deleteRelation(long relationId) 108 throws com.liferay.portal.kernel.exception.PortalException { 109 getService().deleteRelation(relationId); 110 } 111 112 /** 113 * Removes the matching relation (and its inverse in case of a bidirectional 114 * relation) from the database. 115 * 116 * @param userId1 the user that is the subject of the relation 117 * @param userId2 the user at the other end of the relation 118 * @param type the relation's type 119 */ 120 public static void deleteRelation(long userId1, long userId2, int type) 121 throws com.liferay.portal.kernel.exception.PortalException { 122 getService().deleteRelation(userId1, userId2, type); 123 } 124 125 /** 126 * Removes all relations involving the user from the database. 127 * 128 * @param userId the primary key of the user 129 */ 130 public static void deleteRelations(long userId) { 131 getService().deleteRelations(userId); 132 } 133 134 /** 135 * Removes all relations between User1 and User2. 136 * 137 * @param userId1 the user that is the subject of the relation 138 * @param userId2 the user at the other end of the relation 139 */ 140 public static void deleteRelations(long userId1, long userId2) 141 throws com.liferay.portal.kernel.exception.PortalException { 142 getService().deleteRelations(userId1, userId2); 143 } 144 145 /** 146 * Deletes the social relation with the primary key from the database. Also notifies the appropriate model listeners. 147 * 148 * @param relationId the primary key of the social relation 149 * @return the social relation that was removed 150 * @throws PortalException if a social relation with the primary key could not be found 151 */ 152 public static com.liferay.portlet.social.model.SocialRelation deleteSocialRelation( 153 long relationId) 154 throws com.liferay.portal.kernel.exception.PortalException { 155 return getService().deleteSocialRelation(relationId); 156 } 157 158 /** 159 * Deletes the social relation from the database. Also notifies the appropriate model listeners. 160 * 161 * @param socialRelation the social relation 162 * @return the social relation that was removed 163 */ 164 public static com.liferay.portlet.social.model.SocialRelation deleteSocialRelation( 165 com.liferay.portlet.social.model.SocialRelation socialRelation) { 166 return getService().deleteSocialRelation(socialRelation); 167 } 168 169 public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { 170 return getService().dynamicQuery(); 171 } 172 173 /** 174 * Performs a dynamic query on the database and returns the matching rows. 175 * 176 * @param dynamicQuery the dynamic query 177 * @return the matching rows 178 */ 179 public static <T> java.util.List<T> dynamicQuery( 180 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 181 return getService().dynamicQuery(dynamicQuery); 182 } 183 184 /** 185 * Performs a dynamic query on the database and returns a range of the matching rows. 186 * 187 * <p> 188 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialRelationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 189 * </p> 190 * 191 * @param dynamicQuery the dynamic query 192 * @param start the lower bound of the range of model instances 193 * @param end the upper bound of the range of model instances (not inclusive) 194 * @return the range of matching rows 195 */ 196 public static <T> java.util.List<T> dynamicQuery( 197 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 198 int end) { 199 return getService().dynamicQuery(dynamicQuery, start, end); 200 } 201 202 /** 203 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 204 * 205 * <p> 206 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialRelationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 207 * </p> 208 * 209 * @param dynamicQuery the dynamic query 210 * @param start the lower bound of the range of model instances 211 * @param end the upper bound of the range of model instances (not inclusive) 212 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 213 * @return the ordered range of matching rows 214 */ 215 public static <T> java.util.List<T> dynamicQuery( 216 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 217 int end, 218 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator) { 219 return getService() 220 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 221 } 222 223 /** 224 * Returns the number of rows matching the dynamic query. 225 * 226 * @param dynamicQuery the dynamic query 227 * @return the number of rows matching the dynamic query 228 */ 229 public static long dynamicQueryCount( 230 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 231 return getService().dynamicQueryCount(dynamicQuery); 232 } 233 234 /** 235 * Returns the number of rows matching the dynamic query. 236 * 237 * @param dynamicQuery the dynamic query 238 * @param projection the projection to apply to the query 239 * @return the number of rows matching the dynamic query 240 */ 241 public static long dynamicQueryCount( 242 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 243 com.liferay.portal.kernel.dao.orm.Projection projection) { 244 return getService().dynamicQueryCount(dynamicQuery, projection); 245 } 246 247 public static com.liferay.portlet.social.model.SocialRelation fetchSocialRelation( 248 long relationId) { 249 return getService().fetchSocialRelation(relationId); 250 } 251 252 /** 253 * Returns the social relation with the matching UUID and company. 254 * 255 * @param uuid the social relation's UUID 256 * @param companyId the primary key of the company 257 * @return the matching social relation, or <code>null</code> if a matching social relation could not be found 258 */ 259 public static com.liferay.portlet.social.model.SocialRelation fetchSocialRelationByUuidAndCompanyId( 260 java.lang.String uuid, long companyId) { 261 return getService() 262 .fetchSocialRelationByUuidAndCompanyId(uuid, companyId); 263 } 264 265 public static com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery() { 266 return getService().getActionableDynamicQuery(); 267 } 268 269 public static com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() { 270 return getService().getIndexableActionableDynamicQuery(); 271 } 272 273 /** 274 * Returns a range of all the inverse relations of the given type for which 275 * the user is User2 of the relation. 276 * 277 * <p> 278 * Useful when paginating results. Returns a maximum of <code>end - 279 * start</code> instances. <code>start</code> and <code>end</code> are not 280 * primary keys, they are indexes in the result set. Thus, <code>0</code> 281 * refers to the first result in the set. Setting both <code>start</code> 282 * and <code>end</code> to {@link 283 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 284 * result set. 285 * </p> 286 * 287 * @param userId the primary key of the user 288 * @param type the relation's type 289 * @param start the lower bound of the range of results 290 * @param end the upper bound of the range of results (not inclusive) 291 * @return the range of matching relations 292 */ 293 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getInverseRelations( 294 long userId, int type, int start, int end) { 295 return getService().getInverseRelations(userId, type, start, end); 296 } 297 298 /** 299 * Returns the number of inverse relations of the given type for which the 300 * user is User2 of the relation. 301 * 302 * @param userId the primary key of the user 303 * @param type the relation's type 304 * @return the number of matching relations 305 */ 306 public static int getInverseRelationsCount(long userId, int type) { 307 return getService().getInverseRelationsCount(userId, type); 308 } 309 310 /** 311 * Returns the OSGi service identifier. 312 * 313 * @return the OSGi service identifier 314 */ 315 public static java.lang.String getOSGiServiceIdentifier() { 316 return getService().getOSGiServiceIdentifier(); 317 } 318 319 public static com.liferay.portal.model.PersistedModel getPersistedModel( 320 java.io.Serializable primaryKeyObj) 321 throws com.liferay.portal.kernel.exception.PortalException { 322 return getService().getPersistedModel(primaryKeyObj); 323 } 324 325 /** 326 * Returns the relation identified by its primary key. 327 * 328 * @param relationId the primary key of the relation 329 * @return Returns the relation 330 */ 331 public static com.liferay.portlet.social.model.SocialRelation getRelation( 332 long relationId) 333 throws com.liferay.portal.kernel.exception.PortalException { 334 return getService().getRelation(relationId); 335 } 336 337 /** 338 * Returns the relation of the given type between User1 and User2. 339 * 340 * @param userId1 the user that is the subject of the relation 341 * @param userId2 the user at the other end of the relation 342 * @param type the relation's type 343 * @return Returns the relation 344 */ 345 public static com.liferay.portlet.social.model.SocialRelation getRelation( 346 long userId1, long userId2, int type) 347 throws com.liferay.portal.kernel.exception.PortalException { 348 return getService().getRelation(userId1, userId2, type); 349 } 350 351 /** 352 * Returns a range of all the relations of the given type where the user is 353 * the subject of the relation. 354 * 355 * <p> 356 * Useful when paginating results. Returns a maximum of <code>end - 357 * start</code> instances. <code>start</code> and <code>end</code> are not 358 * primary keys, they are indexes in the result set. Thus, <code>0</code> 359 * refers to the first result in the set. Setting both <code>start</code> 360 * and <code>end</code> to {@link 361 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 362 * result set. 363 * </p> 364 * 365 * @param userId the primary key of the user 366 * @param type the relation's type 367 * @param start the lower bound of the range of results 368 * @param end the upper bound of the range of results (not inclusive) 369 * @return the range of relations 370 */ 371 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 372 long userId, int type, int start, int end) { 373 return getService().getRelations(userId, type, start, end); 374 } 375 376 /** 377 * Returns a range of all the relations between User1 and User2. 378 * 379 * <p> 380 * Useful when paginating results. Returns a maximum of <code>end - 381 * start</code> instances. <code>start</code> and <code>end</code> are not 382 * primary keys, they are indexes in the result set. Thus, <code>0</code> 383 * refers to the first result in the set. Setting both <code>start</code> 384 * and <code>end</code> to {@link 385 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 386 * result set. 387 * </p> 388 * 389 * @param userId1 the user that is the subject of the relation 390 * @param userId2 the user at the other end of the relation 391 * @param start the lower bound of the range of results 392 * @param end the upper bound of the range of results (not inclusive) 393 * @return the range of relations 394 */ 395 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 396 long userId1, long userId2, int start, int end) { 397 return getService().getRelations(userId1, userId2, start, end); 398 } 399 400 /** 401 * Returns the number of relations of the given type where the user is the 402 * subject of the relation. 403 * 404 * @param userId the primary key of the user 405 * @param type the relation's type 406 * @return the number of relations 407 */ 408 public static int getRelationsCount(long userId, int type) { 409 return getService().getRelationsCount(userId, type); 410 } 411 412 /** 413 * Returns the number of relations between User1 and User2. 414 * 415 * @param userId1 the user that is the subject of the relation 416 * @param userId2 the user at the other end of the relation 417 * @return the number of relations 418 */ 419 public static int getRelationsCount(long userId1, long userId2) { 420 return getService().getRelationsCount(userId1, userId2); 421 } 422 423 /** 424 * Returns the social relation with the primary key. 425 * 426 * @param relationId the primary key of the social relation 427 * @return the social relation 428 * @throws PortalException if a social relation with the primary key could not be found 429 */ 430 public static com.liferay.portlet.social.model.SocialRelation getSocialRelation( 431 long relationId) 432 throws com.liferay.portal.kernel.exception.PortalException { 433 return getService().getSocialRelation(relationId); 434 } 435 436 /** 437 * Returns the social relation with the matching UUID and company. 438 * 439 * @param uuid the social relation's UUID 440 * @param companyId the primary key of the company 441 * @return the matching social relation 442 * @throws PortalException if a matching social relation could not be found 443 */ 444 public static com.liferay.portlet.social.model.SocialRelation getSocialRelationByUuidAndCompanyId( 445 java.lang.String uuid, long companyId) 446 throws com.liferay.portal.kernel.exception.PortalException { 447 return getService().getSocialRelationByUuidAndCompanyId(uuid, companyId); 448 } 449 450 /** 451 * Returns a range of all the social relations. 452 * 453 * <p> 454 * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.social.model.impl.SocialRelationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 455 * </p> 456 * 457 * @param start the lower bound of the range of social relations 458 * @param end the upper bound of the range of social relations (not inclusive) 459 * @return the range of social relations 460 */ 461 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getSocialRelations( 462 int start, int end) { 463 return getService().getSocialRelations(start, end); 464 } 465 466 /** 467 * Returns the number of social relations. 468 * 469 * @return the number of social relations 470 */ 471 public static int getSocialRelationsCount() { 472 return getService().getSocialRelationsCount(); 473 } 474 475 /** 476 * Returns <code>true</code> if a relation of the given type exists where 477 * the user with primary key <code>userId1</code> is User1 of the relation 478 * and the user with the primary key <code>userId2</code> is User2 of the 479 * relation. 480 * 481 * @param userId1 the user that is the subject of the relation 482 * @param userId2 the user at the other end of the relation 483 * @param type the relation's type 484 * @return <code>true</code> if the relation exists; <code>false</code> 485 otherwise 486 */ 487 public static boolean hasRelation(long userId1, long userId2, int type) { 488 return getService().hasRelation(userId1, userId2, type); 489 } 490 491 /** 492 * Returns <code>true</code> if the users can be in a relation of the given 493 * type where the user with primary key <code>userId1</code> is User1 of the 494 * relation and the user with the primary key <code>userId2</code> is User2 495 * of the relation. 496 * 497 * <p> 498 * This method returns <code>false</code> if User1 and User2 are the same, 499 * if either user is the default user, or if a matching relation already 500 * exists. 501 * </p> 502 * 503 * @param userId1 the user that is the subject of the relation 504 * @param userId2 the user at the other end of the relation 505 * @param type the relation's type 506 * @return <code>true</code> if the two users can be in a new relation of 507 the given type; <code>false</code> otherwise 508 */ 509 public static boolean isRelatable(long userId1, long userId2, int type) { 510 return getService().isRelatable(userId1, userId2, type); 511 } 512 513 /** 514 * Updates the social relation in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 515 * 516 * @param socialRelation the social relation 517 * @return the social relation that was updated 518 */ 519 public static com.liferay.portlet.social.model.SocialRelation updateSocialRelation( 520 com.liferay.portlet.social.model.SocialRelation socialRelation) { 521 return getService().updateSocialRelation(socialRelation); 522 } 523 524 public static SocialRelationLocalService getService() { 525 if (_service == null) { 526 _service = (SocialRelationLocalService)PortalBeanLocatorUtil.locate(SocialRelationLocalService.class.getName()); 527 528 ReferenceRegistry.registerReference(SocialRelationLocalServiceUtil.class, 529 "_service"); 530 } 531 532 return _service; 533 } 534 535 private static SocialRelationLocalService _service; 536 }