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