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 */ 076 public static com.liferay.portal.model.Subscription addSubscription( 077 long userId, long groupId, java.lang.String className, long classPK) 078 throws com.liferay.portal.kernel.exception.PortalException { 079 return getService().addSubscription(userId, groupId, className, classPK); 080 } 081 082 /** 083 * Subscribes the user to the entity, notifying him at the given frequency. 084 * 085 * <p> 086 * If there is no asset entry with the class name and class PK a new asset 087 * entry is created. 088 * </p> 089 * 090 * <p> 091 * A social activity for the subscription is created using the asset entry 092 * associated with the class name and class PK, or the newly created asset 093 * entry. 094 * </p> 095 * 096 * @param userId the primary key of the user 097 * @param groupId the primary key of the entity's group 098 * @param className the entity's class name 099 * @param classPK the primary key of the entity's instance 100 * @param frequency the frequency for notifications 101 * @return the subscription 102 */ 103 public static com.liferay.portal.model.Subscription addSubscription( 104 long userId, long groupId, java.lang.String className, long classPK, 105 java.lang.String frequency) 106 throws com.liferay.portal.kernel.exception.PortalException { 107 return getService() 108 .addSubscription(userId, groupId, className, classPK, 109 frequency); 110 } 111 112 /** 113 * Creates a new subscription with the primary key. Does not add the subscription to the database. 114 * 115 * @param subscriptionId the primary key for the new subscription 116 * @return the new subscription 117 */ 118 public static com.liferay.portal.model.Subscription createSubscription( 119 long subscriptionId) { 120 return getService().createSubscription(subscriptionId); 121 } 122 123 /** 124 * @throws PortalException 125 */ 126 public static com.liferay.portal.model.PersistedModel deletePersistedModel( 127 com.liferay.portal.model.PersistedModel persistedModel) 128 throws com.liferay.portal.kernel.exception.PortalException { 129 return getService().deletePersistedModel(persistedModel); 130 } 131 132 /** 133 * Deletes the subscription from the database. Also notifies the appropriate model listeners. 134 * 135 * @param subscription the subscription 136 * @return the subscription that was removed 137 * @throws PortalException 138 */ 139 public static com.liferay.portal.model.Subscription deleteSubscription( 140 com.liferay.portal.model.Subscription subscription) 141 throws com.liferay.portal.kernel.exception.PortalException { 142 return getService().deleteSubscription(subscription); 143 } 144 145 /** 146 * Deletes the subscription with the primary key from the database. Also notifies the appropriate model listeners. 147 * 148 * @param subscriptionId the primary key of the subscription 149 * @return the subscription that was removed 150 * @throws PortalException if a subscription with the primary key could not be found 151 */ 152 public static com.liferay.portal.model.Subscription deleteSubscription( 153 long subscriptionId) 154 throws com.liferay.portal.kernel.exception.PortalException { 155 return getService().deleteSubscription(subscriptionId); 156 } 157 158 /** 159 * Deletes the user's subscription to the entity. A social activity with the 160 * unsubscribe action is created. 161 * 162 * @param userId the primary key of the user 163 * @param className the entity's class name 164 * @param classPK the primary key of the entity's instance 165 */ 166 public static void deleteSubscription(long userId, 167 java.lang.String className, long classPK) 168 throws com.liferay.portal.kernel.exception.PortalException { 169 getService().deleteSubscription(userId, className, classPK); 170 } 171 172 /** 173 * Deletes all the subscriptions to the entity. 174 * 175 * @param companyId the primary key of the company 176 * @param className the entity's class name 177 * @param classPK the primary key of the entity's instance 178 */ 179 public static void deleteSubscriptions(long companyId, 180 java.lang.String className, long classPK) 181 throws com.liferay.portal.kernel.exception.PortalException { 182 getService().deleteSubscriptions(companyId, className, classPK); 183 } 184 185 /** 186 * Deletes all the subscriptions of the user. 187 * 188 * @param userId the primary key of the user 189 */ 190 public static void deleteSubscriptions(long userId) 191 throws com.liferay.portal.kernel.exception.PortalException { 192 getService().deleteSubscriptions(userId); 193 } 194 195 public static void deleteSubscriptions(long userId, long groupId) 196 throws com.liferay.portal.kernel.exception.PortalException { 197 getService().deleteSubscriptions(userId, groupId); 198 } 199 200 public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { 201 return getService().dynamicQuery(); 202 } 203 204 /** 205 * Performs a dynamic query on the database and returns the matching rows. 206 * 207 * @param dynamicQuery the dynamic query 208 * @return the matching rows 209 */ 210 public static <T> java.util.List<T> dynamicQuery( 211 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 212 return getService().dynamicQuery(dynamicQuery); 213 } 214 215 /** 216 * Performs a dynamic query on the database and returns a range of the matching rows. 217 * 218 * <p> 219 * 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. 220 * </p> 221 * 222 * @param dynamicQuery the dynamic query 223 * @param start the lower bound of the range of model instances 224 * @param end the upper bound of the range of model instances (not inclusive) 225 * @return the range of matching rows 226 */ 227 public static <T> java.util.List<T> dynamicQuery( 228 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 229 int end) { 230 return getService().dynamicQuery(dynamicQuery, start, end); 231 } 232 233 /** 234 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 235 * 236 * <p> 237 * 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. 238 * </p> 239 * 240 * @param dynamicQuery the dynamic query 241 * @param start the lower bound of the range of model instances 242 * @param end the upper bound of the range of model instances (not inclusive) 243 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 244 * @return the ordered range of matching rows 245 */ 246 public static <T> java.util.List<T> dynamicQuery( 247 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 248 int end, 249 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator) { 250 return getService() 251 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 252 } 253 254 /** 255 * Returns the number of rows matching the dynamic query. 256 * 257 * @param dynamicQuery the dynamic query 258 * @return the number of rows matching the dynamic query 259 */ 260 public static long dynamicQueryCount( 261 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 262 return getService().dynamicQueryCount(dynamicQuery); 263 } 264 265 /** 266 * Returns the number of rows matching the dynamic query. 267 * 268 * @param dynamicQuery the dynamic query 269 * @param projection the projection to apply to the query 270 * @return the number of rows matching the dynamic query 271 */ 272 public static long dynamicQueryCount( 273 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 274 com.liferay.portal.kernel.dao.orm.Projection projection) { 275 return getService().dynamicQueryCount(dynamicQuery, projection); 276 } 277 278 public static com.liferay.portal.model.Subscription fetchSubscription( 279 long companyId, long userId, java.lang.String className, long classPK) { 280 return getService() 281 .fetchSubscription(companyId, userId, className, classPK); 282 } 283 284 public static com.liferay.portal.model.Subscription fetchSubscription( 285 long subscriptionId) { 286 return getService().fetchSubscription(subscriptionId); 287 } 288 289 public static com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery() { 290 return getService().getActionableDynamicQuery(); 291 } 292 293 /** 294 * Returns the OSGi service identifier. 295 * 296 * @return the OSGi service identifier 297 */ 298 public static java.lang.String getOSGiServiceIdentifier() { 299 return getService().getOSGiServiceIdentifier(); 300 } 301 302 public static com.liferay.portal.model.PersistedModel getPersistedModel( 303 java.io.Serializable primaryKeyObj) 304 throws com.liferay.portal.kernel.exception.PortalException { 305 return getService().getPersistedModel(primaryKeyObj); 306 } 307 308 /** 309 * Returns the subscription of the user to the entity. 310 * 311 * @param companyId the primary key of the company 312 * @param userId the primary key of the user 313 * @param className the entity's class name 314 * @param classPK the primary key of the entity's instance 315 * @return the subscription of the user to the entity 316 */ 317 public static com.liferay.portal.model.Subscription getSubscription( 318 long companyId, long userId, java.lang.String className, long classPK) 319 throws com.liferay.portal.kernel.exception.PortalException { 320 return getService() 321 .getSubscription(companyId, userId, className, classPK); 322 } 323 324 /** 325 * Returns the subscription with the primary key. 326 * 327 * @param subscriptionId the primary key of the subscription 328 * @return the subscription 329 * @throws PortalException if a subscription with the primary key could not be found 330 */ 331 public static com.liferay.portal.model.Subscription getSubscription( 332 long subscriptionId) 333 throws com.liferay.portal.kernel.exception.PortalException { 334 return getService().getSubscription(subscriptionId); 335 } 336 337 /** 338 * Returns all the subscriptions to the entity. 339 * 340 * @param companyId the primary key of the company 341 * @param className the entity's class name 342 * @param classPK the primary key of the entity's instance 343 * @return the subscriptions to the entity 344 */ 345 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 346 long companyId, java.lang.String className, long classPK) { 347 return getService().getSubscriptions(companyId, className, classPK); 348 } 349 350 /** 351 * Returns all the subscriptions of the user to the entities. 352 * 353 * @param companyId the primary key of the company 354 * @param userId the primary key of the user 355 * @param className the entity's class name 356 * @param classPKs the primary key of the entities 357 * @return the subscriptions of the user to the entities 358 */ 359 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 360 long companyId, long userId, java.lang.String className, long[] classPKs) { 361 return getService() 362 .getSubscriptions(companyId, userId, className, classPKs); 363 } 364 365 /** 366 * Returns a range of all the subscriptions. 367 * 368 * <p> 369 * 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. 370 * </p> 371 * 372 * @param start the lower bound of the range of subscriptions 373 * @param end the upper bound of the range of subscriptions (not inclusive) 374 * @return the range of subscriptions 375 */ 376 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 377 int start, int end) { 378 return getService().getSubscriptions(start, end); 379 } 380 381 /** 382 * Returns the number of subscriptions. 383 * 384 * @return the number of subscriptions 385 */ 386 public static int getSubscriptionsCount() { 387 return getService().getSubscriptionsCount(); 388 } 389 390 /** 391 * Returns all the subscriptions of the user to the entities with the class 392 * name. 393 * 394 * @param userId the primary key of the user 395 * @param className the entity's class name 396 * @return the subscriptions of the user to the entities with the class name 397 */ 398 public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 399 long userId, java.lang.String className) { 400 return getService().getUserSubscriptions(userId, className); 401 } 402 403 /** 404 * Returns an ordered range of all the subscriptions of the user. 405 * 406 * @param userId the primary key of the 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 * @param orderByComparator the comparator to order the subscriptions 410 * @return the range of subscriptions of the user 411 */ 412 public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 413 long userId, int start, int end, 414 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Subscription> orderByComparator) { 415 return getService() 416 .getUserSubscriptions(userId, start, end, orderByComparator); 417 } 418 419 /** 420 * Returns the number of subscriptions of the user. 421 * 422 * @param userId the primary key of the user 423 * @return the number of subscriptions of the user 424 */ 425 public static int getUserSubscriptionsCount(long userId) { 426 return getService().getUserSubscriptionsCount(userId); 427 } 428 429 /** 430 * Returns <code>true</code> if the user is subscribed to the entity. 431 * 432 * @param companyId the primary key of the company 433 * @param userId the primary key of the user 434 * @param className the entity's class name 435 * @param classPK the primary key of the entity's instance 436 * @return <code>true</code> if the user is subscribed to the entity; 437 <code>false</code> otherwise 438 */ 439 public static boolean isSubscribed(long companyId, long userId, 440 java.lang.String className, long classPK) { 441 return getService().isSubscribed(companyId, userId, className, classPK); 442 } 443 444 /** 445 * Returns <code>true</code> if the user is subscribed to any of the 446 * entities. 447 * 448 * @param companyId the primary key of the company 449 * @param userId the primary key of the user 450 * @param className the entity's class name 451 * @param classPKs the primary key of the entities 452 * @return <code>true</code> if the user is subscribed to any of the 453 entities; <code>false</code> otherwise 454 */ 455 public static boolean isSubscribed(long companyId, long userId, 456 java.lang.String className, long[] classPKs) { 457 return getService().isSubscribed(companyId, userId, className, classPKs); 458 } 459 460 /** 461 * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 462 * 463 * @param subscription the subscription 464 * @return the subscription that was updated 465 */ 466 public static com.liferay.portal.model.Subscription updateSubscription( 467 com.liferay.portal.model.Subscription subscription) { 468 return getService().updateSubscription(subscription); 469 } 470 471 public static SubscriptionLocalService getService() { 472 if (_service == null) { 473 _service = (SubscriptionLocalService)PortalBeanLocatorUtil.locate(SubscriptionLocalService.class.getName()); 474 475 ReferenceRegistry.registerReference(SubscriptionLocalServiceUtil.class, 476 "_service"); 477 } 478 479 return _service; 480 } 481 482 /** 483 * @deprecated As of 6.2.0 484 */ 485 @Deprecated 486 public void setService(SubscriptionLocalService service) { 487 } 488 489 private static SubscriptionLocalService _service; 490 }