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