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