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