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 public static com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() { 294 return getService().getIndexableActionableDynamicQuery(); 295 } 296 297 /** 298 * Returns the OSGi service identifier. 299 * 300 * @return the OSGi service identifier 301 */ 302 public static java.lang.String getOSGiServiceIdentifier() { 303 return getService().getOSGiServiceIdentifier(); 304 } 305 306 public static com.liferay.portal.model.PersistedModel getPersistedModel( 307 java.io.Serializable primaryKeyObj) 308 throws com.liferay.portal.kernel.exception.PortalException { 309 return getService().getPersistedModel(primaryKeyObj); 310 } 311 312 /** 313 * Returns the subscription of the user to the entity. 314 * 315 * @param companyId the primary key of the company 316 * @param userId the primary key of the user 317 * @param className the entity's class name 318 * @param classPK the primary key of the entity's instance 319 * @return the subscription of the user to the entity 320 */ 321 public static com.liferay.portal.model.Subscription getSubscription( 322 long companyId, long userId, java.lang.String className, long classPK) 323 throws com.liferay.portal.kernel.exception.PortalException { 324 return getService() 325 .getSubscription(companyId, userId, className, classPK); 326 } 327 328 /** 329 * Returns the subscription with the primary key. 330 * 331 * @param subscriptionId the primary key of the subscription 332 * @return the subscription 333 * @throws PortalException if a subscription with the primary key could not be found 334 */ 335 public static com.liferay.portal.model.Subscription getSubscription( 336 long subscriptionId) 337 throws com.liferay.portal.kernel.exception.PortalException { 338 return getService().getSubscription(subscriptionId); 339 } 340 341 /** 342 * Returns all the subscriptions to the entity. 343 * 344 * @param companyId the primary key of the company 345 * @param className the entity's class name 346 * @param classPK the primary key of the entity's instance 347 * @return the subscriptions to the entity 348 */ 349 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 350 long companyId, java.lang.String className, long classPK) { 351 return getService().getSubscriptions(companyId, className, classPK); 352 } 353 354 /** 355 * Returns all the subscriptions of the user to the entities. 356 * 357 * @param companyId the primary key of the company 358 * @param userId the primary key of the user 359 * @param className the entity's class name 360 * @param classPKs the primary key of the entities 361 * @return the subscriptions of the user to the entities 362 */ 363 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 364 long companyId, long userId, java.lang.String className, long[] classPKs) { 365 return getService() 366 .getSubscriptions(companyId, userId, className, classPKs); 367 } 368 369 /** 370 * Returns a range of all the subscriptions. 371 * 372 * <p> 373 * 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. 374 * </p> 375 * 376 * @param start the lower bound of the range of subscriptions 377 * @param end the upper bound of the range of subscriptions (not inclusive) 378 * @return the range of subscriptions 379 */ 380 public static java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 381 int start, int end) { 382 return getService().getSubscriptions(start, end); 383 } 384 385 /** 386 * Returns the number of subscriptions. 387 * 388 * @return the number of subscriptions 389 */ 390 public static int getSubscriptionsCount() { 391 return getService().getSubscriptionsCount(); 392 } 393 394 /** 395 * Returns all the subscriptions of the user to the entities with the class 396 * name. 397 * 398 * @param userId the primary key of the user 399 * @param className the entity's class name 400 * @return the subscriptions of the user to the entities with the class name 401 */ 402 public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 403 long userId, java.lang.String className) { 404 return getService().getUserSubscriptions(userId, className); 405 } 406 407 /** 408 * Returns an ordered range of all the subscriptions of the user. 409 * 410 * @param userId the primary key of the user 411 * @param start the lower bound of the range of results 412 * @param end the upper bound of the range of results (not inclusive) 413 * @param orderByComparator the comparator to order the subscriptions 414 * @return the range of subscriptions of the user 415 */ 416 public static java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 417 long userId, int start, int end, 418 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Subscription> orderByComparator) { 419 return getService() 420 .getUserSubscriptions(userId, start, end, orderByComparator); 421 } 422 423 /** 424 * Returns the number of subscriptions of the user. 425 * 426 * @param userId the primary key of the user 427 * @return the number of subscriptions of the user 428 */ 429 public static int getUserSubscriptionsCount(long userId) { 430 return getService().getUserSubscriptionsCount(userId); 431 } 432 433 /** 434 * Returns <code>true</code> if the user is subscribed to the entity. 435 * 436 * @param companyId the primary key of the company 437 * @param userId the primary key of the user 438 * @param className the entity's class name 439 * @param classPK the primary key of the entity's instance 440 * @return <code>true</code> if the user is subscribed to the entity; 441 <code>false</code> otherwise 442 */ 443 public static boolean isSubscribed(long companyId, long userId, 444 java.lang.String className, long classPK) { 445 return getService().isSubscribed(companyId, userId, className, classPK); 446 } 447 448 /** 449 * Returns <code>true</code> if the user is subscribed to any of the 450 * entities. 451 * 452 * @param companyId the primary key of the company 453 * @param userId the primary key of the user 454 * @param className the entity's class name 455 * @param classPKs the primary key of the entities 456 * @return <code>true</code> if the user is subscribed to any of the 457 entities; <code>false</code> otherwise 458 */ 459 public static boolean isSubscribed(long companyId, long userId, 460 java.lang.String className, long[] classPKs) { 461 return getService().isSubscribed(companyId, userId, className, classPKs); 462 } 463 464 /** 465 * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 466 * 467 * @param subscription the subscription 468 * @return the subscription that was updated 469 */ 470 public static com.liferay.portal.model.Subscription updateSubscription( 471 com.liferay.portal.model.Subscription subscription) { 472 return getService().updateSubscription(subscription); 473 } 474 475 public static SubscriptionLocalService getService() { 476 if (_service == null) { 477 _service = (SubscriptionLocalService)PortalBeanLocatorUtil.locate(SubscriptionLocalService.class.getName()); 478 479 ReferenceRegistry.registerReference(SubscriptionLocalServiceUtil.class, 480 "_service"); 481 } 482 483 return _service; 484 } 485 486 private static SubscriptionLocalService _service; 487 }