annotate src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonResource.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
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
1 /**
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
2 *
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
3 */
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
4 package de.mpiwg.itgroup.annotations.restlet.annotations_ui;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
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
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
31 import org.apache.log4j.Logger;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
32 import org.restlet.data.Form;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
33 import org.restlet.data.MediaType;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
34 import org.restlet.data.Reference;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
35 import org.restlet.data.Status;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
36 import org.restlet.representation.Representation;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
37 import org.restlet.representation.StringRepresentation;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
38 import org.restlet.resource.Delete;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
39 import org.restlet.resource.Get;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
40 import org.restlet.resource.Put;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
41 import org.restlet.resource.ResourceException;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
42 import org.restlet.resource.ServerResource;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
43
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
44 import de.mpiwg.itgroup.annotations.Person;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
45 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
46 import de.mpiwg.itgroup.annotations.restlet.BaseRestlet;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
47
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
48 /**
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
49 * Resource class for a single person.
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
50 *
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
51 * @author casties
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
52 *
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
53 */
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
54 public class PersonResource extends ServerResource {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
55
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
56 public static Logger logger = Logger.getLogger(PersonResource.class);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
57
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
58 protected AnnotationStore store;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
59
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
60 protected String requestId;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
61
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
62 protected Person person;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
63
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
64 @Override
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
65 protected void doInit() throws ResourceException {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
66 super.doInit();
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
67 // id from URI /annotations/persons/{id}
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
68 requestId = (String) getRequest().getAttributes().get("id");
65
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
69 logger.debug("person-id=" + requestId);
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
70 // get store instance
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
71 if (store == null) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
72 store = ((BaseRestlet) getApplication()).getAnnotationStore();
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
73 }
65
c0dd5314bada deal with special characters in urls.
casties
parents: 32
diff changeset
74 // get person from store
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
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 }
32
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
82 person = (Person) store.getActor(new Person(requestId));
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
83 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
84 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
85
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
86 /**
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
87 * GET with HTML content type. Shows the person.
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
88 *
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
89 * @param entity
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
90 * @return
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
91 */
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
92 @Get("html")
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
93 public Representation doGetHTML(Representation entity) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
94 if (person == null) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
95 // invalid id
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
96 setStatus(Status.CLIENT_ERROR_NOT_FOUND);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
97 return null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
98 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
99 String result = null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
100 // get form parameter
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
101 Form f = this.getQuery();
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
102 String form = f.getFirstValue("form");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
103 if (form != null && form.equals("edit")) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
104 // output edit form
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
105 result = "<html><body>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
106 result += String.format("<h1>Edit person %s</h1>\n", person.getId());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
107 result += String.format("<p><a href=\"%s\">All persons</a></p>", this.getReference().getParentRef());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
108 // tunnel PUT method through POST
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
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:
diff changeset
110 result += "<table>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
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:
diff changeset
112 person.getName());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
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:
diff changeset
114 person.getUriString());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
115 result += "</table>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
116 result += "<p><input type=\"submit\"/></p>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
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:
diff changeset
118 } else {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
119 // output person content
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
120 result = "<html><body>\n<h1>Person</h1>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
121 result += String.format("<p><a href=\"%s\">All persons</a></p>", this.getReference().getParentRef());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
122 result += "<table>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
123 result += String.format("<tr><td><b>id</b></td><td>%s</td></tr>\n", person.getId());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
124 result += String.format("<tr><td><b>name</b></td><td>%s</td></tr>\n", person.getName());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
125 result += String.format("<tr><td><b>uri</b></td><td>%s</td></tr>\n", person.getUri());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
126 result += "</table>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
127 result += "<p><a href=\"?form=edit\">Edit person</a></p>\n";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
128 // tunnel POST as DELETE
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
129 result += String.format(
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
130 "<form method=\"post\" action=\"%s?method=DELETE\"><input type=\"submit\" value=\"Delete person\"/></form>\n",
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
131 this.getReference().getHierarchicalPart());
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
132 result += "</body>\n</html>";
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
133 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
134 return new StringRepresentation(result, MediaType.TEXT_HTML);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
135 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
136
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
137 /**
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
138 * PUT updates the person.
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
139 *
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
140 * @param entity
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
141 * @return
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
142 */
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
143 @Put
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
144 public Representation doPut(Representation entity) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
145 logger.debug("PersonResource.doPut!");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
146 if (person == null) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
147 // invalid id
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
148 setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
149 return null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
150 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
151 // TODO: do authentication
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
152 Form form = new Form(entity);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
153 String name = form.getFirstValue("name");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
154 String uri = form.getFirstValue("uri");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
155 if (name != null && !name.isEmpty()) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
156 person.setName(name);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
157 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
158 if (uri != null && !uri.isEmpty()) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
159 person.setUri(uri);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
160 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
161 store.storeActor(person);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
162 // return 303: see other
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
163 setStatus(Status.REDIRECTION_SEE_OTHER);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
164 // go GET same URL
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
165 Reference url = this.getReference();
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
166 this.getResponse().setLocationRef(url);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
167 return null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
168 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
169
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
170 /**
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
171 * DELETE deletes the person.
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
172 *
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
173 * @param entity
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
174 * @return
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
175 */
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
176 @Delete
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
177 public Representation doDelete(Representation entity) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
178 logger.debug("PersonResource.doDelete!");
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
179 if (person == null) {
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
180 // invalid id
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
181 setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
182 return null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
183 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
184 // TODO: do authentication
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
185 store.deleteActor(person);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
186 // return 303: see other
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
187 setStatus(Status.REDIRECTION_SEE_OTHER);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
188 // go GET parent URL
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
189 Reference url = this.getReference().getParentRef();
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
190 this.getResponse().setLocationRef(url);
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
191 return null;
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
192 }
0731c4549065 UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
diff changeset
193 }