| CalEventImpl.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portlet.calendar.model.impl;
16
17 import com.liferay.portal.kernel.cal.TZSRecurrence;
18 import com.liferay.portal.kernel.json.JSONFactoryUtil;
19 import com.liferay.portal.kernel.util.Validator;
20 import com.liferay.portlet.calendar.model.CalEvent;
21
22 /**
23 * <a href="CalEventImpl.java.html"><b><i>View Source</i></b></a>
24 *
25 * @author Brian Wing Shun Chan
26 */
27 public class CalEventImpl extends CalEventModelImpl implements CalEvent {
28
29 public CalEventImpl() {
30 }
31
32 public TZSRecurrence getRecurrenceObj() {
33 if (_recurrenceObj == null) {
34 String recurrence = getRecurrence();
35
36 if (Validator.isNotNull(recurrence)) {
37 _recurrenceObj = (TZSRecurrence)JSONFactoryUtil.deserialize(
38 recurrence);
39 }
40 }
41
42 return _recurrenceObj;
43 }
44
45 public void setRecurrence(String recurrence) {
46 _recurrenceObj = null;
47
48 super.setRecurrence(recurrence);
49 }
50
51 public void setRecurrenceObj(TZSRecurrence recurrenceObj) {
52 _recurrenceObj = recurrenceObj;
53
54 super.setRecurrence(JSONFactoryUtil.serialize(recurrenceObj));
55 }
56
57 private TZSRecurrence _recurrenceObj = null;
58
59 }