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.exception.PortalException; 020 import com.liferay.portal.kernel.exception.SystemException; 021 import com.liferay.portal.kernel.search.IndexableType; 022 import com.liferay.portal.kernel.transaction.Isolation; 023 import com.liferay.portal.kernel.transaction.Propagation; 024 import com.liferay.portal.kernel.transaction.Transactional; 025 026 /** 027 * Provides the local service interface for Subscription. Methods of this 028 * service will not have security checks based on the propagated JAAS 029 * credentials because this service can only be accessed from within the same 030 * VM. 031 * 032 * @author Brian Wing Shun Chan 033 * @see SubscriptionLocalServiceUtil 034 * @see com.liferay.portal.service.base.SubscriptionLocalServiceBaseImpl 035 * @see com.liferay.portal.service.impl.SubscriptionLocalServiceImpl 036 * @generated 037 */ 038 @ProviderType 039 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 040 PortalException.class, SystemException.class}) 041 public interface SubscriptionLocalService extends BaseLocalService, 042 PersistedModelLocalService { 043 /* 044 * NOTE FOR DEVELOPERS: 045 * 046 * Never modify or reference this interface directly. Always use {@link SubscriptionLocalServiceUtil} to access the subscription local service. Add custom service methods to {@link com.liferay.portal.service.impl.SubscriptionLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 047 */ 048 049 /** 050 * Adds the subscription to the database. Also notifies the appropriate model listeners. 051 * 052 * @param subscription the subscription 053 * @return the subscription that was added 054 */ 055 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 056 public com.liferay.portal.model.Subscription addSubscription( 057 com.liferay.portal.model.Subscription subscription); 058 059 /** 060 * Subscribes the user to the entity, notifying him the instant the entity 061 * is created, deleted, or modified. 062 * 063 * <p> 064 * If there is no asset entry with the class name and class PK a new asset 065 * entry is created. 066 * </p> 067 * 068 * <p> 069 * A social activity for the subscription is created using the asset entry 070 * associated with the class name and class PK, or the newly created asset 071 * entry. 072 * </p> 073 * 074 * @param userId the primary key of the user 075 * @param groupId the primary key of the entity's group 076 * @param className the entity's class name 077 * @param classPK the primary key of the entity's instance 078 * @return the subscription 079 */ 080 public com.liferay.portal.model.Subscription addSubscription(long userId, 081 long groupId, java.lang.String className, long classPK) 082 throws PortalException; 083 084 /** 085 * Subscribes the user to the entity, notifying him at the given frequency. 086 * 087 * <p> 088 * If there is no asset entry with the class name and class PK a new asset 089 * entry is created. 090 * </p> 091 * 092 * <p> 093 * A social activity for the subscription is created using the asset entry 094 * associated with the class name and class PK, or the newly created asset 095 * entry. 096 * </p> 097 * 098 * @param userId the primary key of the user 099 * @param groupId the primary key of the entity's group 100 * @param className the entity's class name 101 * @param classPK the primary key of the entity's instance 102 * @param frequency the frequency for notifications 103 * @return the subscription 104 */ 105 public com.liferay.portal.model.Subscription addSubscription(long userId, 106 long groupId, java.lang.String className, long classPK, 107 java.lang.String frequency) throws PortalException; 108 109 /** 110 * Creates a new subscription with the primary key. Does not add the subscription to the database. 111 * 112 * @param subscriptionId the primary key for the new subscription 113 * @return the new subscription 114 */ 115 public com.liferay.portal.model.Subscription createSubscription( 116 long subscriptionId); 117 118 /** 119 * @throws PortalException 120 */ 121 @Override 122 public com.liferay.portal.model.PersistedModel deletePersistedModel( 123 com.liferay.portal.model.PersistedModel persistedModel) 124 throws PortalException; 125 126 /** 127 * Deletes the subscription from the database. Also notifies the appropriate model listeners. 128 * 129 * @param subscription the subscription 130 * @return the subscription that was removed 131 * @throws PortalException 132 */ 133 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 134 public com.liferay.portal.model.Subscription deleteSubscription( 135 com.liferay.portal.model.Subscription subscription) 136 throws PortalException; 137 138 /** 139 * Deletes the subscription with the primary key from the database. Also notifies the appropriate model listeners. 140 * 141 * @param subscriptionId the primary key of the subscription 142 * @return the subscription that was removed 143 * @throws PortalException if a subscription with the primary key could not be found 144 */ 145 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 146 public com.liferay.portal.model.Subscription deleteSubscription( 147 long subscriptionId) throws PortalException; 148 149 /** 150 * Deletes the user's subscription to the entity. A social activity with the 151 * unsubscribe action is created. 152 * 153 * @param userId the primary key of the user 154 * @param className the entity's class name 155 * @param classPK the primary key of the entity's instance 156 */ 157 public void deleteSubscription(long userId, java.lang.String className, 158 long classPK) throws PortalException; 159 160 /** 161 * Deletes all the subscriptions to the entity. 162 * 163 * @param companyId the primary key of the company 164 * @param className the entity's class name 165 * @param classPK the primary key of the entity's instance 166 */ 167 public void deleteSubscriptions(long companyId, java.lang.String className, 168 long classPK) throws PortalException; 169 170 /** 171 * Deletes all the subscriptions of the user. 172 * 173 * @param userId the primary key of the user 174 */ 175 public void deleteSubscriptions(long userId) throws PortalException; 176 177 public void deleteSubscriptions(long userId, long groupId) 178 throws PortalException; 179 180 public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery(); 181 182 /** 183 * Performs a dynamic query on the database and returns the matching rows. 184 * 185 * @param dynamicQuery the dynamic query 186 * @return the matching rows 187 */ 188 public <T> java.util.List<T> dynamicQuery( 189 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 190 191 /** 192 * Performs a dynamic query on the database and returns a range of the matching rows. 193 * 194 * <p> 195 * 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. 196 * </p> 197 * 198 * @param dynamicQuery the dynamic query 199 * @param start the lower bound of the range of model instances 200 * @param end the upper bound of the range of model instances (not inclusive) 201 * @return the range of matching rows 202 */ 203 public <T> java.util.List<T> dynamicQuery( 204 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 205 int end); 206 207 /** 208 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 209 * 210 * <p> 211 * 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. 212 * </p> 213 * 214 * @param dynamicQuery the dynamic query 215 * @param start the lower bound of the range of model instances 216 * @param end the upper bound of the range of model instances (not inclusive) 217 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 218 * @return the ordered range of matching rows 219 */ 220 public <T> java.util.List<T> dynamicQuery( 221 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 222 int end, 223 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator); 224 225 /** 226 * Returns the number of rows matching the dynamic query. 227 * 228 * @param dynamicQuery the dynamic query 229 * @return the number of rows matching the dynamic query 230 */ 231 public long dynamicQueryCount( 232 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 233 234 /** 235 * Returns the number of rows matching the dynamic query. 236 * 237 * @param dynamicQuery the dynamic query 238 * @param projection the projection to apply to the query 239 * @return the number of rows matching the dynamic query 240 */ 241 public long dynamicQueryCount( 242 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 243 com.liferay.portal.kernel.dao.orm.Projection projection); 244 245 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 246 public com.liferay.portal.model.Subscription fetchSubscription( 247 long companyId, long userId, java.lang.String className, long classPK); 248 249 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 250 public com.liferay.portal.model.Subscription fetchSubscription( 251 long subscriptionId); 252 253 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 254 public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery(); 255 256 /** 257 * Returns the OSGi service identifier. 258 * 259 * @return the OSGi service identifier 260 */ 261 public java.lang.String getOSGiServiceIdentifier(); 262 263 @Override 264 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 265 public com.liferay.portal.model.PersistedModel getPersistedModel( 266 java.io.Serializable primaryKeyObj) throws PortalException; 267 268 /** 269 * Returns the subscription of the user to the entity. 270 * 271 * @param companyId the primary key of the company 272 * @param userId the primary key of the user 273 * @param className the entity's class name 274 * @param classPK the primary key of the entity's instance 275 * @return the subscription of the user to the entity 276 */ 277 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 278 public com.liferay.portal.model.Subscription getSubscription( 279 long companyId, long userId, java.lang.String className, long classPK) 280 throws PortalException; 281 282 /** 283 * Returns the subscription with the primary key. 284 * 285 * @param subscriptionId the primary key of the subscription 286 * @return the subscription 287 * @throws PortalException if a subscription with the primary key could not be found 288 */ 289 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 290 public com.liferay.portal.model.Subscription getSubscription( 291 long subscriptionId) throws PortalException; 292 293 /** 294 * Returns all the subscriptions to the entity. 295 * 296 * @param companyId the primary key of the company 297 * @param className the entity's class name 298 * @param classPK the primary key of the entity's instance 299 * @return the subscriptions to the entity 300 */ 301 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 302 public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 303 long companyId, java.lang.String className, long classPK); 304 305 /** 306 * Returns all the subscriptions of the user to the entities. 307 * 308 * @param companyId the primary key of the company 309 * @param userId the primary key of the user 310 * @param className the entity's class name 311 * @param classPKs the primary key of the entities 312 * @return the subscriptions of the user to the entities 313 */ 314 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 315 public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 316 long companyId, long userId, java.lang.String className, long[] classPKs); 317 318 /** 319 * Returns a range of all the subscriptions. 320 * 321 * <p> 322 * 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. 323 * </p> 324 * 325 * @param start the lower bound of the range of subscriptions 326 * @param end the upper bound of the range of subscriptions (not inclusive) 327 * @return the range of subscriptions 328 */ 329 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 330 public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 331 int start, int end); 332 333 /** 334 * Returns the number of subscriptions. 335 * 336 * @return the number of subscriptions 337 */ 338 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 339 public int getSubscriptionsCount(); 340 341 /** 342 * Returns all the subscriptions of the user to the entities with the class 343 * name. 344 * 345 * @param userId the primary key of the user 346 * @param className the entity's class name 347 * @return the subscriptions of the user to the entities with the class name 348 */ 349 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 350 public java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 351 long userId, java.lang.String className); 352 353 /** 354 * Returns an ordered range of all the subscriptions of the user. 355 * 356 * @param userId the primary key of the user 357 * @param start the lower bound of the range of results 358 * @param end the upper bound of the range of results (not inclusive) 359 * @param orderByComparator the comparator to order the subscriptions 360 * @return the range of subscriptions of the user 361 */ 362 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 363 public java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 364 long userId, int start, int end, 365 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Subscription> orderByComparator); 366 367 /** 368 * Returns the number of subscriptions of the user. 369 * 370 * @param userId the primary key of the user 371 * @return the number of subscriptions of the user 372 */ 373 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 374 public int getUserSubscriptionsCount(long userId); 375 376 /** 377 * Returns <code>true</code> if the user is subscribed to the entity. 378 * 379 * @param companyId the primary key of the company 380 * @param userId the primary key of the user 381 * @param className the entity's class name 382 * @param classPK the primary key of the entity's instance 383 * @return <code>true</code> if the user is subscribed to the entity; 384 <code>false</code> otherwise 385 */ 386 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 387 public boolean isSubscribed(long companyId, long userId, 388 java.lang.String className, long classPK); 389 390 /** 391 * Returns <code>true</code> if the user is subscribed to any of the 392 * entities. 393 * 394 * @param companyId the primary key of the company 395 * @param userId the primary key of the user 396 * @param className the entity's class name 397 * @param classPKs the primary key of the entities 398 * @return <code>true</code> if the user is subscribed to any of the 399 entities; <code>false</code> otherwise 400 */ 401 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 402 public boolean isSubscribed(long companyId, long userId, 403 java.lang.String className, long[] classPKs); 404 405 /** 406 * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 407 * 408 * @param subscription the subscription 409 * @return the subscription that was updated 410 */ 411 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 412 public com.liferay.portal.model.Subscription updateSubscription( 413 com.liferay.portal.model.Subscription subscription); 414 }