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 /** 270 * Returns a range of all the inverse relations of the given type for which 271 * the user is User2 of the relation. 272 * 273 * <p> 274 * Useful when paginating results. Returns a maximum of <code>end - 275 * start</code> instances. <code>start</code> and <code>end</code> are not 276 * primary keys, they are indexes in the result set. Thus, <code>0</code> 277 * refers to the first result in the set. Setting both <code>start</code> 278 * and <code>end</code> to {@link 279 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 280 * result set. 281 * </p> 282 * 283 * @param userId the primary key of the user 284 * @param type the relation's type 285 * @param start the lower bound of the range of results 286 * @param end the upper bound of the range of results (not inclusive) 287 * @return the range of matching relations 288 */ 289 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getInverseRelations( 290 long userId, int type, int start, int end) { 291 return getService().getInverseRelations(userId, type, start, end); 292 } 293 294 /** 295 * Returns the number of inverse relations of the given type for which the 296 * user is User2 of the relation. 297 * 298 * @param userId the primary key of the user 299 * @param type the relation's type 300 * @return the number of matching relations 301 */ 302 public static int getInverseRelationsCount(long userId, int type) { 303 return getService().getInverseRelationsCount(userId, type); 304 } 305 306 /** 307 * Returns the OSGi service identifier. 308 * 309 * @return the OSGi service identifier 310 */ 311 public static java.lang.String getOSGiServiceIdentifier() { 312 return getService().getOSGiServiceIdentifier(); 313 } 314 315 public static com.liferay.portal.model.PersistedModel getPersistedModel( 316 java.io.Serializable primaryKeyObj) 317 throws com.liferay.portal.kernel.exception.PortalException { 318 return getService().getPersistedModel(primaryKeyObj); 319 } 320 321 /** 322 * Returns the relation identified by its primary key. 323 * 324 * @param relationId the primary key of the relation 325 * @return Returns the relation 326 */ 327 public static com.liferay.portlet.social.model.SocialRelation getRelation( 328 long relationId) 329 throws com.liferay.portal.kernel.exception.PortalException { 330 return getService().getRelation(relationId); 331 } 332 333 /** 334 * Returns the relation of the given type between User1 and User2. 335 * 336 * @param userId1 the user that is the subject of the relation 337 * @param userId2 the user at the other end of the relation 338 * @param type the relation's type 339 * @return Returns the relation 340 */ 341 public static com.liferay.portlet.social.model.SocialRelation getRelation( 342 long userId1, long userId2, int type) 343 throws com.liferay.portal.kernel.exception.PortalException { 344 return getService().getRelation(userId1, userId2, type); 345 } 346 347 /** 348 * Returns a range of all the relations of the given type where the user is 349 * the subject of the relation. 350 * 351 * <p> 352 * Useful when paginating results. Returns a maximum of <code>end - 353 * start</code> instances. <code>start</code> and <code>end</code> are not 354 * primary keys, they are indexes in the result set. Thus, <code>0</code> 355 * refers to the first result in the set. Setting both <code>start</code> 356 * and <code>end</code> to {@link 357 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 358 * result set. 359 * </p> 360 * 361 * @param userId the primary key of the user 362 * @param type the relation's type 363 * @param start the lower bound of the range of results 364 * @param end the upper bound of the range of results (not inclusive) 365 * @return the range of relations 366 */ 367 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 368 long userId, int type, int start, int end) { 369 return getService().getRelations(userId, type, start, end); 370 } 371 372 /** 373 * Returns a range of all the relations between User1 and User2. 374 * 375 * <p> 376 * Useful when paginating results. Returns a maximum of <code>end - 377 * start</code> instances. <code>start</code> and <code>end</code> are not 378 * primary keys, they are indexes in the result set. Thus, <code>0</code> 379 * refers to the first result in the set. Setting both <code>start</code> 380 * and <code>end</code> to {@link 381 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 382 * result set. 383 * </p> 384 * 385 * @param userId1 the user that is the subject of the relation 386 * @param userId2 the user at the other end of the relation 387 * @param start the lower bound of the range of results 388 * @param end the upper bound of the range of results (not inclusive) 389 * @return the range of relations 390 */ 391 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 392 long userId1, long userId2, int start, int end) { 393 return getService().getRelations(userId1, userId2, start, end); 394 } 395 396 /** 397 * Returns the number of relations of the given type where the user is the 398 * subject of the relation. 399 * 400 * @param userId the primary key of the user 401 * @param type the relation's type 402 * @return the number of relations 403 */ 404 public static int getRelationsCount(long userId, int type) { 405 return getService().getRelationsCount(userId, type); 406 } 407 408 /** 409 * Returns the number of relations between User1 and User2. 410 * 411 * @param userId1 the user that is the subject of the relation 412 * @param userId2 the user at the other end of the relation 413 * @return the number of relations 414 */ 415 public static int getRelationsCount(long userId1, long userId2) { 416 return getService().getRelationsCount(userId1, userId2); 417 } 418 419 /** 420 * Returns the social relation with the primary key. 421 * 422 * @param relationId the primary key of the social relation 423 * @return the social relation 424 * @throws PortalException if a social relation with the primary key could not be found 425 */ 426 public static com.liferay.portlet.social.model.SocialRelation getSocialRelation( 427 long relationId) 428 throws com.liferay.portal.kernel.exception.PortalException { 429 return getService().getSocialRelation(relationId); 430 } 431 432 /** 433 * Returns the social relation with the matching UUID and company. 434 * 435 * @param uuid the social relation's UUID 436 * @param companyId the primary key of the company 437 * @return the matching social relation 438 * @throws PortalException if a matching social relation could not be found 439 */ 440 public static com.liferay.portlet.social.model.SocialRelation getSocialRelationByUuidAndCompanyId( 441 java.lang.String uuid, long companyId) 442 throws com.liferay.portal.kernel.exception.PortalException { 443 return getService().getSocialRelationByUuidAndCompanyId(uuid, companyId); 444 } 445 446 /** 447 * Returns a range of all the social relations. 448 * 449 * <p> 450 * 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. 451 * </p> 452 * 453 * @param start the lower bound of the range of social relations 454 * @param end the upper bound of the range of social relations (not inclusive) 455 * @return the range of social relations 456 */ 457 public static java.util.List<com.liferay.portlet.social.model.SocialRelation> getSocialRelations( 458 int start, int end) { 459 return getService().getSocialRelations(start, end); 460 } 461 462 /** 463 * Returns the number of social relations. 464 * 465 * @return the number of social relations 466 */ 467 public static int getSocialRelationsCount() { 468 return getService().getSocialRelationsCount(); 469 } 470 471 /** 472 * Returns <code>true</code> if a relation of the given type exists where 473 * the user with primary key <code>userId1</code> is User1 of the relation 474 * and the user with the primary key <code>userId2</code> is User2 of the 475 * relation. 476 * 477 * @param userId1 the user that is the subject of the relation 478 * @param userId2 the user at the other end of the relation 479 * @param type the relation's type 480 * @return <code>true</code> if the relation exists; <code>false</code> 481 otherwise 482 */ 483 public static boolean hasRelation(long userId1, long userId2, int type) { 484 return getService().hasRelation(userId1, userId2, type); 485 } 486 487 /** 488 * Returns <code>true</code> if the users can be in a relation of the given 489 * type where the user with primary key <code>userId1</code> is User1 of the 490 * relation and the user with the primary key <code>userId2</code> is User2 491 * of the relation. 492 * 493 * <p> 494 * This method returns <code>false</code> if User1 and User2 are the same, 495 * if either user is the default user, or if a matching relation already 496 * exists. 497 * </p> 498 * 499 * @param userId1 the user that is the subject of the relation 500 * @param userId2 the user at the other end of the relation 501 * @param type the relation's type 502 * @return <code>true</code> if the two users can be in a new relation of 503 the given type; <code>false</code> otherwise 504 */ 505 public static boolean isRelatable(long userId1, long userId2, int type) { 506 return getService().isRelatable(userId1, userId2, type); 507 } 508 509 /** 510 * Updates the social relation in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 511 * 512 * @param socialRelation the social relation 513 * @return the social relation that was updated 514 */ 515 public static com.liferay.portlet.social.model.SocialRelation updateSocialRelation( 516 com.liferay.portlet.social.model.SocialRelation socialRelation) { 517 return getService().updateSocialRelation(socialRelation); 518 } 519 520 public static SocialRelationLocalService getService() { 521 if (_service == null) { 522 _service = (SocialRelationLocalService)PortalBeanLocatorUtil.locate(SocialRelationLocalService.class.getName()); 523 524 ReferenceRegistry.registerReference(SocialRelationLocalServiceUtil.class, 525 "_service"); 526 } 527 528 return _service; 529 } 530 531 /** 532 * @deprecated As of 6.2.0 533 */ 534 @Deprecated 535 public void setService(SocialRelationLocalService service) { 536 } 537 538 private static SocialRelationLocalService _service; 539 }