annotate src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/GroupResource.java @ 70:2b1e6df5e21a

added lgpl_v3 license information.
author casties
date Thu, 06 Mar 2014 15:09:04 +0100
parents c0dd5314bada
children 25eb2e1df106
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
1 /**
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
2 *
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
3 */
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
4 package de.mpiwg.itgroup.annotations.restlet.annotations_ui;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
5
70
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
6 /*
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
7 * #%L
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
8 * AnnotationManager
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
9 * %%
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
10 * Copyright (C) 2012 - 2014 MPIWG Berlin
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
11 * %%
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
12 * This program is free software: you can redistribute it and/or modify
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
13 * it under the terms of the GNU Lesser General Public License as
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
14 * published by the Free Software Foundation, either version 3 of the
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
15 * License, or (at your option) any later version.
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
16 *
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
17 * This program is distributed in the hope that it will be useful,
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
20 * GNU General Lesser Public License for more details.
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
21 *
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
22 * You should have received a copy of the GNU General Lesser Public
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
23 * License along with this program. If not, see
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
24 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
25 * #L%
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
26 */
2b1e6df5e21a added lgpl_v3 license information.
casties
parents: 65
diff changeset
27
65
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
28 import java.io.UnsupportedEncodingException;
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
29 import java.net.URLDecoder;
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
30
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
31 import org.apache.log4j.Logger;
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
32 import org.restlet.data.Form;
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
33 import org.restlet.data.MediaType;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
34 import org.restlet.data.Reference;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
35 import org.restlet.data.Status;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
36 import org.restlet.representation.Representation;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
37 import org.restlet.representation.StringRepresentation;
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
38 import org.restlet.resource.Delete;
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
39 import org.restlet.resource.Get;
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
40 import org.restlet.resource.Put;
24
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
41 import org.restlet.resource.ResourceException;
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
42 import org.restlet.resource.ServerResource;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
43
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
44 import de.mpiwg.itgroup.annotations.Group;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
45 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
46 import de.mpiwg.itgroup.annotations.restlet.BaseRestlet;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
47
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
48 /**
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
49 * Resource class for a single group.
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
50 *
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
51 * @author casties
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
52 *
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
53 */
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
54 public class GroupResource extends ServerResource {
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
55
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
56 public static Logger logger = Logger.getLogger(GroupResource.class);
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
57
24
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
58 protected AnnotationStore store;
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
59
24
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
60 protected String requestId;
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
61
24
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
62 protected Group group;
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
63
24
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
64 @Override
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
65 protected void doInit() throws ResourceException {
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
66 super.doInit();
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
67 // id from URI /annotations/groups/{id}
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
68 requestId = (String) getRequest().getAttributes().get("id");
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
69 logger.debug("group-id=" + requestId);
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
70 // get store instance
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
71 if (store == null) {
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
72 store = ((BaseRestlet) getApplication()).getAnnotationStore();
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
73 }
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
74 // get group from store
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
75 if (requestId != null) {
65
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
76 // URL decode
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
77 try {
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
78 requestId = URLDecoder.decode(requestId, "UTF-8");
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
79 } catch (UnsupportedEncodingException e) {
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
80 // this shouldn't happen
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
81 }
24
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
82 group = (Group) store.getActor(new Group(requestId));
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
83 }
e208a7b1a37a more work on groups ui.
casties
parents: 23
diff changeset
84 }
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
85
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
86 /**
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
87 * GET with HTML content type. Shows the group.
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
88 *
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
89 * @param entity
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
90 * @return
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
91 */
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
92 @Get("html")
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
93 public Representation doGetHTML(Representation entity) {
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
94 if (group == null) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
95 // invalid id
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
96 setStatus(Status.CLIENT_ERROR_NOT_FOUND);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
97 return null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
98 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
99 String result = null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
100 // get form parameter
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
101 Form f = this.getQuery();
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
102 String form = f.getFirstValue("form");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
103 if (form != null && form.equals("edit")) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
104 // output edit form
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
105 result = "<html><body>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
106 result += String.format("<h1>Edit group %s</h1>\n", group.getId());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
107 result += String.format("<p><a href=\"%s\">All groups</a></p>", this.getReference().getParentRef());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
108 // tunnel PUT method through POST
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
109 result += String.format("<form method=\"post\" action=\"%s?method=PUT\">\n", this.getReference().getHierarchicalPart());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
110 result += "<table>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
111 result += String.format("<tr><td><b>name</b></td><td><input type=\"text\" name=\"name\" value=\"%s\"/></td></tr>\n",
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
112 group.getName());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
113 result += String.format("<tr><td><b>uri</b></td><td><input type=\"text\" name=\"uri\" value=\"%s\"/></td></tr>\n",
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
114 group.getUriString());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
115 result += "</table>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
116 result += "<p><input type=\"submit\"/></p>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
117 result += "</table>\n</form>\n</body>\n</html>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
118 } else {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
119 // output group content
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
120 result = "<html><body>\n<h1>Group</h1>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
121 result += String.format("<p><a href=\"%s\">All groups</a></p>", this.getReference().getParentRef());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
122 result += "<table>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
123 result += String.format("<tr><td><b>id</b></td><td>%s</td></tr>\n", group.getId());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
124 result += String.format("<tr><td><b>name</b></td><td>%s</td></tr>\n", group.getName());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
125 result += String.format("<tr><td><b>uri</b></td><td>%s</td></tr>\n", group.getUri());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
126 result += String.format("<tr><td><b>members</b></td><td><a href=\"%s\">view members</a></td></tr>\n", this
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
127 .getReference().addSegment("members"));
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
128 result += "</table>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
129 result += "<p><a href=\"?form=edit\">Edit group</a></p>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
130 // tunnel POST as DELETE
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
131 result += String.format(
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
132 "<form method=\"post\" action=\"%s?method=DELETE\"><input type=\"submit\" value=\"Delete group\"/></form>\n",
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
133 this.getReference().getHierarchicalPart());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
134 result += "</body>\n</html>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
135 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
136 return new StringRepresentation(result, MediaType.TEXT_HTML);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
137 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
138
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
139 /**
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
140 * PUT updates the group.
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
141 *
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
142 * @param entity
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
143 * @return
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
144 */
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
145 @Put
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
146 public Representation doPut(Representation entity) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
147 logger.debug("GroupResource.doPut!");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
148 if (group == null) {
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
149 // invalid id
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
150 setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
151 return null;
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
152 }
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
153 // TODO: do authentication
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
154 Form form = new Form(entity);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
155 String name = form.getFirstValue("name");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
156 String uri = form.getFirstValue("uri");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
157 if (name != null && !name.isEmpty()) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
158 group.setName(name);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
159 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
160 if (uri != null && !uri.isEmpty()) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
161 group.setUri(uri);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
162 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
163 store.storeActor(group);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
164 // return 303: see other
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
165 setStatus(Status.REDIRECTION_SEE_OTHER);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
166 // go GET same URL
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
167 Reference url = this.getReference();
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
168 this.getResponse().setLocationRef(url);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
169 return null;
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
170 }
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
171
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
172 /**
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
173 * DELETE deletes the group.
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
174 *
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
175 * @param entity
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
176 * @return
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
177 */
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
178 @Delete
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
179 public Representation doDelete(Representation entity) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
180 logger.debug("GroupResource.doDelete!");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
181 if (group == null) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
182 // invalid id
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
183 setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
184 return null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
185 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
186 // TODO: do authentication
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
187 store.deleteActor(group);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
188 // return 303: see other
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
189 setStatus(Status.REDIRECTION_SEE_OTHER);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
190 // go GET parent URL
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
191 Reference url = this.getReference().getParentRef();
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
192 this.getResponse().setLocationRef(url);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
193 return null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents: 24
diff changeset
194 }
23
d22d01ba953a reorganised code for annotations and groups ui. work in progress.
casties
parents:
diff changeset
195 }