annotate src/main/java/de/mpiwg/itgroup/annotations/Annotation.java @ 70:2b1e6df5e21a

added lgpl_v3 license information.
author casties
date Thu, 06 Mar 2014 15:09:04 +0100
parents 64aa756c60cc
children 4e2dc67997a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
1 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
2 *
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
3 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
4 package de.mpiwg.itgroup.annotations;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
5
70
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
6 /*
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
7 * #%L
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
8 * AnnotationManager
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
9 * %%
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
10 * Copyright (C) 2012 - 2014 MPIWG Berlin
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
11 * %%
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
12 * This program is free software: you can redistribute it and/or modify
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
13 * it under the terms of the GNU Lesser General Public License as
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
14 * published by the Free Software Foundation, either version 3 of the
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
15 * License, or (at your option) any later version.
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
16 *
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
17 * This program is distributed in the hope that it will be useful,
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
20 * GNU General Lesser Public License for more details.
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
21 *
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
22 * You should have received a copy of the GNU General Lesser Public
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
23 * License along with this program. If not, see
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
24 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
25 * #L%
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
26 */
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 50
diff changeset
27
50
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
28 import java.io.UnsupportedEncodingException;
16
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
29 import java.util.Set;
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
30
50
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
31 import org.apache.commons.codec.binary.Base64;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
32
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
33 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
34
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
35 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
36 * @author casties
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
37 *
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
38 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
39 public class Annotation {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
40 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
41 * The URI of this annotation.
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
42 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
43 protected String uri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
44
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
45 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
46 * The annotation (body) text.
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
47 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
48 protected String bodyText;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
49
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
50 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
51 * The URI of the annotation text
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
52 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
53 protected String bodyUri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
54
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
55 /**
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
56 * The annotation target.
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
57 */
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
58 protected Target target;
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
59
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
60 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
61 * The fragment part of the annotation target.
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
62 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
63 protected String targetFragment;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
64
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
65 /**
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
66 * The types of annotation target fragments.
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
67 *
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
68 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
69 public static enum FragmentTypes {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
70 XPOINTER, AREA
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
71 };
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
72
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
73 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
74 * The type of the annotation target fragment.
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
75 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
76 protected FragmentTypes fragmentType;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
77
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
78
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
79 /**
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
80 * The Resource that is annotated e.g. a book.
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
81 * The target is part of this resource e.g. a page of a book.
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
82 */
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
83 protected Resource resource;
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
84
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
85 /**
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
86 * The creator of this annotation.
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
87 */
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
88 protected Actor creator;
5
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
89
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
90 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
91 * The creation date of this annotation.
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
92 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
93 protected String created;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
94
10
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
95 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
96 * The user or group that has admin permissions.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
97 * null means any user.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
98 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
99 protected Actor adminPermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
100
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
101 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
102 * The user or group that has delete permissions.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
103 * null means any user.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
104 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
105 protected Actor deletePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
106
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
107 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
108 * The user or group that has update permissions.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
109 * null means any user.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
110 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
111 protected Actor updatePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
112
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
113 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
114 * The user or group that has read permissions.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
115 * null means any user.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
116 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
117 protected Actor readPermission;
16
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
118
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
119 /**
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
120 * List of tags on this Annotation.
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
121 */
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
122 protected Set<String> tags;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
123
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
124 /**
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
125 * Returns if the requested action is allowed for the given user on this annotation.
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
126 *
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
127 * @param action
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
128 * @param user
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
129 * @param store AnnotationStore to check group membership
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
130 * @return
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
131 */
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
132 public boolean isActionAllowed(String action, Person user, AnnotationStore store) {
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
133 if (action.equals("read")) {
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
134 Actor reader = getReadPermission();
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
135 if (reader == null) {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
136 // if not specified then everybody is allowed
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
137 return true;
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
138 } else {
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
139 return reader.isEquivalentWith(user, store);
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
140 }
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
141 } else if (action.equals("update")) {
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
142 // require at least an authenticated user
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
143 if (user == null) return false;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
144 Actor updater = getUpdatePermission();
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
145 if (updater == null) {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
146 // if not specified then everybody is allowed
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
147 return true;
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
148 } else {
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
149 return updater.isEquivalentWith(user, store);
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
150 }
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
151 } else if (action.equals("delete")) {
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
152 // require at least an authenticated user
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
153 if (user == null) return false;
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
154 Actor deleter = getDeletePermission();
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
155 if (deleter == null) {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
156 // if not specified then only creator is allowed
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
157 deleter = creator;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
158 }
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
159 return deleter.isEquivalentWith(user, store);
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
160 } else if (action.equals("admin")) {
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
161 // require at least an authenticated user
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
162 if (user == null) return false;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
163 Actor admin = getAdminPermission();
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
164 if (admin == null) {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
165 // if not specified then only creator is allowed
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
166 admin = creator;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
167 }
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
168 return admin.isEquivalentWith(user, store);
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
169 }
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
170 return false;
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
171 }
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
172
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
173 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
174 * @return the uri
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
175 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
176 public String getUri() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
177 return uri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
178 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
179
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
180 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
181 * @param uri the uri to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
182 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
183 public void setUri(String uri) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
184 this.uri = uri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
185 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
186
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
187 /**
50
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
188 * Returns an URL-compatible id.
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
189 * Currently the uri as base64 encoded string.
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
190 * @return
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
191 */
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
192 public String getUrlId() {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
193 if (uri == null) return null;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
194 try {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
195 return Base64.encodeBase64URLSafeString(uri.getBytes("UTF-8"));
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
196 } catch (UnsupportedEncodingException e) {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
197 return null;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
198 }
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
199 }
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
200
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
201 public static String decodeId(String id) {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
202 if (id == null) return null;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
203 try {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
204 return new String(Base64.decodeBase64(id), "UTF-8");
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
205 } catch (UnsupportedEncodingException e) {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
206 return null;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
207 }
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
208 }
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
209
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
210 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
211 * @return the bodyText
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
212 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
213 public String getBodyText() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
214 return bodyText;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
215 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
216
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
217 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
218 * @param bodyText the bodyText to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
219 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
220 public void setBodyText(String bodyText) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
221 this.bodyText = bodyText;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
222 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
223
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
224 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
225 * @return the bodyUri
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
226 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
227 public String getBodyUri() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
228 return bodyUri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
229 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
230
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
231 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
232 * @param bodyUri the bodyUri to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
233 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
234 public void setBodyUri(String bodyUri) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
235 this.bodyUri = bodyUri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
236 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
237
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
238 /**
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
239 * @return the target
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
240 */
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
241 public Target getTarget() {
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
242 return target;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
243 }
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
244
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
245 /**
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
246 * @param target the target to set
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
247 */
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
248 public void setTarget(Target target) {
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
249 this.target = target;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
250 }
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
251
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
252 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
253 * @return the targetBaseUri
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
254 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
255 public String getTargetBaseUri() {
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
256 if (target == null) return null;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
257 return target.getUri();
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
258 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
259
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
260 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
261 * @return the targetFragment
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
262 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
263 public String getTargetFragment() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
264 return targetFragment;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
265 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
266
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
267 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
268 * @param targetFragment the targetFragment to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
269 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
270 public void setTargetFragment(String targetFragment) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
271 this.targetFragment = targetFragment;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
272 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
273
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
274 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
275 * @return the targetType
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
276 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
277 public FragmentTypes getFragmentType() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
278 return fragmentType;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
279 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
280
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
281 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
282 * @param fragmentType the fragmentType to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
283 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
284 public void setFragmentType(FragmentTypes fragmentType) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
285 this.fragmentType = fragmentType;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
286 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
287
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
288 /**
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
289 * @return the resource
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
290 */
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
291 public Resource getResource() {
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
292 return resource;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
293 }
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
294
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
295 /**
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
296 * @param resource the resource to set
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
297 */
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
298 public void setResource(Resource resource) {
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
299 this.resource = resource;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
300 }
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
301
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
302 /**
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
303 * @return the resourceUri
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
304 */
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
305 public String getResourceUri() {
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
306 if (resource == null) return null;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
307 return resource.getUri();
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
308 }
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
309
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
310 /**
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
311 * @return the creator
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
312 */
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
313 public Actor getCreator() {
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
314 return creator;
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
315 }
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
316
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
317 /**
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
318 * @param creator the creator to set
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
319 */
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
320 public void setCreator(Actor creator) {
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
321 this.creator = creator;
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
322 }
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
323
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
324 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
325 * @return the creatorUri
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
326 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
327 public String getCreatorUri() {
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
328 if (creator != null) {
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
329 return creator.getUri();
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
330 }
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
331 return null;
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
332 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
333
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
334 /**
5
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
335 * @return the creatorName
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
336 */
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
337 public String getCreatorName() {
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
338 if (creator != null) {
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
339 return creator.getName();
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
340 }
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
341 return null;
5
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
342 }
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
343
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
344 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
345 * @return the created
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
346 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
347 public String getCreated() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
348 return created;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
349 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
350
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
351 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
352 * @param created the created to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
353 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
354 public void setCreated(String created) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
355 this.created = created;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
356 }
10
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
357
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
358 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
359 * @return the adminPermission
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
360 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
361 public Actor getAdminPermission() {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
362 if (adminPermission != null) {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
363 return adminPermission;
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
364 } else {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
365 // if not specified then only creator is allowed
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
366 return this.creator;
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
367 }
10
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
368 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
369
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
370 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
371 * @param adminPermission the adminPermission to set
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
372 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
373 public void setAdminPermission(Actor adminPermission) {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
374 this.adminPermission = adminPermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
375 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
376
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
377 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
378 * @return the deletePermission
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
379 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
380 public Actor getDeletePermission() {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
381 if (deletePermission != null) {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
382 return deletePermission;
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
383 } else {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
384 // if not specified then only creator is allowed
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
385 return this.creator;
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
386 }
10
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
387 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
388
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
389 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
390 * @param deletePermission the deletePermission to set
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
391 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
392 public void setDeletePermission(Actor deletePermission) {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
393 this.deletePermission = deletePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
394 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
395
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
396 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
397 * @return the updatePermission
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
398 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
399 public Actor getUpdatePermission() {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
400 return updatePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
401 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
402
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
403 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
404 * @param updatePermission the updatePermission to set
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
405 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
406 public void setUpdatePermission(Actor updatePermission) {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
407 this.updatePermission = updatePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
408 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
409
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
410 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
411 * @return the readPermission
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
412 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
413 public Actor getReadPermission() {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
414 return readPermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
415 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
416
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
417 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
418 * @param readPermission the readPermission to set
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
419 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
420 public void setReadPermission(Actor readPermission) {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
421 this.readPermission = readPermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
422 }
16
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
423
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
424 /**
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
425 * @return the tags
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
426 */
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
427 public Set<String> getTags() {
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
428 return tags;
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
429 }
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
430
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
431 /**
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
432 * @param tags the tags to set
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
433 */
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
434 public void setTags(Set<String> tags) {
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
435 this.tags = tags;
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
436 }
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
437
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
438
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
439 }