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