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 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 257 public com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 258 259 /** 260 * Returns the OSGi service identifier. 261 * 262 * @return the OSGi service identifier 263 */ 264 public java.lang.String getOSGiServiceIdentifier(); 265 266 @Override 267 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 268 public com.liferay.portal.model.PersistedModel getPersistedModel( 269 java.io.Serializable primaryKeyObj) throws PortalException; 270 271 /** 272 * Returns the subscription of the user to the entity. 273 * 274 * @param companyId the primary key of the company 275 * @param userId the primary key of the user 276 * @param className the entity's class name 277 * @param classPK the primary key of the entity's instance 278 * @return the subscription of the user to the entity 279 */ 280 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 281 public com.liferay.portal.model.Subscription getSubscription( 282 long companyId, long userId, java.lang.String className, long classPK) 283 throws PortalException; 284 285 /** 286 * Returns the subscription with the primary key. 287 * 288 * @param subscriptionId the primary key of the subscription 289 * @return the subscription 290 * @throws PortalException if a subscription with the primary key could not be found 291 */ 292 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 293 public com.liferay.portal.model.Subscription getSubscription( 294 long subscriptionId) throws PortalException; 295 296 /** 297 * Returns all the subscriptions to the entity. 298 * 299 * @param companyId the primary key of the company 300 * @param className the entity's class name 301 * @param classPK the primary key of the entity's instance 302 * @return the subscriptions to the entity 303 */ 304 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 305 public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 306 long companyId, java.lang.String className, long classPK); 307 308 /** 309 * Returns all the subscriptions of the user to the entities. 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 classPKs the primary key of the entities 315 * @return the subscriptions of the user to the entities 316 */ 317 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 318 public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 319 long companyId, long userId, java.lang.String className, long[] classPKs); 320 321 /** 322 * Returns a range of all the subscriptions. 323 * 324 * <p> 325 * 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. 326 * </p> 327 * 328 * @param start the lower bound of the range of subscriptions 329 * @param end the upper bound of the range of subscriptions (not inclusive) 330 * @return the range of subscriptions 331 */ 332 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 333 public java.util.List<com.liferay.portal.model.Subscription> getSubscriptions( 334 int start, int end); 335 336 /** 337 * Returns the number of subscriptions. 338 * 339 * @return the number of subscriptions 340 */ 341 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 342 public int getSubscriptionsCount(); 343 344 /** 345 * Returns all the subscriptions of the user to the entities with the class 346 * name. 347 * 348 * @param userId the primary key of the user 349 * @param className the entity's class name 350 * @return the subscriptions of the user to the entities with the class name 351 */ 352 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 353 public java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 354 long userId, java.lang.String className); 355 356 /** 357 * Returns an ordered range of all the subscriptions of the user. 358 * 359 * @param userId the primary key of the user 360 * @param start the lower bound of the range of results 361 * @param end the upper bound of the range of results (not inclusive) 362 * @param orderByComparator the comparator to order the subscriptions 363 * @return the range of subscriptions of the user 364 */ 365 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 366 public java.util.List<com.liferay.portal.model.Subscription> getUserSubscriptions( 367 long userId, int start, int end, 368 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Subscription> orderByComparator); 369 370 /** 371 * Returns the number of subscriptions of the user. 372 * 373 * @param userId the primary key of the user 374 * @return the number of subscriptions of the user 375 */ 376 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 377 public int getUserSubscriptionsCount(long userId); 378 379 /** 380 * Returns <code>true</code> if the user is subscribed to the entity. 381 * 382 * @param companyId the primary key of the company 383 * @param userId the primary key of the user 384 * @param className the entity's class name 385 * @param classPK the primary key of the entity's instance 386 * @return <code>true</code> if the user is subscribed to the entity; 387 <code>false</code> otherwise 388 */ 389 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 390 public boolean isSubscribed(long companyId, long userId, 391 java.lang.String className, long classPK); 392 393 /** 394 * Returns <code>true</code> if the user is subscribed to any of the 395 * entities. 396 * 397 * @param companyId the primary key of the company 398 * @param userId the primary key of the user 399 * @param className the entity's class name 400 * @param classPKs the primary key of the entities 401 * @return <code>true</code> if the user is subscribed to any of the 402 entities; <code>false</code> otherwise 403 */ 404 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 405 public boolean isSubscribed(long companyId, long userId, 406 java.lang.String className, long[] classPKs); 407 408 /** 409 * Updates the subscription in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 410 * 411 * @param subscription the subscription 412 * @return the subscription that was updated 413 */ 414 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 415 public com.liferay.portal.model.Subscription updateSubscription( 416 com.liferay.portal.model.Subscription subscription); 417 }