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 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 239 public com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 240 241 /** 242 * Returns a range of all the inverse relations of the given type for which 243 * the user is User2 of the relation. 244 * 245 * <p> 246 * Useful when paginating results. Returns a maximum of <code>end - 247 * start</code> instances. <code>start</code> and <code>end</code> are not 248 * primary keys, they are indexes in the result set. Thus, <code>0</code> 249 * refers to the first result in the set. Setting both <code>start</code> 250 * and <code>end</code> to {@link 251 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 252 * result set. 253 * </p> 254 * 255 * @param userId the primary key of the user 256 * @param type the relation's type 257 * @param start the lower bound of the range of results 258 * @param end the upper bound of the range of results (not inclusive) 259 * @return the range of matching relations 260 */ 261 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 262 public java.util.List<com.liferay.portlet.social.model.SocialRelation> getInverseRelations( 263 long userId, int type, int start, int end); 264 265 /** 266 * Returns the number of inverse relations of the given type for which the 267 * user is User2 of the relation. 268 * 269 * @param userId the primary key of the user 270 * @param type the relation's type 271 * @return the number of matching relations 272 */ 273 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 274 public int getInverseRelationsCount(long userId, int type); 275 276 /** 277 * Returns the OSGi service identifier. 278 * 279 * @return the OSGi service identifier 280 */ 281 public java.lang.String getOSGiServiceIdentifier(); 282 283 @Override 284 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 285 public com.liferay.portal.model.PersistedModel getPersistedModel( 286 java.io.Serializable primaryKeyObj) throws PortalException; 287 288 /** 289 * Returns the relation identified by its primary key. 290 * 291 * @param relationId the primary key of the relation 292 * @return Returns the relation 293 */ 294 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 295 public com.liferay.portlet.social.model.SocialRelation getRelation( 296 long relationId) throws PortalException; 297 298 /** 299 * Returns the relation of the given type between User1 and User2. 300 * 301 * @param userId1 the user that is the subject of the relation 302 * @param userId2 the user at the other end of the relation 303 * @param type the relation's type 304 * @return Returns the relation 305 */ 306 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 307 public com.liferay.portlet.social.model.SocialRelation getRelation( 308 long userId1, long userId2, int type) throws PortalException; 309 310 /** 311 * Returns a range of all the relations of the given type where the user is 312 * the subject of the relation. 313 * 314 * <p> 315 * Useful when paginating results. Returns a maximum of <code>end - 316 * start</code> instances. <code>start</code> and <code>end</code> are not 317 * primary keys, they are indexes in the result set. Thus, <code>0</code> 318 * refers to the first result in the set. Setting both <code>start</code> 319 * and <code>end</code> to {@link 320 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 321 * result set. 322 * </p> 323 * 324 * @param userId the primary key of the user 325 * @param type the relation's type 326 * @param start the lower bound of the range of results 327 * @param end the upper bound of the range of results (not inclusive) 328 * @return the range of relations 329 */ 330 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 331 public java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 332 long userId, int type, int start, int end); 333 334 /** 335 * Returns a range of all the relations between User1 and User2. 336 * 337 * <p> 338 * Useful when paginating results. Returns a maximum of <code>end - 339 * start</code> instances. <code>start</code> and <code>end</code> are not 340 * primary keys, they are indexes in the result set. Thus, <code>0</code> 341 * refers to the first result in the set. Setting both <code>start</code> 342 * and <code>end</code> to {@link 343 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 344 * result set. 345 * </p> 346 * 347 * @param userId1 the user that is the subject of the relation 348 * @param userId2 the user at the other end of the relation 349 * @param start the lower bound of the range of results 350 * @param end the upper bound of the range of results (not inclusive) 351 * @return the range of relations 352 */ 353 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 354 public java.util.List<com.liferay.portlet.social.model.SocialRelation> getRelations( 355 long userId1, long userId2, int start, int end); 356 357 /** 358 * Returns the number of relations of the given type where the user is the 359 * subject of the relation. 360 * 361 * @param userId the primary key of the user 362 * @param type the relation's type 363 * @return the number of relations 364 */ 365 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 366 public int getRelationsCount(long userId, int type); 367 368 /** 369 * Returns the number of relations between User1 and User2. 370 * 371 * @param userId1 the user that is the subject of the relation 372 * @param userId2 the user at the other end of the relation 373 * @return the number of relations 374 */ 375 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 376 public int getRelationsCount(long userId1, long userId2); 377 378 /** 379 * Returns the social relation with the primary key. 380 * 381 * @param relationId the primary key of the social relation 382 * @return the social relation 383 * @throws PortalException if a social relation with the primary key could not be found 384 */ 385 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 386 public com.liferay.portlet.social.model.SocialRelation getSocialRelation( 387 long relationId) throws PortalException; 388 389 /** 390 * Returns the social relation with the matching UUID and company. 391 * 392 * @param uuid the social relation's UUID 393 * @param companyId the primary key of the company 394 * @return the matching social relation 395 * @throws PortalException if a matching social relation could not be found 396 */ 397 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 398 public com.liferay.portlet.social.model.SocialRelation getSocialRelationByUuidAndCompanyId( 399 java.lang.String uuid, long companyId) throws PortalException; 400 401 /** 402 * Returns a range of all the social relations. 403 * 404 * <p> 405 * 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. 406 * </p> 407 * 408 * @param start the lower bound of the range of social relations 409 * @param end the upper bound of the range of social relations (not inclusive) 410 * @return the range of social relations 411 */ 412 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 413 public java.util.List<com.liferay.portlet.social.model.SocialRelation> getSocialRelations( 414 int start, int end); 415 416 /** 417 * Returns the number of social relations. 418 * 419 * @return the number of social relations 420 */ 421 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 422 public int getSocialRelationsCount(); 423 424 /** 425 * Returns <code>true</code> if a relation of the given type exists where 426 * the user with primary key <code>userId1</code> is User1 of the relation 427 * and the user with the primary key <code>userId2</code> is User2 of the 428 * relation. 429 * 430 * @param userId1 the user that is the subject of the relation 431 * @param userId2 the user at the other end of the relation 432 * @param type the relation's type 433 * @return <code>true</code> if the relation exists; <code>false</code> 434 otherwise 435 */ 436 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 437 public boolean hasRelation(long userId1, long userId2, int type); 438 439 /** 440 * Returns <code>true</code> if the users can be in a relation of the given 441 * type where the user with primary key <code>userId1</code> is User1 of the 442 * relation and the user with the primary key <code>userId2</code> is User2 443 * of the relation. 444 * 445 * <p> 446 * This method returns <code>false</code> if User1 and User2 are the same, 447 * if either user is the default user, or if a matching relation already 448 * exists. 449 * </p> 450 * 451 * @param userId1 the user that is the subject of the relation 452 * @param userId2 the user at the other end of the relation 453 * @param type the relation's type 454 * @return <code>true</code> if the two users can be in a new relation of 455 the given type; <code>false</code> otherwise 456 */ 457 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 458 public boolean isRelatable(long userId1, long userId2, int type); 459 460 /** 461 * Updates the social relation in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 462 * 463 * @param socialRelation the social relation 464 * @return the social relation that was updated 465 */ 466 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 467 public com.liferay.portlet.social.model.SocialRelation updateSocialRelation( 468 com.liferay.portlet.social.model.SocialRelation socialRelation); 469 }