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.journal.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.ImageLocalService;
027    import com.liferay.portal.service.ImageService;
028    import com.liferay.portal.service.ResourceLocalService;
029    import com.liferay.portal.service.ResourceService;
030    import com.liferay.portal.service.UserLocalService;
031    import com.liferay.portal.service.UserService;
032    import com.liferay.portal.service.WebDAVPropsLocalService;
033    import com.liferay.portal.service.persistence.ImagePersistence;
034    import com.liferay.portal.service.persistence.ResourceFinder;
035    import com.liferay.portal.service.persistence.ResourcePersistence;
036    import com.liferay.portal.service.persistence.UserFinder;
037    import com.liferay.portal.service.persistence.UserPersistence;
038    import com.liferay.portal.service.persistence.WebDAVPropsPersistence;
039    
040    import com.liferay.portlet.expando.service.ExpandoValueLocalService;
041    import com.liferay.portlet.expando.service.ExpandoValueService;
042    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
043    import com.liferay.portlet.journal.model.JournalTemplate;
044    import com.liferay.portlet.journal.service.JournalArticleImageLocalService;
045    import com.liferay.portlet.journal.service.JournalArticleLocalService;
046    import com.liferay.portlet.journal.service.JournalArticleResourceLocalService;
047    import com.liferay.portlet.journal.service.JournalArticleService;
048    import com.liferay.portlet.journal.service.JournalContentSearchLocalService;
049    import com.liferay.portlet.journal.service.JournalFeedLocalService;
050    import com.liferay.portlet.journal.service.JournalFeedService;
051    import com.liferay.portlet.journal.service.JournalStructureLocalService;
052    import com.liferay.portlet.journal.service.JournalStructureService;
053    import com.liferay.portlet.journal.service.JournalTemplateLocalService;
054    import com.liferay.portlet.journal.service.JournalTemplateService;
055    import com.liferay.portlet.journal.service.persistence.JournalArticleFinder;
056    import com.liferay.portlet.journal.service.persistence.JournalArticleImagePersistence;
057    import com.liferay.portlet.journal.service.persistence.JournalArticlePersistence;
058    import com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence;
059    import com.liferay.portlet.journal.service.persistence.JournalContentSearchPersistence;
060    import com.liferay.portlet.journal.service.persistence.JournalFeedFinder;
061    import com.liferay.portlet.journal.service.persistence.JournalFeedPersistence;
062    import com.liferay.portlet.journal.service.persistence.JournalStructureFinder;
063    import com.liferay.portlet.journal.service.persistence.JournalStructurePersistence;
064    import com.liferay.portlet.journal.service.persistence.JournalTemplateFinder;
065    import com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence;
066    
067    import java.util.List;
068    
069    import javax.sql.DataSource;
070    
071    /**
072     * @author Brian Wing Shun Chan
073     */
074    public abstract class JournalTemplateLocalServiceBaseImpl
075            implements JournalTemplateLocalService {
076            public JournalTemplate addJournalTemplate(JournalTemplate journalTemplate)
077                    throws SystemException {
078                    journalTemplate.setNew(true);
079    
080                    return journalTemplatePersistence.update(journalTemplate, false);
081            }
082    
083            public JournalTemplate createJournalTemplate(long id) {
084                    return journalTemplatePersistence.create(id);
085            }
086    
087            public void deleteJournalTemplate(long id)
088                    throws PortalException, SystemException {
089                    journalTemplatePersistence.remove(id);
090            }
091    
092            public void deleteJournalTemplate(JournalTemplate journalTemplate)
093                    throws SystemException {
094                    journalTemplatePersistence.remove(journalTemplate);
095            }
096    
097            @SuppressWarnings("unchecked")
098            public List dynamicQuery(DynamicQuery dynamicQuery)
099                    throws SystemException {
100                    return journalTemplatePersistence.findWithDynamicQuery(dynamicQuery);
101            }
102    
103            @SuppressWarnings("unchecked")
104            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
105                    throws SystemException {
106                    return journalTemplatePersistence.findWithDynamicQuery(dynamicQuery,
107                            start, end);
108            }
109    
110            @SuppressWarnings("unchecked")
111            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
112                    OrderByComparator orderByComparator) throws SystemException {
113                    return journalTemplatePersistence.findWithDynamicQuery(dynamicQuery,
114                            start, end, orderByComparator);
115            }
116    
117            public long dynamicQueryCount(DynamicQuery dynamicQuery)
118                    throws SystemException {
119                    return journalTemplatePersistence.countWithDynamicQuery(dynamicQuery);
120            }
121    
122            public JournalTemplate getJournalTemplate(long id)
123                    throws PortalException, SystemException {
124                    return journalTemplatePersistence.findByPrimaryKey(id);
125            }
126    
127            public JournalTemplate getJournalTemplateByUuidAndGroupId(String uuid,
128                    long groupId) throws PortalException, SystemException {
129                    return journalTemplatePersistence.findByUUID_G(uuid, groupId);
130            }
131    
132            public List<JournalTemplate> getJournalTemplates(int start, int end)
133                    throws SystemException {
134                    return journalTemplatePersistence.findAll(start, end);
135            }
136    
137            public int getJournalTemplatesCount() throws SystemException {
138                    return journalTemplatePersistence.countAll();
139            }
140    
141            public JournalTemplate updateJournalTemplate(
142                    JournalTemplate journalTemplate) throws SystemException {
143                    journalTemplate.setNew(false);
144    
145                    return journalTemplatePersistence.update(journalTemplate, true);
146            }
147    
148            public JournalTemplate updateJournalTemplate(
149                    JournalTemplate journalTemplate, boolean merge)
150                    throws SystemException {
151                    journalTemplate.setNew(false);
152    
153                    return journalTemplatePersistence.update(journalTemplate, merge);
154            }
155    
156            public JournalArticleLocalService getJournalArticleLocalService() {
157                    return journalArticleLocalService;
158            }
159    
160            public void setJournalArticleLocalService(
161                    JournalArticleLocalService journalArticleLocalService) {
162                    this.journalArticleLocalService = journalArticleLocalService;
163            }
164    
165            public JournalArticleService getJournalArticleService() {
166                    return journalArticleService;
167            }
168    
169            public void setJournalArticleService(
170                    JournalArticleService journalArticleService) {
171                    this.journalArticleService = journalArticleService;
172            }
173    
174            public JournalArticlePersistence getJournalArticlePersistence() {
175                    return journalArticlePersistence;
176            }
177    
178            public void setJournalArticlePersistence(
179                    JournalArticlePersistence journalArticlePersistence) {
180                    this.journalArticlePersistence = journalArticlePersistence;
181            }
182    
183            public JournalArticleFinder getJournalArticleFinder() {
184                    return journalArticleFinder;
185            }
186    
187            public void setJournalArticleFinder(
188                    JournalArticleFinder journalArticleFinder) {
189                    this.journalArticleFinder = journalArticleFinder;
190            }
191    
192            public JournalArticleImageLocalService getJournalArticleImageLocalService() {
193                    return journalArticleImageLocalService;
194            }
195    
196            public void setJournalArticleImageLocalService(
197                    JournalArticleImageLocalService journalArticleImageLocalService) {
198                    this.journalArticleImageLocalService = journalArticleImageLocalService;
199            }
200    
201            public JournalArticleImagePersistence getJournalArticleImagePersistence() {
202                    return journalArticleImagePersistence;
203            }
204    
205            public void setJournalArticleImagePersistence(
206                    JournalArticleImagePersistence journalArticleImagePersistence) {
207                    this.journalArticleImagePersistence = journalArticleImagePersistence;
208            }
209    
210            public JournalArticleResourceLocalService getJournalArticleResourceLocalService() {
211                    return journalArticleResourceLocalService;
212            }
213    
214            public void setJournalArticleResourceLocalService(
215                    JournalArticleResourceLocalService journalArticleResourceLocalService) {
216                    this.journalArticleResourceLocalService = journalArticleResourceLocalService;
217            }
218    
219            public JournalArticleResourcePersistence getJournalArticleResourcePersistence() {
220                    return journalArticleResourcePersistence;
221            }
222    
223            public void setJournalArticleResourcePersistence(
224                    JournalArticleResourcePersistence journalArticleResourcePersistence) {
225                    this.journalArticleResourcePersistence = journalArticleResourcePersistence;
226            }
227    
228            public JournalContentSearchLocalService getJournalContentSearchLocalService() {
229                    return journalContentSearchLocalService;
230            }
231    
232            public void setJournalContentSearchLocalService(
233                    JournalContentSearchLocalService journalContentSearchLocalService) {
234                    this.journalContentSearchLocalService = journalContentSearchLocalService;
235            }
236    
237            public JournalContentSearchPersistence getJournalContentSearchPersistence() {
238                    return journalContentSearchPersistence;
239            }
240    
241            public void setJournalContentSearchPersistence(
242                    JournalContentSearchPersistence journalContentSearchPersistence) {
243                    this.journalContentSearchPersistence = journalContentSearchPersistence;
244            }
245    
246            public JournalFeedLocalService getJournalFeedLocalService() {
247                    return journalFeedLocalService;
248            }
249    
250            public void setJournalFeedLocalService(
251                    JournalFeedLocalService journalFeedLocalService) {
252                    this.journalFeedLocalService = journalFeedLocalService;
253            }
254    
255            public JournalFeedService getJournalFeedService() {
256                    return journalFeedService;
257            }
258    
259            public void setJournalFeedService(JournalFeedService journalFeedService) {
260                    this.journalFeedService = journalFeedService;
261            }
262    
263            public JournalFeedPersistence getJournalFeedPersistence() {
264                    return journalFeedPersistence;
265            }
266    
267            public void setJournalFeedPersistence(
268                    JournalFeedPersistence journalFeedPersistence) {
269                    this.journalFeedPersistence = journalFeedPersistence;
270            }
271    
272            public JournalFeedFinder getJournalFeedFinder() {
273                    return journalFeedFinder;
274            }
275    
276            public void setJournalFeedFinder(JournalFeedFinder journalFeedFinder) {
277                    this.journalFeedFinder = journalFeedFinder;
278            }
279    
280            public JournalStructureLocalService getJournalStructureLocalService() {
281                    return journalStructureLocalService;
282            }
283    
284            public void setJournalStructureLocalService(
285                    JournalStructureLocalService journalStructureLocalService) {
286                    this.journalStructureLocalService = journalStructureLocalService;
287            }
288    
289            public JournalStructureService getJournalStructureService() {
290                    return journalStructureService;
291            }
292    
293            public void setJournalStructureService(
294                    JournalStructureService journalStructureService) {
295                    this.journalStructureService = journalStructureService;
296            }
297    
298            public JournalStructurePersistence getJournalStructurePersistence() {
299                    return journalStructurePersistence;
300            }
301    
302            public void setJournalStructurePersistence(
303                    JournalStructurePersistence journalStructurePersistence) {
304                    this.journalStructurePersistence = journalStructurePersistence;
305            }
306    
307            public JournalStructureFinder getJournalStructureFinder() {
308                    return journalStructureFinder;
309            }
310    
311            public void setJournalStructureFinder(
312                    JournalStructureFinder journalStructureFinder) {
313                    this.journalStructureFinder = journalStructureFinder;
314            }
315    
316            public JournalTemplateLocalService getJournalTemplateLocalService() {
317                    return journalTemplateLocalService;
318            }
319    
320            public void setJournalTemplateLocalService(
321                    JournalTemplateLocalService journalTemplateLocalService) {
322                    this.journalTemplateLocalService = journalTemplateLocalService;
323            }
324    
325            public JournalTemplateService getJournalTemplateService() {
326                    return journalTemplateService;
327            }
328    
329            public void setJournalTemplateService(
330                    JournalTemplateService journalTemplateService) {
331                    this.journalTemplateService = journalTemplateService;
332            }
333    
334            public JournalTemplatePersistence getJournalTemplatePersistence() {
335                    return journalTemplatePersistence;
336            }
337    
338            public void setJournalTemplatePersistence(
339                    JournalTemplatePersistence journalTemplatePersistence) {
340                    this.journalTemplatePersistence = journalTemplatePersistence;
341            }
342    
343            public JournalTemplateFinder getJournalTemplateFinder() {
344                    return journalTemplateFinder;
345            }
346    
347            public void setJournalTemplateFinder(
348                    JournalTemplateFinder journalTemplateFinder) {
349                    this.journalTemplateFinder = journalTemplateFinder;
350            }
351    
352            public CounterLocalService getCounterLocalService() {
353                    return counterLocalService;
354            }
355    
356            public void setCounterLocalService(CounterLocalService counterLocalService) {
357                    this.counterLocalService = counterLocalService;
358            }
359    
360            public ImageLocalService getImageLocalService() {
361                    return imageLocalService;
362            }
363    
364            public void setImageLocalService(ImageLocalService imageLocalService) {
365                    this.imageLocalService = imageLocalService;
366            }
367    
368            public ImageService getImageService() {
369                    return imageService;
370            }
371    
372            public void setImageService(ImageService imageService) {
373                    this.imageService = imageService;
374            }
375    
376            public ImagePersistence getImagePersistence() {
377                    return imagePersistence;
378            }
379    
380            public void setImagePersistence(ImagePersistence imagePersistence) {
381                    this.imagePersistence = imagePersistence;
382            }
383    
384            public ResourceLocalService getResourceLocalService() {
385                    return resourceLocalService;
386            }
387    
388            public void setResourceLocalService(
389                    ResourceLocalService resourceLocalService) {
390                    this.resourceLocalService = resourceLocalService;
391            }
392    
393            public ResourceService getResourceService() {
394                    return resourceService;
395            }
396    
397            public void setResourceService(ResourceService resourceService) {
398                    this.resourceService = resourceService;
399            }
400    
401            public ResourcePersistence getResourcePersistence() {
402                    return resourcePersistence;
403            }
404    
405            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
406                    this.resourcePersistence = resourcePersistence;
407            }
408    
409            public ResourceFinder getResourceFinder() {
410                    return resourceFinder;
411            }
412    
413            public void setResourceFinder(ResourceFinder resourceFinder) {
414                    this.resourceFinder = resourceFinder;
415            }
416    
417            public UserLocalService getUserLocalService() {
418                    return userLocalService;
419            }
420    
421            public void setUserLocalService(UserLocalService userLocalService) {
422                    this.userLocalService = userLocalService;
423            }
424    
425            public UserService getUserService() {
426                    return userService;
427            }
428    
429            public void setUserService(UserService userService) {
430                    this.userService = userService;
431            }
432    
433            public UserPersistence getUserPersistence() {
434                    return userPersistence;
435            }
436    
437            public void setUserPersistence(UserPersistence userPersistence) {
438                    this.userPersistence = userPersistence;
439            }
440    
441            public UserFinder getUserFinder() {
442                    return userFinder;
443            }
444    
445            public void setUserFinder(UserFinder userFinder) {
446                    this.userFinder = userFinder;
447            }
448    
449            public WebDAVPropsLocalService getWebDAVPropsLocalService() {
450                    return webDAVPropsLocalService;
451            }
452    
453            public void setWebDAVPropsLocalService(
454                    WebDAVPropsLocalService webDAVPropsLocalService) {
455                    this.webDAVPropsLocalService = webDAVPropsLocalService;
456            }
457    
458            public WebDAVPropsPersistence getWebDAVPropsPersistence() {
459                    return webDAVPropsPersistence;
460            }
461    
462            public void setWebDAVPropsPersistence(
463                    WebDAVPropsPersistence webDAVPropsPersistence) {
464                    this.webDAVPropsPersistence = webDAVPropsPersistence;
465            }
466    
467            public ExpandoValueLocalService getExpandoValueLocalService() {
468                    return expandoValueLocalService;
469            }
470    
471            public void setExpandoValueLocalService(
472                    ExpandoValueLocalService expandoValueLocalService) {
473                    this.expandoValueLocalService = expandoValueLocalService;
474            }
475    
476            public ExpandoValueService getExpandoValueService() {
477                    return expandoValueService;
478            }
479    
480            public void setExpandoValueService(ExpandoValueService expandoValueService) {
481                    this.expandoValueService = expandoValueService;
482            }
483    
484            public ExpandoValuePersistence getExpandoValuePersistence() {
485                    return expandoValuePersistence;
486            }
487    
488            public void setExpandoValuePersistence(
489                    ExpandoValuePersistence expandoValuePersistence) {
490                    this.expandoValuePersistence = expandoValuePersistence;
491            }
492    
493            protected void runSQL(String sql) throws SystemException {
494                    try {
495                            DataSource dataSource = journalTemplatePersistence.getDataSource();
496    
497                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
498                                            sql, new int[0]);
499    
500                            sqlUpdate.update();
501                    }
502                    catch (Exception e) {
503                            throw new SystemException(e);
504                    }
505            }
506    
507            @BeanReference(type = JournalArticleLocalService.class)
508            protected JournalArticleLocalService journalArticleLocalService;
509            @BeanReference(type = JournalArticleService.class)
510            protected JournalArticleService journalArticleService;
511            @BeanReference(type = JournalArticlePersistence.class)
512            protected JournalArticlePersistence journalArticlePersistence;
513            @BeanReference(type = JournalArticleFinder.class)
514            protected JournalArticleFinder journalArticleFinder;
515            @BeanReference(type = JournalArticleImageLocalService.class)
516            protected JournalArticleImageLocalService journalArticleImageLocalService;
517            @BeanReference(type = JournalArticleImagePersistence.class)
518            protected JournalArticleImagePersistence journalArticleImagePersistence;
519            @BeanReference(type = JournalArticleResourceLocalService.class)
520            protected JournalArticleResourceLocalService journalArticleResourceLocalService;
521            @BeanReference(type = JournalArticleResourcePersistence.class)
522            protected JournalArticleResourcePersistence journalArticleResourcePersistence;
523            @BeanReference(type = JournalContentSearchLocalService.class)
524            protected JournalContentSearchLocalService journalContentSearchLocalService;
525            @BeanReference(type = JournalContentSearchPersistence.class)
526            protected JournalContentSearchPersistence journalContentSearchPersistence;
527            @BeanReference(type = JournalFeedLocalService.class)
528            protected JournalFeedLocalService journalFeedLocalService;
529            @BeanReference(type = JournalFeedService.class)
530            protected JournalFeedService journalFeedService;
531            @BeanReference(type = JournalFeedPersistence.class)
532            protected JournalFeedPersistence journalFeedPersistence;
533            @BeanReference(type = JournalFeedFinder.class)
534            protected JournalFeedFinder journalFeedFinder;
535            @BeanReference(type = JournalStructureLocalService.class)
536            protected JournalStructureLocalService journalStructureLocalService;
537            @BeanReference(type = JournalStructureService.class)
538            protected JournalStructureService journalStructureService;
539            @BeanReference(type = JournalStructurePersistence.class)
540            protected JournalStructurePersistence journalStructurePersistence;
541            @BeanReference(type = JournalStructureFinder.class)
542            protected JournalStructureFinder journalStructureFinder;
543            @BeanReference(type = JournalTemplateLocalService.class)
544            protected JournalTemplateLocalService journalTemplateLocalService;
545            @BeanReference(type = JournalTemplateService.class)
546            protected JournalTemplateService journalTemplateService;
547            @BeanReference(type = JournalTemplatePersistence.class)
548            protected JournalTemplatePersistence journalTemplatePersistence;
549            @BeanReference(type = JournalTemplateFinder.class)
550            protected JournalTemplateFinder journalTemplateFinder;
551            @BeanReference(type = CounterLocalService.class)
552            protected CounterLocalService counterLocalService;
553            @BeanReference(type = ImageLocalService.class)
554            protected ImageLocalService imageLocalService;
555            @BeanReference(type = ImageService.class)
556            protected ImageService imageService;
557            @BeanReference(type = ImagePersistence.class)
558            protected ImagePersistence imagePersistence;
559            @BeanReference(type = ResourceLocalService.class)
560            protected ResourceLocalService resourceLocalService;
561            @BeanReference(type = ResourceService.class)
562            protected ResourceService resourceService;
563            @BeanReference(type = ResourcePersistence.class)
564            protected ResourcePersistence resourcePersistence;
565            @BeanReference(type = ResourceFinder.class)
566            protected ResourceFinder resourceFinder;
567            @BeanReference(type = UserLocalService.class)
568            protected UserLocalService userLocalService;
569            @BeanReference(type = UserService.class)
570            protected UserService userService;
571            @BeanReference(type = UserPersistence.class)
572            protected UserPersistence userPersistence;
573            @BeanReference(type = UserFinder.class)
574            protected UserFinder userFinder;
575            @BeanReference(type = WebDAVPropsLocalService.class)
576            protected WebDAVPropsLocalService webDAVPropsLocalService;
577            @BeanReference(type = WebDAVPropsPersistence.class)
578            protected WebDAVPropsPersistence webDAVPropsPersistence;
579            @BeanReference(type = ExpandoValueLocalService.class)
580            protected ExpandoValueLocalService expandoValueLocalService;
581            @BeanReference(type = ExpandoValueService.class)
582            protected ExpandoValueService expandoValueService;
583            @BeanReference(type = ExpandoValuePersistence.class)
584            protected ExpandoValuePersistence expandoValuePersistence;
585    }