1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.calendar.service.base;
24  
25  import com.liferay.counter.service.CounterLocalService;
26  import com.liferay.counter.service.CounterService;
27  
28  import com.liferay.mail.service.MailService;
29  
30  import com.liferay.portal.PortalException;
31  import com.liferay.portal.SystemException;
32  import com.liferay.portal.kernel.bean.InitializingBean;
33  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
34  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
35  import com.liferay.portal.service.CompanyLocalService;
36  import com.liferay.portal.service.CompanyService;
37  import com.liferay.portal.service.PortletPreferencesLocalService;
38  import com.liferay.portal.service.PortletPreferencesService;
39  import com.liferay.portal.service.ResourceLocalService;
40  import com.liferay.portal.service.ResourceService;
41  import com.liferay.portal.service.UserLocalService;
42  import com.liferay.portal.service.UserService;
43  import com.liferay.portal.service.persistence.CompanyPersistence;
44  import com.liferay.portal.service.persistence.PortletPreferencesFinder;
45  import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
46  import com.liferay.portal.service.persistence.ResourceFinder;
47  import com.liferay.portal.service.persistence.ResourcePersistence;
48  import com.liferay.portal.service.persistence.UserFinder;
49  import com.liferay.portal.service.persistence.UserPersistence;
50  
51  import com.liferay.portlet.calendar.model.CalEvent;
52  import com.liferay.portlet.calendar.service.CalEventLocalService;
53  import com.liferay.portlet.calendar.service.persistence.CalEventFinder;
54  import com.liferay.portlet.calendar.service.persistence.CalEventPersistence;
55  import com.liferay.portlet.social.service.SocialActivityLocalService;
56  import com.liferay.portlet.social.service.persistence.SocialActivityFinder;
57  import com.liferay.portlet.social.service.persistence.SocialActivityPersistence;
58  
59  import java.util.List;
60  
61  /**
62   * <a href="CalEventLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
63   *
64   * @author Brian Wing Shun Chan
65   *
66   */
67  public abstract class CalEventLocalServiceBaseImpl
68      implements CalEventLocalService, InitializingBean {
69      public CalEvent addCalEvent(CalEvent calEvent) throws SystemException {
70          calEvent.setNew(true);
71  
72          return calEventPersistence.update(calEvent, false);
73      }
74  
75      public void deleteCalEvent(long eventId)
76          throws PortalException, SystemException {
77          calEventPersistence.remove(eventId);
78      }
79  
80      public void deleteCalEvent(CalEvent calEvent) throws SystemException {
81          calEventPersistence.remove(calEvent);
82      }
83  
84      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
85          throws SystemException {
86          return calEventPersistence.findWithDynamicQuery(dynamicQuery);
87      }
88  
89      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
90          int end) throws SystemException {
91          return calEventPersistence.findWithDynamicQuery(dynamicQuery, start, end);
92      }
93  
94      public CalEvent getCalEvent(long eventId)
95          throws PortalException, SystemException {
96          return calEventPersistence.findByPrimaryKey(eventId);
97      }
98  
99      public List<CalEvent> getCalEvents(int start, int end)
100         throws SystemException {
101         return calEventPersistence.findAll(start, end);
102     }
103 
104     public int getCalEventsCount() throws SystemException {
105         return calEventPersistence.countAll();
106     }
107 
108     public CalEvent updateCalEvent(CalEvent calEvent) throws SystemException {
109         calEvent.setNew(false);
110 
111         return calEventPersistence.update(calEvent, true);
112     }
113 
114     public CalEventPersistence getCalEventPersistence() {
115         return calEventPersistence;
116     }
117 
118     public void setCalEventPersistence(CalEventPersistence calEventPersistence) {
119         this.calEventPersistence = calEventPersistence;
120     }
121 
122     public CalEventFinder getCalEventFinder() {
123         return calEventFinder;
124     }
125 
126     public void setCalEventFinder(CalEventFinder calEventFinder) {
127         this.calEventFinder = calEventFinder;
128     }
129 
130     public CounterLocalService getCounterLocalService() {
131         return counterLocalService;
132     }
133 
134     public void setCounterLocalService(CounterLocalService counterLocalService) {
135         this.counterLocalService = counterLocalService;
136     }
137 
138     public CounterService getCounterService() {
139         return counterService;
140     }
141 
142     public void setCounterService(CounterService counterService) {
143         this.counterService = counterService;
144     }
145 
146     public MailService getMailService() {
147         return mailService;
148     }
149 
150     public void setMailService(MailService mailService) {
151         this.mailService = mailService;
152     }
153 
154     public CompanyLocalService getCompanyLocalService() {
155         return companyLocalService;
156     }
157 
158     public void setCompanyLocalService(CompanyLocalService companyLocalService) {
159         this.companyLocalService = companyLocalService;
160     }
161 
162     public CompanyService getCompanyService() {
163         return companyService;
164     }
165 
166     public void setCompanyService(CompanyService companyService) {
167         this.companyService = companyService;
168     }
169 
170     public CompanyPersistence getCompanyPersistence() {
171         return companyPersistence;
172     }
173 
174     public void setCompanyPersistence(CompanyPersistence companyPersistence) {
175         this.companyPersistence = companyPersistence;
176     }
177 
178     public PortletPreferencesLocalService getPortletPreferencesLocalService() {
179         return portletPreferencesLocalService;
180     }
181 
182     public void setPortletPreferencesLocalService(
183         PortletPreferencesLocalService portletPreferencesLocalService) {
184         this.portletPreferencesLocalService = portletPreferencesLocalService;
185     }
186 
187     public PortletPreferencesService getPortletPreferencesService() {
188         return portletPreferencesService;
189     }
190 
191     public void setPortletPreferencesService(
192         PortletPreferencesService portletPreferencesService) {
193         this.portletPreferencesService = portletPreferencesService;
194     }
195 
196     public PortletPreferencesPersistence getPortletPreferencesPersistence() {
197         return portletPreferencesPersistence;
198     }
199 
200     public void setPortletPreferencesPersistence(
201         PortletPreferencesPersistence portletPreferencesPersistence) {
202         this.portletPreferencesPersistence = portletPreferencesPersistence;
203     }
204 
205     public PortletPreferencesFinder getPortletPreferencesFinder() {
206         return portletPreferencesFinder;
207     }
208 
209     public void setPortletPreferencesFinder(
210         PortletPreferencesFinder portletPreferencesFinder) {
211         this.portletPreferencesFinder = portletPreferencesFinder;
212     }
213 
214     public ResourceLocalService getResourceLocalService() {
215         return resourceLocalService;
216     }
217 
218     public void setResourceLocalService(
219         ResourceLocalService resourceLocalService) {
220         this.resourceLocalService = resourceLocalService;
221     }
222 
223     public ResourceService getResourceService() {
224         return resourceService;
225     }
226 
227     public void setResourceService(ResourceService resourceService) {
228         this.resourceService = resourceService;
229     }
230 
231     public ResourcePersistence getResourcePersistence() {
232         return resourcePersistence;
233     }
234 
235     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
236         this.resourcePersistence = resourcePersistence;
237     }
238 
239     public ResourceFinder getResourceFinder() {
240         return resourceFinder;
241     }
242 
243     public void setResourceFinder(ResourceFinder resourceFinder) {
244         this.resourceFinder = resourceFinder;
245     }
246 
247     public SocialActivityLocalService getSocialActivityLocalService() {
248         return socialActivityLocalService;
249     }
250 
251     public void setSocialActivityLocalService(
252         SocialActivityLocalService socialActivityLocalService) {
253         this.socialActivityLocalService = socialActivityLocalService;
254     }
255 
256     public SocialActivityPersistence getSocialActivityPersistence() {
257         return socialActivityPersistence;
258     }
259 
260     public void setSocialActivityPersistence(
261         SocialActivityPersistence socialActivityPersistence) {
262         this.socialActivityPersistence = socialActivityPersistence;
263     }
264 
265     public SocialActivityFinder getSocialActivityFinder() {
266         return socialActivityFinder;
267     }
268 
269     public void setSocialActivityFinder(
270         SocialActivityFinder socialActivityFinder) {
271         this.socialActivityFinder = socialActivityFinder;
272     }
273 
274     public UserLocalService getUserLocalService() {
275         return userLocalService;
276     }
277 
278     public void setUserLocalService(UserLocalService userLocalService) {
279         this.userLocalService = userLocalService;
280     }
281 
282     public UserService getUserService() {
283         return userService;
284     }
285 
286     public void setUserService(UserService userService) {
287         this.userService = userService;
288     }
289 
290     public UserPersistence getUserPersistence() {
291         return userPersistence;
292     }
293 
294     public void setUserPersistence(UserPersistence userPersistence) {
295         this.userPersistence = userPersistence;
296     }
297 
298     public UserFinder getUserFinder() {
299         return userFinder;
300     }
301 
302     public void setUserFinder(UserFinder userFinder) {
303         this.userFinder = userFinder;
304     }
305 
306     public void afterPropertiesSet() {
307         if (calEventPersistence == null) {
308             calEventPersistence = (CalEventPersistence)PortalBeanLocatorUtil.locate(CalEventPersistence.class.getName() +
309                     ".impl");
310         }
311 
312         if (calEventFinder == null) {
313             calEventFinder = (CalEventFinder)PortalBeanLocatorUtil.locate(CalEventFinder.class.getName() +
314                     ".impl");
315         }
316 
317         if (counterLocalService == null) {
318             counterLocalService = (CounterLocalService)PortalBeanLocatorUtil.locate(CounterLocalService.class.getName() +
319                     ".impl");
320         }
321 
322         if (counterService == null) {
323             counterService = (CounterService)PortalBeanLocatorUtil.locate(CounterService.class.getName() +
324                     ".impl");
325         }
326 
327         if (mailService == null) {
328             mailService = (MailService)PortalBeanLocatorUtil.locate(MailService.class.getName() +
329                     ".impl");
330         }
331 
332         if (companyLocalService == null) {
333             companyLocalService = (CompanyLocalService)PortalBeanLocatorUtil.locate(CompanyLocalService.class.getName() +
334                     ".impl");
335         }
336 
337         if (companyService == null) {
338             companyService = (CompanyService)PortalBeanLocatorUtil.locate(CompanyService.class.getName() +
339                     ".impl");
340         }
341 
342         if (companyPersistence == null) {
343             companyPersistence = (CompanyPersistence)PortalBeanLocatorUtil.locate(CompanyPersistence.class.getName() +
344                     ".impl");
345         }
346 
347         if (portletPreferencesLocalService == null) {
348             portletPreferencesLocalService = (PortletPreferencesLocalService)PortalBeanLocatorUtil.locate(PortletPreferencesLocalService.class.getName() +
349                     ".impl");
350         }
351 
352         if (portletPreferencesService == null) {
353             portletPreferencesService = (PortletPreferencesService)PortalBeanLocatorUtil.locate(PortletPreferencesService.class.getName() +
354                     ".impl");
355         }
356 
357         if (portletPreferencesPersistence == null) {
358             portletPreferencesPersistence = (PortletPreferencesPersistence)PortalBeanLocatorUtil.locate(PortletPreferencesPersistence.class.getName() +
359                     ".impl");
360         }
361 
362         if (portletPreferencesFinder == null) {
363             portletPreferencesFinder = (PortletPreferencesFinder)PortalBeanLocatorUtil.locate(PortletPreferencesFinder.class.getName() +
364                     ".impl");
365         }
366 
367         if (resourceLocalService == null) {
368             resourceLocalService = (ResourceLocalService)PortalBeanLocatorUtil.locate(ResourceLocalService.class.getName() +
369                     ".impl");
370         }
371 
372         if (resourceService == null) {
373             resourceService = (ResourceService)PortalBeanLocatorUtil.locate(ResourceService.class.getName() +
374                     ".impl");
375         }
376 
377         if (resourcePersistence == null) {
378             resourcePersistence = (ResourcePersistence)PortalBeanLocatorUtil.locate(ResourcePersistence.class.getName() +
379                     ".impl");
380         }
381 
382         if (resourceFinder == null) {
383             resourceFinder = (ResourceFinder)PortalBeanLocatorUtil.locate(ResourceFinder.class.getName() +
384                     ".impl");
385         }
386 
387         if (socialActivityLocalService == null) {
388             socialActivityLocalService = (SocialActivityLocalService)PortalBeanLocatorUtil.locate(SocialActivityLocalService.class.getName() +
389                     ".impl");
390         }
391 
392         if (socialActivityPersistence == null) {
393             socialActivityPersistence = (SocialActivityPersistence)PortalBeanLocatorUtil.locate(SocialActivityPersistence.class.getName() +
394                     ".impl");
395         }
396 
397         if (socialActivityFinder == null) {
398             socialActivityFinder = (SocialActivityFinder)PortalBeanLocatorUtil.locate(SocialActivityFinder.class.getName() +
399                     ".impl");
400         }
401 
402         if (userLocalService == null) {
403             userLocalService = (UserLocalService)PortalBeanLocatorUtil.locate(UserLocalService.class.getName() +
404                     ".impl");
405         }
406 
407         if (userService == null) {
408             userService = (UserService)PortalBeanLocatorUtil.locate(UserService.class.getName() +
409                     ".impl");
410         }
411 
412         if (userPersistence == null) {
413             userPersistence = (UserPersistence)PortalBeanLocatorUtil.locate(UserPersistence.class.getName() +
414                     ".impl");
415         }
416 
417         if (userFinder == null) {
418             userFinder = (UserFinder)PortalBeanLocatorUtil.locate(UserFinder.class.getName() +
419                     ".impl");
420         }
421     }
422 
423     protected CalEventPersistence calEventPersistence;
424     protected CalEventFinder calEventFinder;
425     protected CounterLocalService counterLocalService;
426     protected CounterService counterService;
427     protected MailService mailService;
428     protected CompanyLocalService companyLocalService;
429     protected CompanyService companyService;
430     protected CompanyPersistence companyPersistence;
431     protected PortletPreferencesLocalService portletPreferencesLocalService;
432     protected PortletPreferencesService portletPreferencesService;
433     protected PortletPreferencesPersistence portletPreferencesPersistence;
434     protected PortletPreferencesFinder portletPreferencesFinder;
435     protected ResourceLocalService resourceLocalService;
436     protected ResourceService resourceService;
437     protected ResourcePersistence resourcePersistence;
438     protected ResourceFinder resourceFinder;
439     protected SocialActivityLocalService socialActivityLocalService;
440     protected SocialActivityPersistence socialActivityPersistence;
441     protected SocialActivityFinder socialActivityFinder;
442     protected UserLocalService userLocalService;
443     protected UserService userService;
444     protected UserPersistence userPersistence;
445     protected UserFinder userFinder;
446 }