001    /**
002     * Copyright (c) 2000-2010 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.portlet.announcements.service.base;
016    
017    import com.liferay.counter.service.CounterLocalService;
018    
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
021    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
022    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
023    import com.liferay.portal.kernel.exception.PortalException;
024    import com.liferay.portal.kernel.exception.SystemException;
025    import com.liferay.portal.kernel.util.OrderByComparator;
026    import com.liferay.portal.service.ResourceLocalService;
027    import com.liferay.portal.service.ResourceService;
028    import com.liferay.portal.service.UserLocalService;
029    import com.liferay.portal.service.UserService;
030    import com.liferay.portal.service.persistence.ResourceFinder;
031    import com.liferay.portal.service.persistence.ResourcePersistence;
032    import com.liferay.portal.service.persistence.UserFinder;
033    import com.liferay.portal.service.persistence.UserPersistence;
034    
035    import com.liferay.portlet.announcements.model.AnnouncementsDelivery;
036    import com.liferay.portlet.announcements.service.AnnouncementsDeliveryLocalService;
037    import com.liferay.portlet.announcements.service.AnnouncementsDeliveryService;
038    import com.liferay.portlet.announcements.service.AnnouncementsEntryLocalService;
039    import com.liferay.portlet.announcements.service.AnnouncementsEntryService;
040    import com.liferay.portlet.announcements.service.AnnouncementsFlagLocalService;
041    import com.liferay.portlet.announcements.service.AnnouncementsFlagService;
042    import com.liferay.portlet.announcements.service.persistence.AnnouncementsDeliveryPersistence;
043    import com.liferay.portlet.announcements.service.persistence.AnnouncementsEntryFinder;
044    import com.liferay.portlet.announcements.service.persistence.AnnouncementsEntryPersistence;
045    import com.liferay.portlet.announcements.service.persistence.AnnouncementsFlagPersistence;
046    
047    import java.util.List;
048    
049    import javax.sql.DataSource;
050    
051    /**
052     * The base implementation of the announcements delivery local service.
053     *
054     * <p>
055     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portlet.announcements.service.impl.AnnouncementsDeliveryLocalServiceImpl}.
056     * </p>
057     *
058     * <p>
059     * Never modify or reference this class directly. Always use {@link com.liferay.portlet.announcements.service.AnnouncementsDeliveryLocalServiceUtil} to access the announcements delivery local service.
060     * </p>
061     *
062     * @author Brian Wing Shun Chan
063     * @see com.liferay.portlet.announcements.service.impl.AnnouncementsDeliveryLocalServiceImpl
064     * @see com.liferay.portlet.announcements.service.AnnouncementsDeliveryLocalServiceUtil
065     * @generated
066     */
067    public abstract class AnnouncementsDeliveryLocalServiceBaseImpl
068            implements AnnouncementsDeliveryLocalService {
069            /**
070             * Adds the announcements delivery to the database. Also notifies the appropriate model listeners.
071             *
072             * @param announcementsDelivery the announcements delivery to add
073             * @return the announcements delivery that was added
074             * @throws SystemException if a system exception occurred
075             */
076            public AnnouncementsDelivery addAnnouncementsDelivery(
077                    AnnouncementsDelivery announcementsDelivery) throws SystemException {
078                    announcementsDelivery.setNew(true);
079    
080                    return announcementsDeliveryPersistence.update(announcementsDelivery,
081                            false);
082            }
083    
084            /**
085             * Creates a new announcements delivery with the primary key. Does not add the announcements delivery to the database.
086             *
087             * @param deliveryId the primary key for the new announcements delivery
088             * @return the new announcements delivery
089             */
090            public AnnouncementsDelivery createAnnouncementsDelivery(long deliveryId) {
091                    return announcementsDeliveryPersistence.create(deliveryId);
092            }
093    
094            /**
095             * Deletes the announcements delivery with the primary key from the database. Also notifies the appropriate model listeners.
096             *
097             * @param deliveryId the primary key of the announcements delivery to delete
098             * @throws PortalException if a announcements delivery with the primary key could not be found
099             * @throws SystemException if a system exception occurred
100             */
101            public void deleteAnnouncementsDelivery(long deliveryId)
102                    throws PortalException, SystemException {
103                    announcementsDeliveryPersistence.remove(deliveryId);
104            }
105    
106            /**
107             * Deletes the announcements delivery from the database. Also notifies the appropriate model listeners.
108             *
109             * @param announcementsDelivery the announcements delivery to delete
110             * @throws SystemException if a system exception occurred
111             */
112            public void deleteAnnouncementsDelivery(
113                    AnnouncementsDelivery announcementsDelivery) throws SystemException {
114                    announcementsDeliveryPersistence.remove(announcementsDelivery);
115            }
116    
117            /**
118             * Performs a dynamic query on the database and returns the matching rows.
119             *
120             * @param dynamicQuery the dynamic query to search with
121             * @return the matching rows
122             * @throws SystemException if a system exception occurred
123             */
124            @SuppressWarnings("rawtypes")
125            public List dynamicQuery(DynamicQuery dynamicQuery)
126                    throws SystemException {
127                    return announcementsDeliveryPersistence.findWithDynamicQuery(dynamicQuery);
128            }
129    
130            /**
131             * Performs a dynamic query on the database and returns a range of the matching rows.
132             *
133             * <p>
134             * 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.
135             * </p>
136             *
137             * @param dynamicQuery the dynamic query to search with
138             * @param start the lower bound of the range of model instances to return
139             * @param end the upper bound of the range of model instances to return (not inclusive)
140             * @return the range of matching rows
141             * @throws SystemException if a system exception occurred
142             */
143            @SuppressWarnings("rawtypes")
144            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
145                    throws SystemException {
146                    return announcementsDeliveryPersistence.findWithDynamicQuery(dynamicQuery,
147                            start, end);
148            }
149    
150            /**
151             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
152             *
153             * <p>
154             * 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.
155             * </p>
156             *
157             * @param dynamicQuery the dynamic query to search with
158             * @param start the lower bound of the range of model instances to return
159             * @param end the upper bound of the range of model instances to return (not inclusive)
160             * @param orderByComparator the comparator to order the results by
161             * @return the ordered range of matching rows
162             * @throws SystemException if a system exception occurred
163             */
164            @SuppressWarnings("rawtypes")
165            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
166                    OrderByComparator orderByComparator) throws SystemException {
167                    return announcementsDeliveryPersistence.findWithDynamicQuery(dynamicQuery,
168                            start, end, orderByComparator);
169            }
170    
171            /**
172             * Counts the number of rows that match the dynamic query.
173             *
174             * @param dynamicQuery the dynamic query to search with
175             * @return the number of rows that match the dynamic query
176             * @throws SystemException if a system exception occurred
177             */
178            public long dynamicQueryCount(DynamicQuery dynamicQuery)
179                    throws SystemException {
180                    return announcementsDeliveryPersistence.countWithDynamicQuery(dynamicQuery);
181            }
182    
183            /**
184             * Gets the announcements delivery with the primary key.
185             *
186             * @param deliveryId the primary key of the announcements delivery to get
187             * @return the announcements delivery
188             * @throws PortalException if a announcements delivery with the primary key could not be found
189             * @throws SystemException if a system exception occurred
190             */
191            public AnnouncementsDelivery getAnnouncementsDelivery(long deliveryId)
192                    throws PortalException, SystemException {
193                    return announcementsDeliveryPersistence.findByPrimaryKey(deliveryId);
194            }
195    
196            /**
197             * Gets a range of all the announcements deliveries.
198             *
199             * <p>
200             * 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.
201             * </p>
202             *
203             * @param start the lower bound of the range of announcements deliveries to return
204             * @param end the upper bound of the range of announcements deliveries to return (not inclusive)
205             * @return the range of announcements deliveries
206             * @throws SystemException if a system exception occurred
207             */
208            public List<AnnouncementsDelivery> getAnnouncementsDeliveries(int start,
209                    int end) throws SystemException {
210                    return announcementsDeliveryPersistence.findAll(start, end);
211            }
212    
213            /**
214             * Gets the number of announcements deliveries.
215             *
216             * @return the number of announcements deliveries
217             * @throws SystemException if a system exception occurred
218             */
219            public int getAnnouncementsDeliveriesCount() throws SystemException {
220                    return announcementsDeliveryPersistence.countAll();
221            }
222    
223            /**
224             * Updates the announcements delivery in the database. Also notifies the appropriate model listeners.
225             *
226             * @param announcementsDelivery the announcements delivery to update
227             * @return the announcements delivery that was updated
228             * @throws SystemException if a system exception occurred
229             */
230            public AnnouncementsDelivery updateAnnouncementsDelivery(
231                    AnnouncementsDelivery announcementsDelivery) throws SystemException {
232                    announcementsDelivery.setNew(false);
233    
234                    return announcementsDeliveryPersistence.update(announcementsDelivery,
235                            true);
236            }
237    
238            /**
239             * Updates the announcements delivery in the database. Also notifies the appropriate model listeners.
240             *
241             * @param announcementsDelivery the announcements delivery to update
242             * @param merge whether to merge the announcements delivery with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
243             * @return the announcements delivery that was updated
244             * @throws SystemException if a system exception occurred
245             */
246            public AnnouncementsDelivery updateAnnouncementsDelivery(
247                    AnnouncementsDelivery announcementsDelivery, boolean merge)
248                    throws SystemException {
249                    announcementsDelivery.setNew(false);
250    
251                    return announcementsDeliveryPersistence.update(announcementsDelivery,
252                            merge);
253            }
254    
255            /**
256             * Gets the announcements delivery local service.
257             *
258             * @return the announcements delivery local service
259             */
260            public AnnouncementsDeliveryLocalService getAnnouncementsDeliveryLocalService() {
261                    return announcementsDeliveryLocalService;
262            }
263    
264            /**
265             * Sets the announcements delivery local service.
266             *
267             * @param announcementsDeliveryLocalService the announcements delivery local service
268             */
269            public void setAnnouncementsDeliveryLocalService(
270                    AnnouncementsDeliveryLocalService announcementsDeliveryLocalService) {
271                    this.announcementsDeliveryLocalService = announcementsDeliveryLocalService;
272            }
273    
274            /**
275             * Gets the announcements delivery remote service.
276             *
277             * @return the announcements delivery remote service
278             */
279            public AnnouncementsDeliveryService getAnnouncementsDeliveryService() {
280                    return announcementsDeliveryService;
281            }
282    
283            /**
284             * Sets the announcements delivery remote service.
285             *
286             * @param announcementsDeliveryService the announcements delivery remote service
287             */
288            public void setAnnouncementsDeliveryService(
289                    AnnouncementsDeliveryService announcementsDeliveryService) {
290                    this.announcementsDeliveryService = announcementsDeliveryService;
291            }
292    
293            /**
294             * Gets the announcements delivery persistence.
295             *
296             * @return the announcements delivery persistence
297             */
298            public AnnouncementsDeliveryPersistence getAnnouncementsDeliveryPersistence() {
299                    return announcementsDeliveryPersistence;
300            }
301    
302            /**
303             * Sets the announcements delivery persistence.
304             *
305             * @param announcementsDeliveryPersistence the announcements delivery persistence
306             */
307            public void setAnnouncementsDeliveryPersistence(
308                    AnnouncementsDeliveryPersistence announcementsDeliveryPersistence) {
309                    this.announcementsDeliveryPersistence = announcementsDeliveryPersistence;
310            }
311    
312            /**
313             * Gets the announcements entry local service.
314             *
315             * @return the announcements entry local service
316             */
317            public AnnouncementsEntryLocalService getAnnouncementsEntryLocalService() {
318                    return announcementsEntryLocalService;
319            }
320    
321            /**
322             * Sets the announcements entry local service.
323             *
324             * @param announcementsEntryLocalService the announcements entry local service
325             */
326            public void setAnnouncementsEntryLocalService(
327                    AnnouncementsEntryLocalService announcementsEntryLocalService) {
328                    this.announcementsEntryLocalService = announcementsEntryLocalService;
329            }
330    
331            /**
332             * Gets the announcements entry remote service.
333             *
334             * @return the announcements entry remote service
335             */
336            public AnnouncementsEntryService getAnnouncementsEntryService() {
337                    return announcementsEntryService;
338            }
339    
340            /**
341             * Sets the announcements entry remote service.
342             *
343             * @param announcementsEntryService the announcements entry remote service
344             */
345            public void setAnnouncementsEntryService(
346                    AnnouncementsEntryService announcementsEntryService) {
347                    this.announcementsEntryService = announcementsEntryService;
348            }
349    
350            /**
351             * Gets the announcements entry persistence.
352             *
353             * @return the announcements entry persistence
354             */
355            public AnnouncementsEntryPersistence getAnnouncementsEntryPersistence() {
356                    return announcementsEntryPersistence;
357            }
358    
359            /**
360             * Sets the announcements entry persistence.
361             *
362             * @param announcementsEntryPersistence the announcements entry persistence
363             */
364            public void setAnnouncementsEntryPersistence(
365                    AnnouncementsEntryPersistence announcementsEntryPersistence) {
366                    this.announcementsEntryPersistence = announcementsEntryPersistence;
367            }
368    
369            /**
370             * Gets the announcements entry finder.
371             *
372             * @return the announcements entry finder
373             */
374            public AnnouncementsEntryFinder getAnnouncementsEntryFinder() {
375                    return announcementsEntryFinder;
376            }
377    
378            /**
379             * Sets the announcements entry finder.
380             *
381             * @param announcementsEntryFinder the announcements entry finder
382             */
383            public void setAnnouncementsEntryFinder(
384                    AnnouncementsEntryFinder announcementsEntryFinder) {
385                    this.announcementsEntryFinder = announcementsEntryFinder;
386            }
387    
388            /**
389             * Gets the announcements flag local service.
390             *
391             * @return the announcements flag local service
392             */
393            public AnnouncementsFlagLocalService getAnnouncementsFlagLocalService() {
394                    return announcementsFlagLocalService;
395            }
396    
397            /**
398             * Sets the announcements flag local service.
399             *
400             * @param announcementsFlagLocalService the announcements flag local service
401             */
402            public void setAnnouncementsFlagLocalService(
403                    AnnouncementsFlagLocalService announcementsFlagLocalService) {
404                    this.announcementsFlagLocalService = announcementsFlagLocalService;
405            }
406    
407            /**
408             * Gets the announcements flag remote service.
409             *
410             * @return the announcements flag remote service
411             */
412            public AnnouncementsFlagService getAnnouncementsFlagService() {
413                    return announcementsFlagService;
414            }
415    
416            /**
417             * Sets the announcements flag remote service.
418             *
419             * @param announcementsFlagService the announcements flag remote service
420             */
421            public void setAnnouncementsFlagService(
422                    AnnouncementsFlagService announcementsFlagService) {
423                    this.announcementsFlagService = announcementsFlagService;
424            }
425    
426            /**
427             * Gets the announcements flag persistence.
428             *
429             * @return the announcements flag persistence
430             */
431            public AnnouncementsFlagPersistence getAnnouncementsFlagPersistence() {
432                    return announcementsFlagPersistence;
433            }
434    
435            /**
436             * Sets the announcements flag persistence.
437             *
438             * @param announcementsFlagPersistence the announcements flag persistence
439             */
440            public void setAnnouncementsFlagPersistence(
441                    AnnouncementsFlagPersistence announcementsFlagPersistence) {
442                    this.announcementsFlagPersistence = announcementsFlagPersistence;
443            }
444    
445            /**
446             * Gets the counter local service.
447             *
448             * @return the counter local service
449             */
450            public CounterLocalService getCounterLocalService() {
451                    return counterLocalService;
452            }
453    
454            /**
455             * Sets the counter local service.
456             *
457             * @param counterLocalService the counter local service
458             */
459            public void setCounterLocalService(CounterLocalService counterLocalService) {
460                    this.counterLocalService = counterLocalService;
461            }
462    
463            /**
464             * Gets the resource local service.
465             *
466             * @return the resource local service
467             */
468            public ResourceLocalService getResourceLocalService() {
469                    return resourceLocalService;
470            }
471    
472            /**
473             * Sets the resource local service.
474             *
475             * @param resourceLocalService the resource local service
476             */
477            public void setResourceLocalService(
478                    ResourceLocalService resourceLocalService) {
479                    this.resourceLocalService = resourceLocalService;
480            }
481    
482            /**
483             * Gets the resource remote service.
484             *
485             * @return the resource remote service
486             */
487            public ResourceService getResourceService() {
488                    return resourceService;
489            }
490    
491            /**
492             * Sets the resource remote service.
493             *
494             * @param resourceService the resource remote service
495             */
496            public void setResourceService(ResourceService resourceService) {
497                    this.resourceService = resourceService;
498            }
499    
500            /**
501             * Gets the resource persistence.
502             *
503             * @return the resource persistence
504             */
505            public ResourcePersistence getResourcePersistence() {
506                    return resourcePersistence;
507            }
508    
509            /**
510             * Sets the resource persistence.
511             *
512             * @param resourcePersistence the resource persistence
513             */
514            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
515                    this.resourcePersistence = resourcePersistence;
516            }
517    
518            /**
519             * Gets the resource finder.
520             *
521             * @return the resource finder
522             */
523            public ResourceFinder getResourceFinder() {
524                    return resourceFinder;
525            }
526    
527            /**
528             * Sets the resource finder.
529             *
530             * @param resourceFinder the resource finder
531             */
532            public void setResourceFinder(ResourceFinder resourceFinder) {
533                    this.resourceFinder = resourceFinder;
534            }
535    
536            /**
537             * Gets the user local service.
538             *
539             * @return the user local service
540             */
541            public UserLocalService getUserLocalService() {
542                    return userLocalService;
543            }
544    
545            /**
546             * Sets the user local service.
547             *
548             * @param userLocalService the user local service
549             */
550            public void setUserLocalService(UserLocalService userLocalService) {
551                    this.userLocalService = userLocalService;
552            }
553    
554            /**
555             * Gets the user remote service.
556             *
557             * @return the user remote service
558             */
559            public UserService getUserService() {
560                    return userService;
561            }
562    
563            /**
564             * Sets the user remote service.
565             *
566             * @param userService the user remote service
567             */
568            public void setUserService(UserService userService) {
569                    this.userService = userService;
570            }
571    
572            /**
573             * Gets the user persistence.
574             *
575             * @return the user persistence
576             */
577            public UserPersistence getUserPersistence() {
578                    return userPersistence;
579            }
580    
581            /**
582             * Sets the user persistence.
583             *
584             * @param userPersistence the user persistence
585             */
586            public void setUserPersistence(UserPersistence userPersistence) {
587                    this.userPersistence = userPersistence;
588            }
589    
590            /**
591             * Gets the user finder.
592             *
593             * @return the user finder
594             */
595            public UserFinder getUserFinder() {
596                    return userFinder;
597            }
598    
599            /**
600             * Sets the user finder.
601             *
602             * @param userFinder the user finder
603             */
604            public void setUserFinder(UserFinder userFinder) {
605                    this.userFinder = userFinder;
606            }
607    
608            /**
609             * Performs an SQL query.
610             *
611             * @param sql the sql query to perform
612             */
613            protected void runSQL(String sql) throws SystemException {
614                    try {
615                            DataSource dataSource = announcementsDeliveryPersistence.getDataSource();
616    
617                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
618                                            sql, new int[0]);
619    
620                            sqlUpdate.update();
621                    }
622                    catch (Exception e) {
623                            throw new SystemException(e);
624                    }
625            }
626    
627            @BeanReference(type = AnnouncementsDeliveryLocalService.class)
628            protected AnnouncementsDeliveryLocalService announcementsDeliveryLocalService;
629            @BeanReference(type = AnnouncementsDeliveryService.class)
630            protected AnnouncementsDeliveryService announcementsDeliveryService;
631            @BeanReference(type = AnnouncementsDeliveryPersistence.class)
632            protected AnnouncementsDeliveryPersistence announcementsDeliveryPersistence;
633            @BeanReference(type = AnnouncementsEntryLocalService.class)
634            protected AnnouncementsEntryLocalService announcementsEntryLocalService;
635            @BeanReference(type = AnnouncementsEntryService.class)
636            protected AnnouncementsEntryService announcementsEntryService;
637            @BeanReference(type = AnnouncementsEntryPersistence.class)
638            protected AnnouncementsEntryPersistence announcementsEntryPersistence;
639            @BeanReference(type = AnnouncementsEntryFinder.class)
640            protected AnnouncementsEntryFinder announcementsEntryFinder;
641            @BeanReference(type = AnnouncementsFlagLocalService.class)
642            protected AnnouncementsFlagLocalService announcementsFlagLocalService;
643            @BeanReference(type = AnnouncementsFlagService.class)
644            protected AnnouncementsFlagService announcementsFlagService;
645            @BeanReference(type = AnnouncementsFlagPersistence.class)
646            protected AnnouncementsFlagPersistence announcementsFlagPersistence;
647            @BeanReference(type = CounterLocalService.class)
648            protected CounterLocalService counterLocalService;
649            @BeanReference(type = ResourceLocalService.class)
650            protected ResourceLocalService resourceLocalService;
651            @BeanReference(type = ResourceService.class)
652            protected ResourceService resourceService;
653            @BeanReference(type = ResourcePersistence.class)
654            protected ResourcePersistence resourcePersistence;
655            @BeanReference(type = ResourceFinder.class)
656            protected ResourceFinder resourceFinder;
657            @BeanReference(type = UserLocalService.class)
658            protected UserLocalService userLocalService;
659            @BeanReference(type = UserService.class)
660            protected UserService userService;
661            @BeanReference(type = UserPersistence.class)
662            protected UserPersistence userPersistence;
663            @BeanReference(type = UserFinder.class)
664            protected UserFinder userFinder;
665    }