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.social.kernel.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; 020 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 021 import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery; 022 import com.liferay.portal.kernel.dao.orm.Projection; 023 import com.liferay.portal.kernel.exception.PortalException; 024 import com.liferay.portal.kernel.exception.SystemException; 025 import com.liferay.portal.kernel.model.PersistedModel; 026 import com.liferay.portal.kernel.search.Indexable; 027 import com.liferay.portal.kernel.search.IndexableType; 028 import com.liferay.portal.kernel.service.BaseLocalService; 029 import com.liferay.portal.kernel.service.PersistedModelLocalService; 030 import com.liferay.portal.kernel.theme.ThemeDisplay; 031 import com.liferay.portal.kernel.transaction.Isolation; 032 import com.liferay.portal.kernel.transaction.Propagation; 033 import com.liferay.portal.kernel.transaction.Transactional; 034 import com.liferay.portal.kernel.util.OrderByComparator; 035 036 import com.liferay.social.kernel.model.SocialRequest; 037 038 import java.io.Serializable; 039 040 import java.util.List; 041 042 /** 043 * Provides the local service interface for SocialRequest. Methods of this 044 * service will not have security checks based on the propagated JAAS 045 * credentials because this service can only be accessed from within the same 046 * VM. 047 * 048 * @author Brian Wing Shun Chan 049 * @see SocialRequestLocalServiceUtil 050 * @see com.liferay.portlet.social.service.base.SocialRequestLocalServiceBaseImpl 051 * @see com.liferay.portlet.social.service.impl.SocialRequestLocalServiceImpl 052 * @generated 053 */ 054 @ProviderType 055 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 056 PortalException.class, SystemException.class}) 057 public interface SocialRequestLocalService extends BaseLocalService, 058 PersistedModelLocalService { 059 /* 060 * NOTE FOR DEVELOPERS: 061 * 062 * Never modify or reference this interface directly. Always use {@link SocialRequestLocalServiceUtil} to access the social request local service. Add custom service methods to {@link com.liferay.portlet.social.service.impl.SocialRequestLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 063 */ 064 065 /** 066 * Adds a social request to the database. 067 * 068 * <p> 069 * In order to add a social request, both the requesting user and the 070 * receiving user must be from the same company and neither of them can be 071 * the default user. 072 * </p> 073 * 074 * @param userId the primary key of the requesting user 075 * @param groupId the primary key of the group 076 * @param className the class name of the asset that is the subject of the 077 request 078 * @param classPK the primary key of the asset that is the subject of the 079 request 080 * @param type the request's type 081 * @param extraData the extra data regarding the request 082 * @param receiverUserId the primary key of the user receiving the request 083 * @return the social request 084 */ 085 public SocialRequest addRequest(long userId, long groupId, 086 java.lang.String className, long classPK, int type, 087 java.lang.String extraData, long receiverUserId) 088 throws PortalException; 089 090 /** 091 * Adds the social request to the database. Also notifies the appropriate model listeners. 092 * 093 * @param socialRequest the social request 094 * @return the social request that was added 095 */ 096 @Indexable(type = IndexableType.REINDEX) 097 public SocialRequest addSocialRequest(SocialRequest socialRequest); 098 099 /** 100 * Creates a new social request with the primary key. Does not add the social request to the database. 101 * 102 * @param requestId the primary key for the new social request 103 * @return the new social request 104 */ 105 public SocialRequest createSocialRequest(long requestId); 106 107 /** 108 * @throws PortalException 109 */ 110 @Override 111 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 112 throws PortalException; 113 114 /** 115 * Removes all the social requests for the receiving user. 116 * 117 * @param receiverUserId the primary key of the receiving user 118 */ 119 public void deleteReceiverUserRequests(long receiverUserId); 120 121 /** 122 * Removes the social request from the database. 123 * 124 * @param request the social request to be removed 125 */ 126 public void deleteRequest(SocialRequest request); 127 128 /** 129 * Removes the social request identified by its primary key from the 130 * database. 131 * 132 * @param requestId the primary key of the social request 133 */ 134 public void deleteRequest(long requestId) throws PortalException; 135 136 public void deleteRequests(long className, long classPK); 137 138 /** 139 * Deletes the social request with the primary key from the database. Also notifies the appropriate model listeners. 140 * 141 * @param requestId the primary key of the social request 142 * @return the social request that was removed 143 * @throws PortalException if a social request with the primary key could not be found 144 */ 145 @Indexable(type = IndexableType.DELETE) 146 public SocialRequest deleteSocialRequest(long requestId) 147 throws PortalException; 148 149 /** 150 * Deletes the social request from the database. Also notifies the appropriate model listeners. 151 * 152 * @param socialRequest the social request 153 * @return the social request that was removed 154 */ 155 @Indexable(type = IndexableType.DELETE) 156 public SocialRequest deleteSocialRequest(SocialRequest socialRequest); 157 158 /** 159 * Removes all the social requests for the requesting user. 160 * 161 * @param userId the primary key of the requesting user 162 */ 163 public void deleteUserRequests(long userId); 164 165 public DynamicQuery dynamicQuery(); 166 167 /** 168 * Performs a dynamic query on the database and returns the matching rows. 169 * 170 * @param dynamicQuery the dynamic query 171 * @return the matching rows 172 */ 173 public <T> List<T> dynamicQuery(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.SocialRequestModelImpl}. 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> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 188 int end); 189 190 /** 191 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 192 * 193 * <p> 194 * 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.SocialRequestModelImpl}. 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. 195 * </p> 196 * 197 * @param dynamicQuery the dynamic query 198 * @param start the lower bound of the range of model instances 199 * @param end the upper bound of the range of model instances (not inclusive) 200 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 201 * @return the ordered range of matching rows 202 */ 203 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 204 int end, OrderByComparator<T> orderByComparator); 205 206 /** 207 * Returns the number of rows matching the dynamic query. 208 * 209 * @param dynamicQuery the dynamic query 210 * @return the number of rows matching the dynamic query 211 */ 212 public long dynamicQueryCount(DynamicQuery dynamicQuery); 213 214 /** 215 * Returns the number of rows matching the dynamic query. 216 * 217 * @param dynamicQuery the dynamic query 218 * @param projection the projection to apply to the query 219 * @return the number of rows matching the dynamic query 220 */ 221 public long dynamicQueryCount(DynamicQuery dynamicQuery, 222 Projection projection); 223 224 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 225 public SocialRequest fetchSocialRequest(long requestId); 226 227 /** 228 * Returns the social request matching the UUID and group. 229 * 230 * @param uuid the social request's UUID 231 * @param groupId the primary key of the group 232 * @return the matching social request, or <code>null</code> if a matching social request could not be found 233 */ 234 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 235 public SocialRequest fetchSocialRequestByUuidAndGroupId( 236 java.lang.String uuid, long groupId); 237 238 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 239 public ActionableDynamicQuery getActionableDynamicQuery(); 240 241 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 242 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 243 244 /** 245 * Returns the OSGi service identifier. 246 * 247 * @return the OSGi service identifier 248 */ 249 public java.lang.String getOSGiServiceIdentifier(); 250 251 @Override 252 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 253 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 254 throws PortalException; 255 256 /** 257 * Returns a range of all the social requests for the receiving user. 258 * 259 * <p> 260 * Useful when paginating results. Returns a maximum of <code>end - 261 * start</code> instances. <code>start</code> and <code>end</code> are not 262 * primary keys, they are indexes in the result set. Thus, <code>0</code> 263 * refers to the first result in the set. Setting both <code>start</code> 264 * and <code>end</code> to {@link 265 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 266 * result set. 267 * </p> 268 * 269 * @param receiverUserId the primary key of the receiving user 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 social requests 273 */ 274 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 275 public List<SocialRequest> getReceiverUserRequests(long receiverUserId, 276 int start, int end); 277 278 /** 279 * Returns a range of all the social requests with the given status for the 280 * receiving user. 281 * 282 * <p> 283 * Useful when paginating results. Returns a maximum of <code>end - 284 * start</code> instances. <code>start</code> and <code>end</code> are not 285 * primary keys, they are indexes in the result set. Thus, <code>0</code> 286 * refers to the first result in the set. Setting both <code>start</code> 287 * and <code>end</code> to {@link 288 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 289 * result set. 290 * </p> 291 * 292 * @param receiverUserId the primary key of the receiving user 293 * @param status the social request's status 294 * @param start the lower bound of the range of results 295 * @param end the upper bound of the range of results (not inclusive) 296 * @return the range of matching social requests 297 */ 298 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 299 public List<SocialRequest> getReceiverUserRequests(long receiverUserId, 300 int status, int start, int end); 301 302 /** 303 * Returns the number of social requests for the receiving user. 304 * 305 * @param receiverUserId the primary key of the receiving user 306 * @return the number of matching social requests 307 */ 308 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 309 public int getReceiverUserRequestsCount(long receiverUserId); 310 311 /** 312 * Returns the number of social requests with the given status for the 313 * receiving user. 314 * 315 * @param receiverUserId the primary key of the receiving user 316 * @param status the social request's status 317 * @return the number of matching social requests 318 */ 319 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 320 public int getReceiverUserRequestsCount(long receiverUserId, int status); 321 322 /** 323 * Returns the social request with the primary key. 324 * 325 * @param requestId the primary key of the social request 326 * @return the social request 327 * @throws PortalException if a social request with the primary key could not be found 328 */ 329 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 330 public SocialRequest getSocialRequest(long requestId) 331 throws PortalException; 332 333 /** 334 * Returns the social request matching the UUID and group. 335 * 336 * @param uuid the social request's UUID 337 * @param groupId the primary key of the group 338 * @return the matching social request 339 * @throws PortalException if a matching social request could not be found 340 */ 341 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 342 public SocialRequest getSocialRequestByUuidAndGroupId( 343 java.lang.String uuid, long groupId) throws PortalException; 344 345 /** 346 * Returns a range of all the social requests. 347 * 348 * <p> 349 * 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.SocialRequestModelImpl}. 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. 350 * </p> 351 * 352 * @param start the lower bound of the range of social requests 353 * @param end the upper bound of the range of social requests (not inclusive) 354 * @return the range of social requests 355 */ 356 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 357 public List<SocialRequest> getSocialRequests(int start, int end); 358 359 /** 360 * Returns all the social requests matching the UUID and company. 361 * 362 * @param uuid the UUID of the social requests 363 * @param companyId the primary key of the company 364 * @return the matching social requests, or an empty list if no matches were found 365 */ 366 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 367 public List<SocialRequest> getSocialRequestsByUuidAndCompanyId( 368 java.lang.String uuid, long companyId); 369 370 /** 371 * Returns a range of social requests matching the UUID and company. 372 * 373 * @param uuid the UUID of the social requests 374 * @param companyId the primary key of the company 375 * @param start the lower bound of the range of social requests 376 * @param end the upper bound of the range of social requests (not inclusive) 377 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 378 * @return the range of matching social requests, or an empty list if no matches were found 379 */ 380 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 381 public List<SocialRequest> getSocialRequestsByUuidAndCompanyId( 382 java.lang.String uuid, long companyId, int start, int end, 383 OrderByComparator<SocialRequest> orderByComparator); 384 385 /** 386 * Returns the number of social requests. 387 * 388 * @return the number of social requests 389 */ 390 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 391 public int getSocialRequestsCount(); 392 393 /** 394 * Returns a range of all the social requests for the requesting user. 395 * 396 * <p> 397 * Useful when paginating results. Returns a maximum of <code>end - 398 * start</code> instances. <code>start</code> and <code>end</code> are not 399 * primary keys, they are indexes in the result set. Thus, <code>0</code> 400 * refers to the first result in the set. Setting both <code>start</code> 401 * and <code>end</code> to {@link 402 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 403 * result set. 404 * </p> 405 * 406 * @param userId the primary key of the requesting user 407 * @param start the lower bound of the range of results 408 * @param end the upper bound of the range of results (not inclusive) 409 * @return the range of matching social requests 410 */ 411 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 412 public List<SocialRequest> getUserRequests(long userId, int start, int end); 413 414 /** 415 * Returns a range of all the social requests with the given status for the 416 * requesting user. 417 * 418 * <p> 419 * Useful when paginating results. Returns a maximum of <code>end - 420 * start</code> instances. <code>start</code> and <code>end</code> are not 421 * primary keys, they are indexes in the result set. Thus, <code>0</code> 422 * refers to the first result in the set. Setting both <code>start</code> 423 * and <code>end</code> to {@link 424 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 425 * result set. 426 * </p> 427 * 428 * @param userId the primary key of the requesting user 429 * @param status the social request's status 430 * @param start the lower bound of the range of results 431 * @param end the upper bound of the range of results (not inclusive) 432 * @return the range of matching social requests 433 */ 434 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 435 public List<SocialRequest> getUserRequests(long userId, int status, 436 int start, int end); 437 438 /** 439 * Returns the number of social requests for the requesting user. 440 * 441 * @param userId the primary key of the requesting user 442 * @return the number of matching social requests 443 */ 444 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 445 public int getUserRequestsCount(long userId); 446 447 /** 448 * Returns the number of social requests with the given status for the 449 * requesting user. 450 * 451 * @param userId the primary key of the requesting user 452 * @param status the social request's status 453 * @return the number of matching social request 454 */ 455 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 456 public int getUserRequestsCount(long userId, int status); 457 458 /** 459 * Returns <code>true</code> if a matching social request exists in the 460 * database. 461 * 462 * @param userId the primary key of the requesting user 463 * @param className the class name of the asset that is the subject of the 464 request 465 * @param classPK the primary key of the asset that is the subject of the 466 request 467 * @param type the request's type 468 * @param receiverUserId the primary key of the receiving user 469 * @param status the social request's status 470 * @return <code>true</code> if the social request exists; 471 <code>false</code> otherwise 472 */ 473 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 474 public boolean hasRequest(long userId, java.lang.String className, 475 long classPK, int type, long receiverUserId, int status); 476 477 /** 478 * Returns <code>true</code> if a matching social requests exists in the 479 * database. 480 * 481 * @param userId the primary key of the requesting user 482 * @param className the class name of the asset that is the subject of the 483 request 484 * @param classPK the primary key of the asset that is the subject of the 485 request 486 * @param type the request's type 487 * @param status the social request's status 488 * @return <code>true</code> if the request exists; <code>false</code> 489 otherwise 490 */ 491 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 492 public boolean hasRequest(long userId, java.lang.String className, 493 long classPK, int type, int status); 494 495 /** 496 * Updates the social request replacing its status. 497 * 498 * <p> 499 * If the status is updated to {@link SocialRequestConstants#STATUS_CONFIRM} 500 * then {@link 501 * com.liferay.social.kernel.service.SocialRequestInterpreterLocalService#processConfirmation( 502 * SocialRequest, ThemeDisplay)} is called. If the status is updated to 503 * {@link SocialRequestConstants#STATUS_IGNORE} then {@link 504 * com.liferay.social.kernel.service.SocialRequestInterpreterLocalService#processRejection( 505 * SocialRequest, ThemeDisplay)} is called. 506 * </p> 507 * 508 * @param requestId the primary key of the social request 509 * @param status the new status 510 * @param themeDisplay the theme display 511 * @return the updated social request 512 */ 513 public SocialRequest updateRequest(long requestId, int status, 514 ThemeDisplay themeDisplay) throws PortalException; 515 516 /** 517 * Updates the social request in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 518 * 519 * @param socialRequest the social request 520 * @return the social request that was updated 521 */ 522 @Indexable(type = IndexableType.REINDEX) 523 public SocialRequest updateSocialRequest(SocialRequest socialRequest); 524 }