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.CounterLocalServiceFactory;
27  import com.liferay.counter.service.CounterService;
28  import com.liferay.counter.service.CounterServiceFactory;
29  
30  import com.liferay.mail.service.MailService;
31  import com.liferay.mail.service.MailServiceFactory;
32  
33  import com.liferay.portal.PortalException;
34  import com.liferay.portal.SystemException;
35  import com.liferay.portal.kernel.bean.InitializingBean;
36  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
37  import com.liferay.portal.service.CompanyLocalService;
38  import com.liferay.portal.service.CompanyLocalServiceFactory;
39  import com.liferay.portal.service.CompanyService;
40  import com.liferay.portal.service.CompanyServiceFactory;
41  import com.liferay.portal.service.PortletPreferencesLocalService;
42  import com.liferay.portal.service.PortletPreferencesLocalServiceFactory;
43  import com.liferay.portal.service.PortletPreferencesService;
44  import com.liferay.portal.service.PortletPreferencesServiceFactory;
45  import com.liferay.portal.service.ResourceLocalService;
46  import com.liferay.portal.service.ResourceLocalServiceFactory;
47  import com.liferay.portal.service.ResourceService;
48  import com.liferay.portal.service.ResourceServiceFactory;
49  import com.liferay.portal.service.UserLocalService;
50  import com.liferay.portal.service.UserLocalServiceFactory;
51  import com.liferay.portal.service.UserService;
52  import com.liferay.portal.service.UserServiceFactory;
53  import com.liferay.portal.service.persistence.CompanyPersistence;
54  import com.liferay.portal.service.persistence.CompanyUtil;
55  import com.liferay.portal.service.persistence.PortletPreferencesFinder;
56  import com.liferay.portal.service.persistence.PortletPreferencesFinderUtil;
57  import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
58  import com.liferay.portal.service.persistence.PortletPreferencesUtil;
59  import com.liferay.portal.service.persistence.ResourceFinder;
60  import com.liferay.portal.service.persistence.ResourceFinderUtil;
61  import com.liferay.portal.service.persistence.ResourcePersistence;
62  import com.liferay.portal.service.persistence.ResourceUtil;
63  import com.liferay.portal.service.persistence.UserFinder;
64  import com.liferay.portal.service.persistence.UserFinderUtil;
65  import com.liferay.portal.service.persistence.UserPersistence;
66  import com.liferay.portal.service.persistence.UserUtil;
67  
68  import com.liferay.portlet.calendar.model.CalEvent;
69  import com.liferay.portlet.calendar.service.CalEventLocalService;
70  import com.liferay.portlet.calendar.service.persistence.CalEventFinder;
71  import com.liferay.portlet.calendar.service.persistence.CalEventFinderUtil;
72  import com.liferay.portlet.calendar.service.persistence.CalEventPersistence;
73  import com.liferay.portlet.calendar.service.persistence.CalEventUtil;
74  
75  import java.util.List;
76  
77  /**
78   * <a href="CalEventLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
79   *
80   * @author Brian Wing Shun Chan
81   *
82   */
83  public abstract class CalEventLocalServiceBaseImpl
84      implements CalEventLocalService, InitializingBean {
85      public CalEvent addCalEvent(CalEvent calEvent) throws SystemException {
86          calEvent.setNew(true);
87  
88          return calEventPersistence.update(calEvent, false);
89      }
90  
91      public void deleteCalEvent(long eventId)
92          throws PortalException, SystemException {
93          calEventPersistence.remove(eventId);
94      }
95  
96      public void deleteCalEvent(CalEvent calEvent) throws SystemException {
97          calEventPersistence.remove(calEvent);
98      }
99  
100     public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
101         throws SystemException {
102         return calEventPersistence.findWithDynamicQuery(dynamicQuery);
103     }
104 
105     public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
106         int end) throws SystemException {
107         return calEventPersistence.findWithDynamicQuery(dynamicQuery, start, end);
108     }
109 
110     public CalEvent getCalEvent(long eventId)
111         throws PortalException, SystemException {
112         return calEventPersistence.findByPrimaryKey(eventId);
113     }
114 
115     public CalEvent updateCalEvent(CalEvent calEvent) throws SystemException {
116         calEvent.setNew(false);
117 
118         return calEventPersistence.update(calEvent, true);
119     }
120 
121     public CalEventPersistence getCalEventPersistence() {
122         return calEventPersistence;
123     }
124 
125     public void setCalEventPersistence(CalEventPersistence calEventPersistence) {
126         this.calEventPersistence = calEventPersistence;
127     }
128 
129     public CalEventFinder getCalEventFinder() {
130         return calEventFinder;
131     }
132 
133     public void setCalEventFinder(CalEventFinder calEventFinder) {
134         this.calEventFinder = calEventFinder;
135     }
136 
137     public CounterLocalService getCounterLocalService() {
138         return counterLocalService;
139     }
140 
141     public void setCounterLocalService(CounterLocalService counterLocalService) {
142         this.counterLocalService = counterLocalService;
143     }
144 
145     public CounterService getCounterService() {
146         return counterService;
147     }
148 
149     public void setCounterService(CounterService counterService) {
150         this.counterService = counterService;
151     }
152 
153     public MailService getMailService() {
154         return mailService;
155     }
156 
157     public void setMailService(MailService mailService) {
158         this.mailService = mailService;
159     }
160 
161     public CompanyLocalService getCompanyLocalService() {
162         return companyLocalService;
163     }
164 
165     public void setCompanyLocalService(CompanyLocalService companyLocalService) {
166         this.companyLocalService = companyLocalService;
167     }
168 
169     public CompanyService getCompanyService() {
170         return companyService;
171     }
172 
173     public void setCompanyService(CompanyService companyService) {
174         this.companyService = companyService;
175     }
176 
177     public CompanyPersistence getCompanyPersistence() {
178         return companyPersistence;
179     }
180 
181     public void setCompanyPersistence(CompanyPersistence companyPersistence) {
182         this.companyPersistence = companyPersistence;
183     }
184 
185     public PortletPreferencesLocalService getPortletPreferencesLocalService() {
186         return portletPreferencesLocalService;
187     }
188 
189     public void setPortletPreferencesLocalService(
190         PortletPreferencesLocalService portletPreferencesLocalService) {
191         this.portletPreferencesLocalService = portletPreferencesLocalService;
192     }
193 
194     public PortletPreferencesService getPortletPreferencesService() {
195         return portletPreferencesService;
196     }
197 
198     public void setPortletPreferencesService(
199         PortletPreferencesService portletPreferencesService) {
200         this.portletPreferencesService = portletPreferencesService;
201     }
202 
203     public PortletPreferencesPersistence getPortletPreferencesPersistence() {
204         return portletPreferencesPersistence;
205     }
206 
207     public void setPortletPreferencesPersistence(
208         PortletPreferencesPersistence portletPreferencesPersistence) {
209         this.portletPreferencesPersistence = portletPreferencesPersistence;
210     }
211 
212     public PortletPreferencesFinder getPortletPreferencesFinder() {
213         return portletPreferencesFinder;
214     }
215 
216     public void setPortletPreferencesFinder(
217         PortletPreferencesFinder portletPreferencesFinder) {
218         this.portletPreferencesFinder = portletPreferencesFinder;
219     }
220 
221     public ResourceLocalService getResourceLocalService() {
222         return resourceLocalService;
223     }
224 
225     public void setResourceLocalService(
226         ResourceLocalService resourceLocalService) {
227         this.resourceLocalService = resourceLocalService;
228     }
229 
230     public ResourceService getResourceService() {
231         return resourceService;
232     }
233 
234     public void setResourceService(ResourceService resourceService) {
235         this.resourceService = resourceService;
236     }
237 
238     public ResourcePersistence getResourcePersistence() {
239         return resourcePersistence;
240     }
241 
242     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
243         this.resourcePersistence = resourcePersistence;
244     }
245 
246     public ResourceFinder getResourceFinder() {
247         return resourceFinder;
248     }
249 
250     public void setResourceFinder(ResourceFinder resourceFinder) {
251         this.resourceFinder = resourceFinder;
252     }
253 
254     public UserLocalService getUserLocalService() {
255         return userLocalService;
256     }
257 
258     public void setUserLocalService(UserLocalService userLocalService) {
259         this.userLocalService = userLocalService;
260     }
261 
262     public UserService getUserService() {
263         return userService;
264     }
265 
266     public void setUserService(UserService userService) {
267         this.userService = userService;
268     }
269 
270     public UserPersistence getUserPersistence() {
271         return userPersistence;
272     }
273 
274     public void setUserPersistence(UserPersistence userPersistence) {
275         this.userPersistence = userPersistence;
276     }
277 
278     public UserFinder getUserFinder() {
279         return userFinder;
280     }
281 
282     public void setUserFinder(UserFinder userFinder) {
283         this.userFinder = userFinder;
284     }
285 
286     public void afterPropertiesSet() {
287         if (calEventPersistence == null) {
288             calEventPersistence = CalEventUtil.getPersistence();
289         }
290 
291         if (calEventFinder == null) {
292             calEventFinder = CalEventFinderUtil.getFinder();
293         }
294 
295         if (counterLocalService == null) {
296             counterLocalService = CounterLocalServiceFactory.getImpl();
297         }
298 
299         if (counterService == null) {
300             counterService = CounterServiceFactory.getImpl();
301         }
302 
303         if (mailService == null) {
304             mailService = MailServiceFactory.getImpl();
305         }
306 
307         if (companyLocalService == null) {
308             companyLocalService = CompanyLocalServiceFactory.getImpl();
309         }
310 
311         if (companyService == null) {
312             companyService = CompanyServiceFactory.getImpl();
313         }
314 
315         if (companyPersistence == null) {
316             companyPersistence = CompanyUtil.getPersistence();
317         }
318 
319         if (portletPreferencesLocalService == null) {
320             portletPreferencesLocalService = PortletPreferencesLocalServiceFactory.getImpl();
321         }
322 
323         if (portletPreferencesService == null) {
324             portletPreferencesService = PortletPreferencesServiceFactory.getImpl();
325         }
326 
327         if (portletPreferencesPersistence == null) {
328             portletPreferencesPersistence = PortletPreferencesUtil.getPersistence();
329         }
330 
331         if (portletPreferencesFinder == null) {
332             portletPreferencesFinder = PortletPreferencesFinderUtil.getFinder();
333         }
334 
335         if (resourceLocalService == null) {
336             resourceLocalService = ResourceLocalServiceFactory.getImpl();
337         }
338 
339         if (resourceService == null) {
340             resourceService = ResourceServiceFactory.getImpl();
341         }
342 
343         if (resourcePersistence == null) {
344             resourcePersistence = ResourceUtil.getPersistence();
345         }
346 
347         if (resourceFinder == null) {
348             resourceFinder = ResourceFinderUtil.getFinder();
349         }
350 
351         if (userLocalService == null) {
352             userLocalService = UserLocalServiceFactory.getImpl();
353         }
354 
355         if (userService == null) {
356             userService = UserServiceFactory.getImpl();
357         }
358 
359         if (userPersistence == null) {
360             userPersistence = UserUtil.getPersistence();
361         }
362 
363         if (userFinder == null) {
364             userFinder = UserFinderUtil.getFinder();
365         }
366     }
367 
368     protected CalEventPersistence calEventPersistence;
369     protected CalEventFinder calEventFinder;
370     protected CounterLocalService counterLocalService;
371     protected CounterService counterService;
372     protected MailService mailService;
373     protected CompanyLocalService companyLocalService;
374     protected CompanyService companyService;
375     protected CompanyPersistence companyPersistence;
376     protected PortletPreferencesLocalService portletPreferencesLocalService;
377     protected PortletPreferencesService portletPreferencesService;
378     protected PortletPreferencesPersistence portletPreferencesPersistence;
379     protected PortletPreferencesFinder portletPreferencesFinder;
380     protected ResourceLocalService resourceLocalService;
381     protected ResourceService resourceService;
382     protected ResourcePersistence resourcePersistence;
383     protected ResourceFinder resourceFinder;
384     protected UserLocalService userLocalService;
385     protected UserService userService;
386     protected UserPersistence userPersistence;
387     protected UserFinder userFinder;
388 }