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