annotate src/main/java/de/mpiwg/itgroup/annotations/Annotation.java @ 50:64aa756c60cc

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