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