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.portal.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 020 import com.liferay.portal.kernel.util.ReferenceRegistry; 021 022 /** 023 * Provides the local service utility for Subscription. This utility wraps 024 * {@link com.liferay.portal.service.impl.SubscriptionLocalServiceImpl} and is the 025 * primary access point for service operations in application layer code running 026 * on the local server. Methods of this service will not have security checks 027 * based on the propagated JAAS credentials because this service can only be 028 * accessed from within the same VM. 029 * 030 * @author Brian Wing Shun Chan 031 * @see SubscriptionLocalService 032 * @see com.liferay.portal.service.base.SubscriptionLocalServiceBaseImpl 033 * @see com.liferay.portal.service.impl.SubscriptionLocalServiceImpl 034 * @generated 035 */ 036 @ProviderType 037 public class SubscriptionLocalServiceUtil { 038 /* 039 * NOTE FOR DEVELOPERS: 040 * 041 * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.SubscriptionLocalServiceImpl} and rerun ServiceBuilder to regenerate this class. 042 */ 043 044 /** 045 * Adds the subscription to the database. Also notifies the appropriate model listeners. 046 * 047 * @param subscription the subscription 048 * @return the subscription that was added 049 */ 050 public static com.liferay.portal.model.Subscription addSubscription( 051 com.liferay.portal.model.Subscription subscription) { 052 return getService().addSubscription(subscription); 053 } 054 055 /** 056 * Subscribes the user to the entity, notifying him the instant the entity 057 * is created, deleted, or modified. 058 * 059 * <p> 060 * If there is no asset entry with the class name and class PK a new asset 061 * entry is created. 062 * </p> 063 * 064 * <p> 065 * A social activity for the subscription is created using the asset entry 066 * associated with the class name and class PK, or the newly created asset 067 * entry. 068 * </p> 069 * 070 * @param userId the primary key of the user 071 * @param groupId the primary key of the entity's group 072 * @param className the entity's class name 073 * @param classPK the primary key of the entity's instance 074 * @return the subscription 075 * @throws PortalException if a matching user or group could not be found 076 */ 077 public static com.liferay.portal.model.Subscription addSubscription( 078 long userId, long groupId, java.lang.String className, long classPK) 079 throws com.liferay.portal.kernel.exception.PortalException { 080 return getService().addSubscription(userId, groupId, className, classPK); 081 } 082 083 /** 084 * Subscribes the user to the entity, notifying him at the given frequency. 085 * 086 * <p> 087 * If there is no asset entry with the class name and class PK a new asset 088 * entry is created. 089 * </p> 090 * 091 * <p> 092 * A social activity for the subscription is created using the asset entry 093 * associated with the class name and class PK, or the newly created asset 094 * entry. 095 * </p> 096 * 097 * @param userId the primary key of the user 098 * @param groupId the primary key of the entity's group 099 * @param className the entity's class name 100 * @param classPK the primary key of the entity's instance 101 * @param frequency the frequency for notifications 102 * @return the subscription 103 * @throws PortalException if a matching user or group could not be found 104 */ 105 public static com.liferay.portal.model.Subscription addSubscription( 106 long userId, long groupId, java.lang.String className, long classPK, 107 java.lang.String frequency) 108 throws com.liferay.portal.kernel.exception.PortalException { 109 return getService() 110 .addSubscription(userId, groupId, className, classPK, 111 frequency); 112 } 113 114 /** 115 * Creates a new subscription with the primary key. Does not add the subscription to the database. 116 * 117 * @param subscriptionId the primary key for the new subscription 118 * @return the new subscription 119 */ 120 public static com.liferay.portal.model.Subscription createSubscription( 121 long subscriptionId) { 122 return getService().createSubscription(subscriptionId); 123 } 124 125 /** 126 * @throws PortalException 127 */ 128 public static com.liferay.portal.model.PersistedModel deletePersistedModel( 129 com.liferay.portal.model.PersistedModel persistedModel) 130 throws com.liferay.portal.kernel.exception.PortalException { 131 return getService().deletePersistedModel(persistedModel); 132 } 133 134 /** 135 * Deletes the subscription from the database. Also notifies the appropriate model listeners. 136 * 137 * @param subscription the subscription 138 * @return the subscription that was removed 139 * @throws PortalException 140 */ 141 public static com.liferay.portal.model.Subscription deleteSubscription( 142 com.liferay.portal.model.Subscription subscription) 143 throws com.liferay.portal.kernel.exception.PortalException { 144 return getService().deleteSubscription(subscription); 145 } 146 147 /** 148 * Deletes the subscription with the primary key from the database. Also notifies the appropriate model listeners. 149 * 150 * @param subscriptionId the primary key of the subscription 151 * @return the subscription that was removed 152 * @throws PortalException if a subscription with the primary key could not be found 153 */ 154 public static com.liferay.portal.model.Subscription deleteSubscription( 155 long subscriptionId) 156 throws com.liferay.portal.kernel.exception.PortalException { 157 return getService().deleteSubscription(subscriptionId); 158 } 159 160 /** 161 * Deletes the user's subscription to the entity. A social activity with the 162 * unsubscribe action is created. 163 * 164 * @param userId the primary key of the user 165 * @param className the entity's class name 166 * @param classPK the primary key of the entity's instance 167 * @throws PortalException if a matching user or subscription could not be 168 found 169 */ 170 public static void deleteSubscription(long userId, 171 java.lang.String className, long classPK) 172 throws com.liferay.portal.kernel.exception.PortalException { 173 getService().deleteSubscription(userId, className, classPK); 174 } 175 176 /** 177 * Deletes all the subscriptions to the entity. 178 * 179 * @param companyId the primary key of the company 180 * @param className the entity's class name 181 * @param classPK the primary key of the entity's instance 182 * @throws PortalException if a portal exception occurred 183 */ 184 public static void deleteSubscriptions(long companyId, 185 java.lang.String className, long classPK) 186 throws com.liferay.portal.kernel.exception.PortalException { 187 getService().deleteSubscriptions(companyId, className, classPK); 188 } 189 190 /** 191 * Deletes all the subscriptions of the user. 192 * 193 * @param userId the primary key of the user 194 * @throws PortalException if a portal exception occurred 195 */ 196 public static void deleteSubscriptions(long userId) 197 throws com.liferay.portal.kernel.exception.PortalException { 198 getService().deleteSubscriptions(userId); 199 } 200 201 public static void deleteSubscriptions(long userId, long groupId) 202 throws com.liferay.portal.kernel.exception.PortalException { 203 getService().deleteSubscriptions(userId, groupId); 204 } 205 206 public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { 207 return getService().dynamicQuery(); 208 } 209 210 /** 211 * Performs a dynamic query on the database and returns the matching rows. 212 * 213 * @param dynamicQuery the dynamic query 214 * @return the matching rows 215 */ 216 public static <T> java.util.List<T> dynamicQuery( 217 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 218 return getService().dynamicQuery(dynamicQuery); 219 } 220 221 /** 222 * Performs a dynamic query on the database and returns a range of the matching rows. 223 * 224 * <p> 225 * 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.portal.model.impl.SubscriptionModelImpl}. 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. 226 * </p> 227 * 228 * @param dynamicQuery the dynamic query 229 * @param start the lower bound of the range of model instances 230 * @param end the upper bound of the range of model instances (not inclusive) 231 * @return the range of matching rows 232 */ 233 public static <T> java.util.List<T> dynamicQuery( 234 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 235 int end) { 236 return getService().dynamicQuery(dynamicQuery, start, end); 237 } 238 239 /** 240 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 241 * 242 * <p> 243 * 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.portal.model.impl.SubscriptionModelImpl}. 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. 244 * </p> 245 * 246 * @param dynamicQuery the dynamic query 247 * @param start the lower bound of the range of model instances 248 * @param end the upper bound of the range of model instances (not inclusive) 249 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 250 * @return the ordered range of matching rows 251 */ 252 public static <T> java.util.List<T> dynamicQuery( 253 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 254 int end, 255 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator) { 256 return getService() 257 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 258 } 259 260 /** 261 * Returns the number of rows matching the dynamic query. 262 * 263 * @param dynamicQuery the dynamic query 264 * @return the number of rows matching the dynamic query 265 */ 266 public static long dynamicQueryCount( 267 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 268 return getService().dynamicQueryCount(dynamicQuery); 269 } 270 271 /** 272 * Returns the number of rows matching the dynamic query. 273 * 274 * @param dynamicQuery the dynamic query 275 * @param projection the projection to apply to the query 276 * @return the number of rows matching the dynamic query 277 */ 278 public static long dynamicQueryCount( 279 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 280 com.liferay.portal.kernel.dao.orm.Projection projection) { 281 return getService().dynamicQueryCount(dynamicQuery, projection); 282 } 283 284 public static com.liferay.portal.model.Subscription fetchSubscription( 285 long companyId, long userId, java.lang.String className, long classPK) { 286 return getService() 287 .fetchSubscription(companyId, userId, className, classPK); 288 } 289 290 public static com.liferay.portal.model.Subscription fetchSubscription( 291 long subscriptionId) { 292 return getService().fetchSubscription(subscriptionId); 293 } 294 295 public static com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery() { 296 return getService().getActionableDynamicQuery(); 297 } 298 299 /** 300 * Returns the Spring bean ID for this bean. 301 * 302 * @return the Spring bean ID for this bean 303 */ 304 public static java.lang.String getBeanIdentifier() { 305 return getService().getBeanIdentifier(); 306 } 307 308 public static com.liferay.portal.model.PersistedModel getPersistedModel( 309 java.io.Serializable primaryKeyObj) 310 throws com.liferay.portal.kernel.exception.PortalException { 311 return getService().getPersistedModel(primaryKeyObj); 312 } 313 314 /** 315 * Returns the subscription of the user to the entity. 316 * 317 * @param companyId the primary key of the company 318 * @param userId the primary key of the user 319 * @param className the entity's class name 320 * @param classPK the primary key of the entity's instance 321 * @return the subscription of the user to the entity 322 * @throws PortalException if a matching subscription could not be found 323 */ 324 public static com.liferay.portal.model.Subscription getSubscription( 325 long companyId, long userId, java.lang.String className, long classPK) 326 throws com.liferay.portal.kernel.exception.PortalException { 327 return getService() 328 .getSubscription(companyId, userId, className, classPK); 329 } 330 331 /** 332 * Returns the subscription with the primary key. 333 * 334 * @param subscriptionId the primary key of the subscription 335 * @return the subscription 336 * @throws PortalException if a subscription with the primary key could not be found 337 */ 338 public static com.liferay.portal.model.Subscription getSubscription( 339 long subscriptionId) 340 throws com.liferay.portal.kernel.exception.PortalException { 341 return getService().getSubscription(subscriptionId); 342 } 343 344 /** 345 * Returns all the subscriptions to the entity. 346 * 347 * @param companyId the primary key of the company 348 * @param className the entity's class name 349 * @param classPK the primary key of the entity's instance 350 * @return the subscriptions to the entity 351 */ 352 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 353 long companyId, java.lang.String className, long classPK) { 354 return getService().getSubscriptions(companyId, className, classPK); 355 } 356 357 /** 358 * Returns all the subscriptions of the user to the entities. 359 * 360 * @param companyId the primary key of the company 361 * @param userId the primary key of the user 362 * @param className the entity's class name 363 * @param classPKs the primary key of the entities 364 * @return the subscriptions of the user to the entities 365 */ 366 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 367 long companyId, long userId, java.lang.String className, long[] classPKs) { 368 return getService() 369 .getSubscriptions(companyId, userId, className, classPKs); 370 } 371 372 /** 373 * Returns a range of all the subscriptions. 374 * 375 * <p> 376 * 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.portal.model.impl.SubscriptionModelImpl}. 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. 377 * </p> 378 * 379 * @param start the lower bound of the range of subscriptions 380 * @param end the upper bound of the range of subscriptions (not inclusive) 381 * @return the range of subscriptions 382 */ 383 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 384 int start, int end) { 385 return getService().getSubscriptions(start, end); 386 } 387 388 /** 389 * Returns the number of subscriptions. 390 * 391 * @return the number of subscriptions 392 */ 393 public static int getSubscriptionsCount() { 394 return getService().getSubscriptionsCount(); 395 } 396 397 /** 398 * Returns all the subscriptions of the user to the entities with the class 399 * name. 400 * 401 * @param userId the primary key of the user 402 * @param className the entity's class name 403 * @return the subscriptions of the user to the entities with the class name 404 */ 405 public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 406 long userId, java.lang.String className) { 407 return getService().getUserSubscriptions(userId, className); 408 } 409 410 /** 411 * Returns an ordered range of all the subscriptions of the user. 412 * 413 * @param userId the primary key of the user 414 * @param start the lower bound of the range of results 415 * @param end the upper bound of the range of results (not inclusive) 416 * @param orderByComparator the comparator to order the subscriptions 417 * @return the range of subscriptions of the user 418 */ 419 public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 420 long userId, int start, int end, 421 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Subscription> orderByComparator) { 422 return getService() 423 .getUserSubscriptions(userId, start, end, orderByComparator); 424 } 425 426 /** 427 * Returns the number of subscriptions of the user. 428 * 429 * @param userId the primary key of the user 430 * @return the number of subscriptions of the user 431 */ 432 public static int getUserSubscriptionsCount(long userId) { 433 return getService().getUserSubscriptionsCount(userId); 434 } 435 436 /** 437 * Returns <code>true</code> if the user is subscribed to the entity. 438 * 439 * @param companyId the primary key of the company 440 * @param userId the primary key of the user 441 * @param className the entity's class name 442 * @param classPK the primary key of the entity's instance 443 * @return <code>true</code> if the user is subscribed to the entity; 444 <code>false</code> otherwise 445 */ 446 public static boolean isSubscribed(long companyId, long userId, 447 java.lang.String className, long classPK) { 448 return getService().isSubscribed(companyId, userId, className, classPK); 449 } 450 451 /** 452 * Returns <code>true</code> if the user is subscribed to any of the 453 * entities. 454 * 455 * @param companyId the primary key of the company 456 * @param userId the primary key of the user 457 * @param className the entity's class name 458 * @param classPKs the primary key of the entities 459 * @return <code>true</code> if the user is subscribed to any of the 460 entities; <code>false</code> otherwise 461 */ 462 public static boolean isSubscribed(long companyId, long userId, 463 java.lang.String className, long[] classPKs) { 464 return getService().isSubscribed(companyId, userId, className, classPKs); 465 } 466 467 /** 468 * Sets the Spring bean ID for this bean. 469 * 470 * @param beanIdentifier the Spring bean ID for this bean 471 */ 472 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 473 getService().setBeanIdentifier(beanIdentifier); 474 } 475 476 /** 477 * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 478 * 479 * @param subscription the subscription 480 * @return the subscription that was updated 481 */ 482 public static com.liferay.portal.model.Subscription updateSubscription( 483 com.liferay.portal.model.Subscription subscription) { 484 return getService().updateSubscription(subscription); 485 } 486 487 public static SubscriptionLocalService getService() { 488 if (_service == null) { 489 _service = (SubscriptionLocalService)PortalBeanLocatorUtil.locate(SubscriptionLocalService.class.getName()); 490 491 ReferenceRegistry.registerReference(SubscriptionLocalServiceUtil.class, 492 "_service"); 493 } 494 495 return _service; 496 } 497 498 /** 499 * @deprecated As of 6.2.0 500 */ 501 @Deprecated 502 public void setService(SubscriptionLocalService service) { 503 } 504 505 private static SubscriptionLocalService _service; 506 }