1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.journal.service.base;
16  
17  import com.liferay.counter.service.CounterLocalService;
18  
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
21  import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
22  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
23  import com.liferay.portal.kernel.exception.PortalException;
24  import com.liferay.portal.kernel.exception.SystemException;
25  import com.liferay.portal.kernel.util.OrderByComparator;
26  import com.liferay.portal.service.ImageLocalService;
27  import com.liferay.portal.service.ImageService;
28  import com.liferay.portal.service.ResourceLocalService;
29  import com.liferay.portal.service.ResourceService;
30  import com.liferay.portal.service.UserLocalService;
31  import com.liferay.portal.service.UserService;
32  import com.liferay.portal.service.WebDAVPropsLocalService;
33  import com.liferay.portal.service.persistence.ImagePersistence;
34  import com.liferay.portal.service.persistence.ResourceFinder;
35  import com.liferay.portal.service.persistence.ResourcePersistence;
36  import com.liferay.portal.service.persistence.UserFinder;
37  import com.liferay.portal.service.persistence.UserPersistence;
38  import com.liferay.portal.service.persistence.WebDAVPropsPersistence;
39  
40  import com.liferay.portlet.expando.service.ExpandoValueLocalService;
41  import com.liferay.portlet.expando.service.ExpandoValueService;
42  import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
43  import com.liferay.portlet.journal.model.JournalTemplate;
44  import com.liferay.portlet.journal.service.JournalArticleImageLocalService;
45  import com.liferay.portlet.journal.service.JournalArticleLocalService;
46  import com.liferay.portlet.journal.service.JournalArticleResourceLocalService;
47  import com.liferay.portlet.journal.service.JournalArticleService;
48  import com.liferay.portlet.journal.service.JournalContentSearchLocalService;
49  import com.liferay.portlet.journal.service.JournalFeedLocalService;
50  import com.liferay.portlet.journal.service.JournalFeedService;
51  import com.liferay.portlet.journal.service.JournalStructureLocalService;
52  import com.liferay.portlet.journal.service.JournalStructureService;
53  import com.liferay.portlet.journal.service.JournalTemplateLocalService;
54  import com.liferay.portlet.journal.service.JournalTemplateService;
55  import com.liferay.portlet.journal.service.persistence.JournalArticleFinder;
56  import com.liferay.portlet.journal.service.persistence.JournalArticleImagePersistence;
57  import com.liferay.portlet.journal.service.persistence.JournalArticlePersistence;
58  import com.liferay.portlet.journal.service.persistence.JournalArticleResourcePersistence;
59  import com.liferay.portlet.journal.service.persistence.JournalContentSearchPersistence;
60  import com.liferay.portlet.journal.service.persistence.JournalFeedFinder;
61  import com.liferay.portlet.journal.service.persistence.JournalFeedPersistence;
62  import com.liferay.portlet.journal.service.persistence.JournalStructureFinder;
63  import com.liferay.portlet.journal.service.persistence.JournalStructurePersistence;
64  import com.liferay.portlet.journal.service.persistence.JournalTemplateFinder;
65  import com.liferay.portlet.journal.service.persistence.JournalTemplatePersistence;
66  
67  import java.util.List;
68  
69  import javax.sql.DataSource;
70  
71  /**
72   * <a href="JournalTemplateLocalServiceBaseImpl.java.html"><b><i>View Source</i>
73   * </b></a>
74   *
75   * @author Brian Wing Shun Chan
76   */
77  public abstract class JournalTemplateLocalServiceBaseImpl
78      implements JournalTemplateLocalService {
79      public JournalTemplate addJournalTemplate(JournalTemplate journalTemplate)
80          throws SystemException {
81          journalTemplate.setNew(true);
82  
83          return journalTemplatePersistence.update(journalTemplate, false);
84      }
85  
86      public JournalTemplate createJournalTemplate(long id) {
87          return journalTemplatePersistence.create(id);
88      }
89  
90      public void deleteJournalTemplate(long id)
91          throws PortalException, SystemException {
92          journalTemplatePersistence.remove(id);
93      }
94  
95      public void deleteJournalTemplate(JournalTemplate journalTemplate)
96          throws SystemException {
97          journalTemplatePersistence.remove(journalTemplate);
98      }
99  
100     @SuppressWarnings("unchecked")
101     public List dynamicQuery(DynamicQuery dynamicQuery)
102         throws SystemException {
103         return journalTemplatePersistence.findWithDynamicQuery(dynamicQuery);
104     }
105 
106     @SuppressWarnings("unchecked")
107     public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
108         throws SystemException {
109         return journalTemplatePersistence.findWithDynamicQuery(dynamicQuery,
110             start, end);
111     }
112 
113     @SuppressWarnings("unchecked")
114     public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
115         OrderByComparator orderByComparator) throws SystemException {
116         return journalTemplatePersistence.findWithDynamicQuery(dynamicQuery,
117             start, end, orderByComparator);
118     }
119 
120     public long dynamicQueryCount(DynamicQuery dynamicQuery)
121         throws SystemException {
122         return journalTemplatePersistence.countWithDynamicQuery(dynamicQuery);
123     }
124 
125     public JournalTemplate getJournalTemplate(long id)
126         throws PortalException, SystemException {
127         return journalTemplatePersistence.findByPrimaryKey(id);
128     }
129 
130     public JournalTemplate getJournalTemplateByUuidAndGroupId(String uuid,
131         long groupId) throws PortalException, SystemException {
132         return journalTemplatePersistence.findByUUID_G(uuid, groupId);
133     }
134 
135     public List<JournalTemplate> getJournalTemplates(int start, int end)
136         throws SystemException {
137         return journalTemplatePersistence.findAll(start, end);
138     }
139 
140     public int getJournalTemplatesCount() throws SystemException {
141         return journalTemplatePersistence.countAll();
142     }
143 
144     public JournalTemplate updateJournalTemplate(
145         JournalTemplate journalTemplate) throws SystemException {
146         journalTemplate.setNew(false);
147 
148         return journalTemplatePersistence.update(journalTemplate, true);
149     }
150 
151     public JournalTemplate updateJournalTemplate(
152         JournalTemplate journalTemplate, boolean merge)
153         throws SystemException {
154         journalTemplate.setNew(false);
155 
156         return journalTemplatePersistence.update(journalTemplate, merge);
157     }
158 
159     public JournalArticleLocalService getJournalArticleLocalService() {
160         return journalArticleLocalService;
161     }
162 
163     public void setJournalArticleLocalService(
164         JournalArticleLocalService journalArticleLocalService) {
165         this.journalArticleLocalService = journalArticleLocalService;
166     }
167 
168     public JournalArticleService getJournalArticleService() {
169         return journalArticleService;
170     }
171 
172     public void setJournalArticleService(
173         JournalArticleService journalArticleService) {
174         this.journalArticleService = journalArticleService;
175     }
176 
177     public JournalArticlePersistence getJournalArticlePersistence() {
178         return journalArticlePersistence;
179     }
180 
181     public void setJournalArticlePersistence(
182         JournalArticlePersistence journalArticlePersistence) {
183         this.journalArticlePersistence = journalArticlePersistence;
184     }
185 
186     public JournalArticleFinder getJournalArticleFinder() {
187         return journalArticleFinder;
188     }
189 
190     public void setJournalArticleFinder(
191         JournalArticleFinder journalArticleFinder) {
192         this.journalArticleFinder = journalArticleFinder;
193     }
194 
195     public JournalArticleImageLocalService getJournalArticleImageLocalService() {
196         return journalArticleImageLocalService;
197     }
198 
199     public void setJournalArticleImageLocalService(
200         JournalArticleImageLocalService journalArticleImageLocalService) {
201         this.journalArticleImageLocalService = journalArticleImageLocalService;
202     }
203 
204     public JournalArticleImagePersistence getJournalArticleImagePersistence() {
205         return journalArticleImagePersistence;
206     }
207 
208     public void setJournalArticleImagePersistence(
209         JournalArticleImagePersistence journalArticleImagePersistence) {
210         this.journalArticleImagePersistence = journalArticleImagePersistence;
211     }
212 
213     public JournalArticleResourceLocalService getJournalArticleResourceLocalService() {
214         return journalArticleResourceLocalService;
215     }
216 
217     public void setJournalArticleResourceLocalService(
218         JournalArticleResourceLocalService journalArticleResourceLocalService) {
219         this.journalArticleResourceLocalService = journalArticleResourceLocalService;
220     }
221 
222     public JournalArticleResourcePersistence getJournalArticleResourcePersistence() {
223         return journalArticleResourcePersistence;
224     }
225 
226     public void setJournalArticleResourcePersistence(
227         JournalArticleResourcePersistence journalArticleResourcePersistence) {
228         this.journalArticleResourcePersistence = journalArticleResourcePersistence;
229     }
230 
231     public JournalContentSearchLocalService getJournalContentSearchLocalService() {
232         return journalContentSearchLocalService;
233     }
234 
235     public void setJournalContentSearchLocalService(
236         JournalContentSearchLocalService journalContentSearchLocalService) {
237         this.journalContentSearchLocalService = journalContentSearchLocalService;
238     }
239 
240     public JournalContentSearchPersistence getJournalContentSearchPersistence() {
241         return journalContentSearchPersistence;
242     }
243 
244     public void setJournalContentSearchPersistence(
245         JournalContentSearchPersistence journalContentSearchPersistence) {
246         this.journalContentSearchPersistence = journalContentSearchPersistence;
247     }
248 
249     public JournalFeedLocalService getJournalFeedLocalService() {
250         return journalFeedLocalService;
251     }
252 
253     public void setJournalFeedLocalService(
254         JournalFeedLocalService journalFeedLocalService) {
255         this.journalFeedLocalService = journalFeedLocalService;
256     }
257 
258     public JournalFeedService getJournalFeedService() {
259         return journalFeedService;
260     }
261 
262     public void setJournalFeedService(JournalFeedService journalFeedService) {
263         this.journalFeedService = journalFeedService;
264     }
265 
266     public JournalFeedPersistence getJournalFeedPersistence() {
267         return journalFeedPersistence;
268     }
269 
270     public void setJournalFeedPersistence(
271         JournalFeedPersistence journalFeedPersistence) {
272         this.journalFeedPersistence = journalFeedPersistence;
273     }
274 
275     public JournalFeedFinder getJournalFeedFinder() {
276         return journalFeedFinder;
277     }
278 
279     public void setJournalFeedFinder(JournalFeedFinder journalFeedFinder) {
280         this.journalFeedFinder = journalFeedFinder;
281     }
282 
283     public JournalStructureLocalService getJournalStructureLocalService() {
284         return journalStructureLocalService;
285     }
286 
287     public void setJournalStructureLocalService(
288         JournalStructureLocalService journalStructureLocalService) {
289         this.journalStructureLocalService = journalStructureLocalService;
290     }
291 
292     public JournalStructureService getJournalStructureService() {
293         return journalStructureService;
294     }
295 
296     public void setJournalStructureService(
297         JournalStructureService journalStructureService) {
298         this.journalStructureService = journalStructureService;
299     }
300 
301     public JournalStructurePersistence getJournalStructurePersistence() {
302         return journalStructurePersistence;
303     }
304 
305     public void setJournalStructurePersistence(
306         JournalStructurePersistence journalStructurePersistence) {
307         this.journalStructurePersistence = journalStructurePersistence;
308     }
309 
310     public JournalStructureFinder getJournalStructureFinder() {
311         return journalStructureFinder;
312     }
313 
314     public void setJournalStructureFinder(
315         JournalStructureFinder journalStructureFinder) {
316         this.journalStructureFinder = journalStructureFinder;
317     }
318 
319     public JournalTemplateLocalService getJournalTemplateLocalService() {
320         return journalTemplateLocalService;
321     }
322 
323     public void setJournalTemplateLocalService(
324         JournalTemplateLocalService journalTemplateLocalService) {
325         this.journalTemplateLocalService = journalTemplateLocalService;
326     }
327 
328     public JournalTemplateService getJournalTemplateService() {
329         return journalTemplateService;
330     }
331 
332     public void setJournalTemplateService(
333         JournalTemplateService journalTemplateService) {
334         this.journalTemplateService = journalTemplateService;
335     }
336 
337     public JournalTemplatePersistence getJournalTemplatePersistence() {
338         return journalTemplatePersistence;
339     }
340 
341     public void setJournalTemplatePersistence(
342         JournalTemplatePersistence journalTemplatePersistence) {
343         this.journalTemplatePersistence = journalTemplatePersistence;
344     }
345 
346     public JournalTemplateFinder getJournalTemplateFinder() {
347         return journalTemplateFinder;
348     }
349 
350     public void setJournalTemplateFinder(
351         JournalTemplateFinder journalTemplateFinder) {
352         this.journalTemplateFinder = journalTemplateFinder;
353     }
354 
355     public CounterLocalService getCounterLocalService() {
356         return counterLocalService;
357     }
358 
359     public void setCounterLocalService(CounterLocalService counterLocalService) {
360         this.counterLocalService = counterLocalService;
361     }
362 
363     public ImageLocalService getImageLocalService() {
364         return imageLocalService;
365     }
366 
367     public void setImageLocalService(ImageLocalService imageLocalService) {
368         this.imageLocalService = imageLocalService;
369     }
370 
371     public ImageService getImageService() {
372         return imageService;
373     }
374 
375     public void setImageService(ImageService imageService) {
376         this.imageService = imageService;
377     }
378 
379     public ImagePersistence getImagePersistence() {
380         return imagePersistence;
381     }
382 
383     public void setImagePersistence(ImagePersistence imagePersistence) {
384         this.imagePersistence = imagePersistence;
385     }
386 
387     public ResourceLocalService getResourceLocalService() {
388         return resourceLocalService;
389     }
390 
391     public void setResourceLocalService(
392         ResourceLocalService resourceLocalService) {
393         this.resourceLocalService = resourceLocalService;
394     }
395 
396     public ResourceService getResourceService() {
397         return resourceService;
398     }
399 
400     public void setResourceService(ResourceService resourceService) {
401         this.resourceService = resourceService;
402     }
403 
404     public ResourcePersistence getResourcePersistence() {
405         return resourcePersistence;
406     }
407 
408     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
409         this.resourcePersistence = resourcePersistence;
410     }
411 
412     public ResourceFinder getResourceFinder() {
413         return resourceFinder;
414     }
415 
416     public void setResourceFinder(ResourceFinder resourceFinder) {
417         this.resourceFinder = resourceFinder;
418     }
419 
420     public UserLocalService getUserLocalService() {
421         return userLocalService;
422     }
423 
424     public void setUserLocalService(UserLocalService userLocalService) {
425         this.userLocalService = userLocalService;
426     }
427 
428     public UserService getUserService() {
429         return userService;
430     }
431 
432     public void setUserService(UserService userService) {
433         this.userService = userService;
434     }
435 
436     public UserPersistence getUserPersistence() {
437         return userPersistence;
438     }
439 
440     public void setUserPersistence(UserPersistence userPersistence) {
441         this.userPersistence = userPersistence;
442     }
443 
444     public UserFinder getUserFinder() {
445         return userFinder;
446     }
447 
448     public void setUserFinder(UserFinder userFinder) {
449         this.userFinder = userFinder;
450     }
451 
452     public WebDAVPropsLocalService getWebDAVPropsLocalService() {
453         return webDAVPropsLocalService;
454     }
455 
456     public void setWebDAVPropsLocalService(
457         WebDAVPropsLocalService webDAVPropsLocalService) {
458         this.webDAVPropsLocalService = webDAVPropsLocalService;
459     }
460 
461     public WebDAVPropsPersistence getWebDAVPropsPersistence() {
462         return webDAVPropsPersistence;
463     }
464 
465     public void setWebDAVPropsPersistence(
466         WebDAVPropsPersistence webDAVPropsPersistence) {
467         this.webDAVPropsPersistence = webDAVPropsPersistence;
468     }
469 
470     public ExpandoValueLocalService getExpandoValueLocalService() {
471         return expandoValueLocalService;
472     }
473 
474     public void setExpandoValueLocalService(
475         ExpandoValueLocalService expandoValueLocalService) {
476         this.expandoValueLocalService = expandoValueLocalService;
477     }
478 
479     public ExpandoValueService getExpandoValueService() {
480         return expandoValueService;
481     }
482 
483     public void setExpandoValueService(ExpandoValueService expandoValueService) {
484         this.expandoValueService = expandoValueService;
485     }
486 
487     public ExpandoValuePersistence getExpandoValuePersistence() {
488         return expandoValuePersistence;
489     }
490 
491     public void setExpandoValuePersistence(
492         ExpandoValuePersistence expandoValuePersistence) {
493         this.expandoValuePersistence = expandoValuePersistence;
494     }
495 
496     protected void runSQL(String sql) throws SystemException {
497         try {
498             DataSource dataSource = journalTemplatePersistence.getDataSource();
499 
500             SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
501                     sql, new int[0]);
502 
503             sqlUpdate.update();
504         }
505         catch (Exception e) {
506             throw new SystemException(e);
507         }
508     }
509 
510     @BeanReference(type = JournalArticleLocalService.class)
511     protected JournalArticleLocalService journalArticleLocalService;
512     @BeanReference(type = JournalArticleService.class)
513     protected JournalArticleService journalArticleService;
514     @BeanReference(type = JournalArticlePersistence.class)
515     protected JournalArticlePersistence journalArticlePersistence;
516     @BeanReference(type = JournalArticleFinder.class)
517     protected JournalArticleFinder journalArticleFinder;
518     @BeanReference(type = JournalArticleImageLocalService.class)
519     protected JournalArticleImageLocalService journalArticleImageLocalService;
520     @BeanReference(type = JournalArticleImagePersistence.class)
521     protected JournalArticleImagePersistence journalArticleImagePersistence;
522     @BeanReference(type = JournalArticleResourceLocalService.class)
523     protected JournalArticleResourceLocalService journalArticleResourceLocalService;
524     @BeanReference(type = JournalArticleResourcePersistence.class)
525     protected JournalArticleResourcePersistence journalArticleResourcePersistence;
526     @BeanReference(type = JournalContentSearchLocalService.class)
527     protected JournalContentSearchLocalService journalContentSearchLocalService;
528     @BeanReference(type = JournalContentSearchPersistence.class)
529     protected JournalContentSearchPersistence journalContentSearchPersistence;
530     @BeanReference(type = JournalFeedLocalService.class)
531     protected JournalFeedLocalService journalFeedLocalService;
532     @BeanReference(type = JournalFeedService.class)
533     protected JournalFeedService journalFeedService;
534     @BeanReference(type = JournalFeedPersistence.class)
535     protected JournalFeedPersistence journalFeedPersistence;
536     @BeanReference(type = JournalFeedFinder.class)
537     protected JournalFeedFinder journalFeedFinder;
538     @BeanReference(type = JournalStructureLocalService.class)
539     protected JournalStructureLocalService journalStructureLocalService;
540     @BeanReference(type = JournalStructureService.class)
541     protected JournalStructureService journalStructureService;
542     @BeanReference(type = JournalStructurePersistence.class)
543     protected JournalStructurePersistence journalStructurePersistence;
544     @BeanReference(type = JournalStructureFinder.class)
545     protected JournalStructureFinder journalStructureFinder;
546     @BeanReference(type = JournalTemplateLocalService.class)
547     protected JournalTemplateLocalService journalTemplateLocalService;
548     @BeanReference(type = JournalTemplateService.class)
549     protected JournalTemplateService journalTemplateService;
550     @BeanReference(type = JournalTemplatePersistence.class)
551     protected JournalTemplatePersistence journalTemplatePersistence;
552     @BeanReference(type = JournalTemplateFinder.class)
553     protected JournalTemplateFinder journalTemplateFinder;
554     @BeanReference(type = CounterLocalService.class)
555     protected CounterLocalService counterLocalService;
556     @BeanReference(type = ImageLocalService.class)
557     protected ImageLocalService imageLocalService;
558     @BeanReference(type = ImageService.class)
559     protected ImageService imageService;
560     @BeanReference(type = ImagePersistence.class)
561     protected ImagePersistence imagePersistence;
562     @BeanReference(type = ResourceLocalService.class)
563     protected ResourceLocalService resourceLocalService;
564     @BeanReference(type = ResourceService.class)
565     protected ResourceService resourceService;
566     @BeanReference(type = ResourcePersistence.class)
567     protected ResourcePersistence resourcePersistence;
568     @BeanReference(type = ResourceFinder.class)
569     protected ResourceFinder resourceFinder;
570     @BeanReference(type = UserLocalService.class)
571     protected UserLocalService userLocalService;
572     @BeanReference(type = UserService.class)
573     protected UserService userService;
574     @BeanReference(type = UserPersistence.class)
575     protected UserPersistence userPersistence;
576     @BeanReference(type = UserFinder.class)
577     protected UserFinder userFinder;
578     @BeanReference(type = WebDAVPropsLocalService.class)
579     protected WebDAVPropsLocalService webDAVPropsLocalService;
580     @BeanReference(type = WebDAVPropsPersistence.class)
581     protected WebDAVPropsPersistence webDAVPropsPersistence;
582     @BeanReference(type = ExpandoValueLocalService.class)
583     protected ExpandoValueLocalService expandoValueLocalService;
584     @BeanReference(type = ExpandoValueService.class)
585     protected ExpandoValueService expandoValueService;
586     @BeanReference(type = ExpandoValuePersistence.class)
587     protected ExpandoValuePersistence expandoValuePersistence;
588 }