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