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         return calEventPersistence.update(model, true);
128     }
129 
130     public CalEventPersistence getCalEventPersistence() {
131         return calEventPersistence;
132     }
133 
134     public void setCalEventPersistence(CalEventPersistence calEventPersistence) {
135         this.calEventPersistence = calEventPersistence;
136     }
137 
138     public CalEventFinder getCalEventFinder() {
139         return calEventFinder;
140     }
141 
142     public void setCalEventFinder(CalEventFinder calEventFinder) {
143         this.calEventFinder = calEventFinder;
144     }
145 
146     public CounterLocalService getCounterLocalService() {
147         return counterLocalService;
148     }
149 
150     public void setCounterLocalService(CounterLocalService counterLocalService) {
151         this.counterLocalService = counterLocalService;
152     }
153 
154     public CounterService getCounterService() {
155         return counterService;
156     }
157 
158     public void setCounterService(CounterService counterService) {
159         this.counterService = counterService;
160     }
161 
162     public MailService getMailService() {
163         return mailService;
164     }
165 
166     public void setMailService(MailService mailService) {
167         this.mailService = mailService;
168     }
169 
170     public CompanyLocalService getCompanyLocalService() {
171         return companyLocalService;
172     }
173 
174     public void setCompanyLocalService(CompanyLocalService companyLocalService) {
175         this.companyLocalService = companyLocalService;
176     }
177 
178     public CompanyService getCompanyService() {
179         return companyService;
180     }
181 
182     public void setCompanyService(CompanyService companyService) {
183         this.companyService = companyService;
184     }
185 
186     public CompanyPersistence getCompanyPersistence() {
187         return companyPersistence;
188     }
189 
190     public void setCompanyPersistence(CompanyPersistence companyPersistence) {
191         this.companyPersistence = companyPersistence;
192     }
193 
194     public PortletPreferencesLocalService getPortletPreferencesLocalService() {
195         return portletPreferencesLocalService;
196     }
197 
198     public void setPortletPreferencesLocalService(
199         PortletPreferencesLocalService portletPreferencesLocalService) {
200         this.portletPreferencesLocalService = portletPreferencesLocalService;
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 (portletPreferencesPersistence == null) {
324             portletPreferencesPersistence = PortletPreferencesUtil.getPersistence();
325         }
326 
327         if (portletPreferencesFinder == null) {
328             portletPreferencesFinder = PortletPreferencesFinderUtil.getFinder();
329         }
330 
331         if (resourceLocalService == null) {
332             resourceLocalService = ResourceLocalServiceFactory.getImpl();
333         }
334 
335         if (resourceService == null) {
336             resourceService = ResourceServiceFactory.getImpl();
337         }
338 
339         if (resourcePersistence == null) {
340             resourcePersistence = ResourceUtil.getPersistence();
341         }
342 
343         if (resourceFinder == null) {
344             resourceFinder = ResourceFinderUtil.getFinder();
345         }
346 
347         if (userLocalService == null) {
348             userLocalService = UserLocalServiceFactory.getImpl();
349         }
350 
351         if (userService == null) {
352             userService = UserServiceFactory.getImpl();
353         }
354 
355         if (userPersistence == null) {
356             userPersistence = UserUtil.getPersistence();
357         }
358 
359         if (userFinder == null) {
360             userFinder = UserFinderUtil.getFinder();
361         }
362     }
363 
364     protected CalEventPersistence calEventPersistence;
365     protected CalEventFinder calEventFinder;
366     protected CounterLocalService counterLocalService;
367     protected CounterService counterService;
368     protected MailService mailService;
369     protected CompanyLocalService companyLocalService;
370     protected CompanyService companyService;
371     protected CompanyPersistence companyPersistence;
372     protected PortletPreferencesLocalService portletPreferencesLocalService;
373     protected PortletPreferencesPersistence portletPreferencesPersistence;
374     protected PortletPreferencesFinder portletPreferencesFinder;
375     protected ResourceLocalService resourceLocalService;
376     protected ResourceService resourceService;
377     protected ResourcePersistence resourcePersistence;
378     protected ResourceFinder resourceFinder;
379     protected UserLocalService userLocalService;
380     protected UserService userService;
381     protected UserPersistence userPersistence;
382     protected UserFinder userFinder;
383 }