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