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