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