1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.exoplatform.calendar.ws.bean;
19
20 import org.exoplatform.calendar.service.Calendar;
21 import org.exoplatform.calendar.service.Utils;
22 import org.exoplatform.calendar.ws.CalendarRestApi;
23 import org.exoplatform.calendar.ws.common.Resource;
24
25 public class CalendarResource extends Resource {
26
27 private static final long serialVersionUID = -4500214043430048066L;
28
29 private String name;
30 private String description ;
31 private String type;
32 private String timeZone;
33 private String color;
34 private String owner;
35 private String viewPermission;
36 private String editPermission;
37 private String[] groups;
38 private String publicURL;
39 private String privateURL;
40 private String icsURL;
41
42 public CalendarResource() {
43 super(null);
44 }
45
46 public CalendarResource(Calendar data, String basePath) {
47 super(data.getId());
48
49 StringBuilder calUri = new StringBuilder(basePath);
50 calUri.append(CalendarRestApi.CALENDAR_URI).append(getId());
51 setHref(calUri.toString());
52 icsURL = getHref() + CalendarRestApi.ICS_URI;
53
54 name = data.getName();
55 description = data.getDescription();
56 type = Calendar.Type.getType(data.getCalType()).name();
57 timeZone = data.getTimeZone();
58 color = data.getCalendarColor();
59 owner = data.getCalendarOwner();
60
61 StringBuilder sb = new StringBuilder();
62 if(data.getViewPermission() != null)
63 for (String s: data.getViewPermission()) {
64 sb.append(s).append(Utils.SEMICOLON);
65 }
66 viewPermission = sb.toString();
67
68 sb = new StringBuilder();
69 if(data.getEditPermission() != null)
70 for (String s: data.getEditPermission()) {
71 sb.append(s).append(Utils.SEMICOLON);
72 }
73 editPermission = sb.toString();
74 groups = data.getGroups();
75 publicURL = data.getPublicUrl();
76 privateURL = data.getPrivateUrl();
77 }
78
79 public String getName() {
80 return name;
81 }
82
83 public void setName(String name) {
84 this.name = name;
85 }
86
87 public String getDescription() {
88 return description;
89 }
90
91 public void setDescription(String description) {
92 this.description = description;
93 }
94
95 public String getType() {
96 return type;
97 }
98
99 public void setType(String type) {
100 this.type = type;
101 }
102
103 public String getTimeZone() {
104 return timeZone;
105 }
106
107 public void setTimeZone(String timeZone) {
108 this.timeZone = timeZone;
109 }
110
111 public String getColor() {
112 return color;
113 }
114
115 public void setColor(String color) {
116 this.color = color;
117 }
118
119 public String getOwner() {
120 return owner;
121 }
122
123 public void setOwner(String owner) {
124 this.owner = owner;
125 }
126
127 public String getViewPermission() {
128 return viewPermission;
129 }
130
131 public void setViewPermission(String viewPermission) {
132 this.viewPermission = viewPermission;
133 }
134
135 public String getEditPermission() {
136 return editPermission;
137 }
138
139 public void setEditPermission(String editPermission) {
140 this.editPermission = editPermission;
141 }
142
143 public String[] getGroups() {
144 return groups;
145 }
146
147 public void setGroups(String[] groups) {
148 this.groups = groups;
149 }
150
151 public String getPublicURL() {
152 return publicURL;
153 }
154
155 public void setPublicURL(String publicURL) {
156 this.publicURL = publicURL;
157 }
158
159 public String getPrivateURL() {
160 return privateURL;
161 }
162
163 public void setPrivateURL(String privateURL) {
164 this.privateURL = privateURL;
165 }
166
167 public String getIcsURL() {
168 return icsURL;
169 }
170
171 public void setIcsURL(String icsURL) {
172 this.icsURL = icsURL;
173 }
174 }