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