annotate src/main/java/de/mpiwg/itgroup/annotations/Annotation.java @ 84:6bf38b5e30a8

also stores polygon shape image annotations.
author casties
date Fri, 23 Jan 2015 17:24:53 +0100
parents 4e2dc67997a0
children acd44dfec9c8
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 {
84
6bf38b5e30a8 also stores polygon shape image annotations.
casties
parents: 76
diff changeset
70 XPOINTER, AREA, WKT
4
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
76
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
78 /**
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
79 * The selected text of the annotation target.
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
80 */
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
81 protected String quote;
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
82
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
83 /**
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
84 * 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
85 * 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
86 */
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
87 protected Resource resource;
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
88
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
89 /**
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
90 * The creator of this annotation.
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
91 */
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
92 protected Actor creator;
5
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
93
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
94 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
95 * The creation date of this annotation.
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
96 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
97 protected String created;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
98
10
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
99 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
100 * The user or group that has admin permissions.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
101 * null means any user.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
102 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
103 protected Actor adminPermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
104
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
105 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
106 * The user or group that has delete permissions.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
107 * null means any user.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
108 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
109 protected Actor deletePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
110
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
111 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
112 * The user or group that has update permissions.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
113 * null means any user.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
114 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
115 protected Actor updatePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
116
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
117 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
118 * The user or group that has read permissions.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
119 * null means any user.
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
120 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
121 protected Actor readPermission;
16
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
122
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
123 /**
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
124 * List of tags on this Annotation.
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
125 */
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
126 protected Set<String> tags;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
127
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
128 /**
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
129 * 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
130 *
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
131 * @param action
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
132 * @param user
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
133 * @param store AnnotationStore to check group membership
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
134 * @return
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
135 */
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
136 public boolean isActionAllowed(String action, Person user, AnnotationStore store) {
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
137 if (action.equals("read")) {
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
138 Actor reader = getReadPermission();
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
139 if (reader == null) {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
140 // if not specified then everybody is allowed
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
141 return true;
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
142 } else {
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
143 return reader.isEquivalentWith(user, store);
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
144 }
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
145 } else if (action.equals("update")) {
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
146 // require at least an authenticated user
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
147 if (user == null) return false;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
148 Actor updater = getUpdatePermission();
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
149 if (updater == null) {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
150 // if not specified then everybody is allowed
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
151 return true;
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
152 } else {
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
153 return updater.isEquivalentWith(user, store);
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
154 }
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
155 } else if (action.equals("delete")) {
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
156 // require at least an authenticated user
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
157 if (user == null) return false;
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
158 Actor deleter = getDeletePermission();
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
159 if (deleter == null) {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
160 // if not specified then only creator is allowed
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
161 deleter = creator;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
162 }
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
163 return deleter.isEquivalentWith(user, store);
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
164 } else if (action.equals("admin")) {
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
165 // require at least an authenticated user
15
58357a4b86de ASSIGNED - # 249: Annotations shared in groups
casties
parents: 14
diff changeset
166 if (user == null) return false;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
167 Actor admin = getAdminPermission();
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
168 if (admin == null) {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
169 // if not specified then only creator is allowed
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
170 admin = creator;
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
171 }
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
172 return admin.isEquivalentWith(user, store);
14
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
173 }
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
174 return false;
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
175 }
629e15b345aa permissions mostly work. need more server-side checking.
casties
parents: 10
diff changeset
176
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
177 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
178 * @return the uri
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
179 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
180 public String getUri() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
181 return uri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
182 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
183
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
184 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
185 * @param uri the uri to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
186 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
187 public void setUri(String uri) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
188 this.uri = uri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
189 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
190
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
191 /**
50
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
192 * Returns an URL-compatible id.
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
193 * Currently the uri as base64 encoded string.
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
194 * @return
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
195 */
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
196 public String getUrlId() {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
197 if (uri == null) return null;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
198 try {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
199 return Base64.encodeBase64URLSafeString(uri.getBytes("UTF-8"));
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
200 } catch (UnsupportedEncodingException e) {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
201 return null;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
202 }
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
203 }
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
204
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
205 public static String decodeId(String id) {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
206 if (id == null) return null;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
207 try {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
208 return new String(Base64.decodeBase64(id), "UTF-8");
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
209 } catch (UnsupportedEncodingException e) {
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
210 return null;
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
211 }
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
212 }
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
213
64aa756c60cc annotations ui can show and delete annotations now.
casties
parents: 48
diff changeset
214 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
215 * @return the bodyText
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
216 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
217 public String getBodyText() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
218 return bodyText;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
219 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
220
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
221 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
222 * @param bodyText the bodyText to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
223 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
224 public void setBodyText(String bodyText) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
225 this.bodyText = bodyText;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
226 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
227
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
228 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
229 * @return the bodyUri
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
230 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
231 public String getBodyUri() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
232 return bodyUri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
233 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
234
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
235 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
236 * @param bodyUri the bodyUri to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
237 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
238 public void setBodyUri(String bodyUri) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
239 this.bodyUri = bodyUri;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
240 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
241
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
242 /**
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
243 * @return the target
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 public Target getTarget() {
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
246 return target;
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
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
249 /**
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
250 * @param target the target to set
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 public void setTarget(Target target) {
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
253 this.target = target;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
254 }
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
255
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
256 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
257 * @return the targetBaseUri
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
258 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
259 public String getTargetBaseUri() {
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
260 if (target == null) return null;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
261 return target.getUri();
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
262 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
263
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
264 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
265 * @return the targetFragment
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
266 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
267 public String getTargetFragment() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
268 return targetFragment;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
269 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
270
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
271 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
272 * @param targetFragment the targetFragment to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
273 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
274 public void setTargetFragment(String targetFragment) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
275 this.targetFragment = targetFragment;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
276 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
277
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
278 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
279 * @return the targetType
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
280 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
281 public FragmentTypes getFragmentType() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
282 return fragmentType;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
283 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
284
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
285 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
286 * @param fragmentType the fragmentType to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
287 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
288 public void setFragmentType(FragmentTypes fragmentType) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
289 this.fragmentType = fragmentType;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
290 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
291
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
292 /**
76
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
293 * @return the quote
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
294 */
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
295 public String getQuote() {
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
296 return quote;
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
297 }
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
298
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
299 /**
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
300 * @param quote the quote to set
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
301 */
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
302 public void setQuote(String quote) {
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
303 this.quote = quote;
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
304 }
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
305
4e2dc67997a0 save text quote from Annotator.
casties
parents: 70
diff changeset
306 /**
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
307 * @return the resource
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
308 */
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
309 public Resource getResource() {
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
310 return resource;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
311 }
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
312
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
313 /**
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
314 * @param resource the resource to set
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
315 */
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
316 public void setResource(Resource resource) {
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
317 this.resource = resource;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
318 }
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
319
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
320 /**
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
321 * @return the resourceUri
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
322 */
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
323 public String getResourceUri() {
48
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
324 if (resource == null) return null;
0e00bf8e27fb targets and resources of Annotation object are objects now.
casties
parents: 40
diff changeset
325 return resource.getUri();
40
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
326 }
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
327
03e0f7574224 saving and loading resource targets should work now (no searching yet)
casties
parents: 20
diff changeset
328 /**
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
329 * @return the creator
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 public Actor getCreator() {
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
332 return creator;
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
333 }
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
334
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
335 /**
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
336 * @param creator the creator to set
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
337 */
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
338 public void setCreator(Actor creator) {
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
339 this.creator = creator;
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
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
342 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
343 * @return the creatorUri
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
344 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
345 public String getCreatorUri() {
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
346 if (creator != null) {
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
347 return creator.getUri();
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
348 }
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
349 return null;
4
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 /**
5
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
353 * @return the creatorName
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
354 */
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
355 public String getCreatorName() {
9
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
356 if (creator != null) {
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
357 return creator.getName();
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
358 }
b2bfc3bc9ba8 new internal actor class for creator.
casties
parents: 8
diff changeset
359 return null;
5
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
360 }
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
361
bbf0cc5bee29 version 0.2 really works now
casties
parents: 4
diff changeset
362 /**
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
363 * @return the created
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
364 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
365 public String getCreated() {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
366 return created;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
367 }
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
368
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
369 /**
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
370 * @param created the created to set
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
371 */
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
372 public void setCreated(String created) {
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
373 this.created = created;
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
374 }
10
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 * @return the adminPermission
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
378 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
379 public Actor getAdminPermission() {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
380 if (adminPermission != null) {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
381 return adminPermission;
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
382 } else {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
383 // if not specified then only creator is allowed
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
384 return this.creator;
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
385 }
10
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
386 }
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 * @param adminPermission the adminPermission to set
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
390 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
391 public void setAdminPermission(Actor adminPermission) {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
392 this.adminPermission = adminPermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
393 }
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 * @return the deletePermission
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
397 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
398 public Actor getDeletePermission() {
20
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
399 if (deletePermission != null) {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
400 return deletePermission;
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
401 } else {
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
402 // if not specified then only creator is allowed
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
403 return this.creator;
715aa11d138b fixes in permission handling: admin and delete default to creator.
casties
parents: 16
diff changeset
404 }
10
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
405 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
406
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
407 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
408 * @param deletePermission the deletePermission to set
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
409 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
410 public void setDeletePermission(Actor deletePermission) {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
411 this.deletePermission = deletePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
412 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
413
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
414 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
415 * @return the updatePermission
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
416 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
417 public Actor getUpdatePermission() {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
418 return updatePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
419 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
420
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
421 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
422 * @param updatePermission the updatePermission to set
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
423 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
424 public void setUpdatePermission(Actor updatePermission) {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
425 this.updatePermission = updatePermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
426 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
427
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
428 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
429 * @return the readPermission
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
430 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
431 public Actor getReadPermission() {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
432 return readPermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
433 }
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
434
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
435 /**
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
436 * @param readPermission the readPermission to set
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
437 */
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
438 public void setReadPermission(Actor readPermission) {
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
439 this.readPermission = readPermission;
90911b2da322 more work on permissions...
casties
parents: 9
diff changeset
440 }
16
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
441
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
442 /**
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
443 * @return the tags
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
444 */
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
445 public Set<String> getTags() {
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
446 return tags;
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
447 }
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
448
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
449 /**
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
450 * @param tags the tags to set
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
451 */
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
452 public void setTags(Set<String> tags) {
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
453 this.tags = tags;
794077e6288c CLOSED - # 252: Tags for Annotations
casties
parents: 15
diff changeset
454 }
4
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
455
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
456
3599b29c393f store seems to work now :-)
casties
parents:
diff changeset
457 }