comparison src/main/java/de/intevation/lada/rest/LStatusService.java @ 244:f3e15ba7c3b7

Use a sequence for pk in LStatusId and create a new ID object.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 15 Jul 2013 13:22:00 +0200
parents d8a3d188046f
children 2dbe200b73f5
comparison
equal deleted inserted replaced
243:6a85146d76f5 244:f3e15ba7c3b7
19 import de.intevation.lada.auth.Authentication; 19 import de.intevation.lada.auth.Authentication;
20 import de.intevation.lada.auth.AuthenticationException; 20 import de.intevation.lada.auth.AuthenticationException;
21 import de.intevation.lada.data.QueryBuilder; 21 import de.intevation.lada.data.QueryBuilder;
22 import de.intevation.lada.data.Repository; 22 import de.intevation.lada.data.Repository;
23 import de.intevation.lada.model.LStatus; 23 import de.intevation.lada.model.LStatus;
24 import de.intevation.lada.model.LStatusId;
24 25
25 /** 26 /**
26 * This class produces a RESTful service to read, write and update 27 * This class produces a RESTful service to read, write and update
27 * LStatus objects. 28 * LStatus objects.
28 * 29 *
128 @Context HttpHeaders headers 129 @Context HttpHeaders headers
129 ) { 130 ) {
130 try { 131 try {
131 String probeId = status.getProbeId(); 132 String probeId = status.getProbeId();
132 if (authentication.hasAccess(headers, probeId)) { 133 if (authentication.hasAccess(headers, probeId)) {
134 LStatusId id = new LStatusId();
135 id.setMessungsId(status.getMessungsId());
136 id.setProbeId(probeId);
137 status.setId(id);
133 return repository.create(status); 138 return repository.create(status);
134 } 139 }
135 return new Response(false, 698, new ArrayList<LStatus>()); 140 return new Response(false, 698, new ArrayList<LStatus>());
136 } 141 }
137 catch(AuthenticationException ae) { 142 catch(AuthenticationException ae) {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)