001 /** 002 * Copyright (c) 2000-2011 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 /** 150 * Returns the social relation with the primary key. 151 * 152 * @param relationId the primary key of the social relation 153 * @return the social relation 154 * @throws PortalException if a social relation with the primary key could not be found 155 * @throws SystemException if a system exception occurred 156 */ 157 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 158 public com.liferay.portlet.social.model.SocialRelation getSocialRelation( 159 long relationId) 160 throws com.liferay.portal.kernel.exception.PortalException, 161 com.liferay.portal.kernel.exception.SystemException; 162 163 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 164 public com.liferay.portal.model.PersistedModel getPersistedModel( 165 java.io.Serializable primaryKeyObj) 166 throws com.liferay.portal.kernel.exception.PortalException, 167 com.liferay.portal.kernel.exception.SystemException; 168 169 /** 170 * Returns a range of all the social relations. 171 * 172 * <p> 173 * 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. 174 * </p> 175 * 176 * @param start the lower bound of the range of social relations 177 * @param end the upper bound of the range of social relations (not inclusive) 178 * @return the range of social relations 179 * @throws SystemException if a system exception occurred 180 */ 181 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 182 public java.util.List<com.liferay.portlet.social.model.SocialRelation> getSocialRelations( 183 int start, int end) 184 throws com.liferay.portal.kernel.exception.SystemException; 185 186 /** 187 * Returns the number of social relations. 188 * 189 * @return the number of social relations 190 * @throws SystemException if a system exception occurred 191 */ 192 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 193 public int getSocialRelationsCount() 194 throws com.liferay.portal.kernel.exception.SystemException; 195 196 /** 197 * Updates the social relation in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 198 * 199 * @param socialRelation the social relation 200 * @return the social relation that was updated 201 * @throws SystemException if a system exception occurred 202 */ 203 public com.liferay.portlet.social.model.SocialRelation updateSocialRelation( 204 com.liferay.portlet.social.model.SocialRelation socialRelation) 205 throws com.liferay.portal.kernel.exception.SystemException; 206 207 /** 208 * Updates the social relation in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 209 * 210 * @param socialRelation the social relation 211 * @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. 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 boolean merge) 218 throws com.liferay.portal.kernel.exception.SystemException; 219 220 /** 221 * Returns the Spring bean ID for this bean. 222 * 223 * @return the Spring bean ID for this bean 224 */ 225 public java.lang.String getBeanIdentifier(); 226 227 /** 228 * Sets the Spring bean ID for this bean. 229 * 230 * @param beanIdentifier the Spring bean ID for this bean 231 */ 232 public void setBeanIdentifier(java.lang.String beanIdentifier); 233 234 /** 235 * Adds a social relation between the two users to the database. 236 * 237 * @param userId1 the user that is the subject of the relation 238 * @param userId2 the user at the other end of the relation 239 * @param type the type of the relation 240 * @return the social relation 241 * @throws PortalException if the users could not be found, if the users 242 were not from the same company, or if either of the users was 243 the default user 244 * @throws SystemException if a system exception occurred 245 */ 246 public com.liferay.portlet.social.model.SocialRelation addRelation( 247 long userId1, long userId2, int type) 248 throws com.liferay.portal.kernel.exception.PortalException, 249 com.liferay.portal.kernel.exception.SystemException; 250 251 /** 252 * Removes the relation (and its inverse in case of a bidirectional 253 * relation) from the database. 254 * 255 * @param relationId the primary key of the relation 256 * @throws PortalException if the relation could not be found 257 * @throws SystemException if a system exception occurred 258 */ 259 public void deleteRelation(long relationId) 260 throws com.liferay.portal.kernel.exception.PortalException, 261 com.liferay.portal.kernel.exception.SystemException; 262 263 /** 264 * Removes the matching relation (and its inverse in case of a 265 * bidirectional relation) from the database. 266 * 267 * @param userId1 the user that is the subject of the relation 268 * @param userId2 the user at the other end of the relation 269 * @param type the relation's type 270 * @throws PortalException if the relation or its inverse relation (if 271 applicable) could not be found 272 * @throws SystemException if a system exception occurred 273 */ 274 public void deleteRelation(long userId1, long userId2, int type) 275 throws com.liferay.portal.kernel.exception.PortalException, 276 com.liferay.portal.kernel.exception.SystemException; 277 278 /** 279 * Removes the relation (and its inverse in case of a bidirectional 280 * relation) from the database. 281 * 282 * @param relation the relation to be removed 283 * @throws PortalException if the relation is bidirectional and its inverse 284 relation could not be found 285 * @throws SystemException if a system exception occurred 286 */ 287 public void deleteRelation( 288 com.liferay.portlet.social.model.SocialRelation relation) 289 throws com.liferay.portal.kernel.exception.PortalException, 290 com.liferay.portal.kernel.exception.SystemException; 291 292 /** 293 * Removes all relations involving the user from the database. 294 * 295 * @param userId the primary key of the user 296 * @throws SystemException if a system exception occurred 297 */ 298 public void deleteRelations(long userId) 299 throws com.liferay.portal.kernel.exception.SystemException; 300 301 /** 302 * Removes all relations between User1 and User2. 303 * 304 * @param userId1 the user that is the subject of the relation 305 * @param userId2 the user at the other end of the relation 306 * @throws PortalException if the inverse relation could not be found 307 * @throws SystemException if a system exception occurred 308 */ 309 public void deleteRelations(long userId1, long userId2) 310 throws com.liferay.portal.kernel.exception.PortalException, 311 com.liferay.portal.kernel.exception.SystemException; 312 313 /** 314 * Returns a range of all the inverse relations of the given type for which 315 * the user is User2 of the relation. 316 * 317 * <p> 318 * Useful when paginating results. Returns a maximum of <code>end - 319 * start</code> instances. <code>start</code> and <code>end</code> are not 320 * primary keys, they are indexes in the result set. Thus, <code>0</code> 321 * refers to the first result in the set. Setting both <code>start</code> 322 * and <code>end</code> to {@link 323 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 324 * full result set. 325 * </p> 326 * 327 * @param userId the primary key of the user 328 * @param type the relation's type 329 * @param start the lower bound of the range of results 330 * @param end the upper bound of the range of results (not inclusive) 331 * @return the range of matching relations 332 * @throws SystemException if a system exception occurred 333 */ 334 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 335 public java.util.List<com.liferay.portlet.social.model.SocialRelation> getInverseRelations( 336 long userId, int type, int start, int end) 337 throws com.liferay.portal.kernel.exception.SystemException; 338 339 /** 340 * Returns the number of inverse relations of the given type for which the 341 * user is User2 of the relation. 342 * 343 * @param userId the primary key of the user 344 * @param type the relation's type 345 * @return the number of matching relations 346 * @throws SystemException if a system exception occurred 347 */ 348 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 349 public int getInverseRelationsCount(long userId, int type) 350 throws com.liferay.portal.kernel.exception.SystemException; 351 352 /** 353 * Returns the relation identified by its primary key. 354 * 355 * @param relationId the primary key of the relation 356 * @return Returns the relation 357 * @throws PortalException if the relation could not be found 358 * @throws SystemException if a system exception occurred 359 */ 360 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 361 public com.liferay.portlet.social.model.SocialRelation getRelation( 362 long relationId) 363 throws com.liferay.portal.kernel.exception.PortalException, 364 com.liferay.portal.kernel.exception.SystemException; 365 366 /** 367 * Returns the relation of the given type between User1 and User2. 368 * 369 * @param userId1 the user that is the subject of the relation 370 * @param userId2 the user at the other end of the relation 371 * @param type the relation's type 372 * @return Returns the relation 373 * @throws PortalException if the relation could not be found 374 * @throws SystemException if a system exception occurred 375 */ 376 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 377 public com.liferay.portlet.social.model.SocialRelation getRelation( 378 long userId1, long userId2, int type) 379 throws com.liferay.portal.kernel.exception.PortalException, 380 com.liferay.portal.kernel.exception.SystemException; 381 382 /** 383 * Returns a range of all the relations of the given type where the user is 384 * the subject of the relation. 385 * 386 * <p> 387 * Useful when paginating results. Returns a maximum of <code>end - 388 * start</code> instances. <code>start</code> and <code>end</code> are not 389 * primary keys, they are indexes in the result set. Thus, <code>0</code> 390 * refers to the first result in the set. Setting both <code>start</code> 391 * and <code>end</code> to {@link 392 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 393 * full result set. 394 * </p> 395 * 396 * @param userId the primary key of the user 397 * @param type the relation's type 398 * @param start the lower bound of the range of results 399 * @param end the upper bound of the range of results (not inclusive) 400 * @return the range of relations 401 * @throws SystemException if a system exception occurred 402 */ 403 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 404 public java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 405 long userId, int type, int start, int end) 406 throws com.liferay.portal.kernel.exception.SystemException; 407 408 /** 409 * Returns a range of all the relations between User1 and User2. 410 * 411 * <p> 412 * Useful when paginating results. Returns a maximum of <code>end - 413 * start</code> instances. <code>start</code> and <code>end</code> are not 414 * primary keys, they are indexes in the result set. Thus, <code>0</code> 415 * refers to the first result in the set. Setting both <code>start</code> 416 * and <code>end</code> to {@link 417 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 418 * full result set. 419 * </p> 420 * 421 * @param userId1 the user that is the subject of the relation 422 * @param userId2 the user at the other end of the relation 423 * @param start the lower bound of the range of results 424 * @param end the upper bound of the range of results (not inclusive) 425 * @return the range of relations 426 * @throws SystemException if a system exception occurred 427 */ 428 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 429 public java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 430 long userId1, long userId2, int start, int end) 431 throws com.liferay.portal.kernel.exception.SystemException; 432 433 /** 434 * Returns the number of relations of the given type where the user is the 435 * subject of the relation. 436 * 437 * @param userId the primary key of the user 438 * @param type the relation's type 439 * @return the number of relations 440 * @throws SystemException if a system exception occurred 441 */ 442 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 443 public int getRelationsCount(long userId, int type) 444 throws com.liferay.portal.kernel.exception.SystemException; 445 446 /** 447 * Returns the number of relations between User1 and User2. 448 * 449 * @param userId1 the user that is the subject of the relation 450 * @param userId2 the user at the other end of the relation 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 userId1, long userId2) 456 throws com.liferay.portal.kernel.exception.SystemException; 457 458 /** 459 * Returns <code>true</code> if a relation of the given type exists where 460 * the user with primary key <code>userId1</code> is User1 of the relation 461 * and the user with the primary key <code>userId2</code> is User2 of the 462 * relation. 463 * 464 * @param userId1 the user that is the subject of the relation 465 * @param userId2 the user at the other end of the relation 466 * @param type the relation's type 467 * @return <code>true</code> if the relation exists; <code>false</code> 468 otherwise 469 * @throws SystemException if a system exception occurred 470 */ 471 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 472 public boolean hasRelation(long userId1, long userId2, int type) 473 throws com.liferay.portal.kernel.exception.SystemException; 474 475 /** 476 * Returns <code>true</code> if the users can be in a relation of the given 477 * type where the user with primary key <code>userId1</code> is User1 of 478 * the relation and the user with the primary key <code>userId2</code> is 479 * User2 of the relation. 480 * 481 * <p> 482 * This method returns <code>false</code> if User1 and User2 are the same, 483 * if either user is the default user, or if a matching relation already 484 * exists. 485 * </p> 486 * 487 * @param userId1 the user that is the subject of the relation 488 * @param userId2 the user at the other end of the relation 489 * @param type the relation's type 490 * @return <code>true</code> if the two users can be in a new relation of 491 the given type; <code>false</code> otherwise 492 * @throws SystemException if a system exception occurred 493 */ 494 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 495 public boolean isRelatable(long userId1, long userId2, int type) 496 throws com.liferay.portal.kernel.exception.SystemException; 497 }