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