Changeset 4253
- Timestamp:
- 01/10/14 17:27:49 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/UserResource.java
r4252 r4253 141 141 @Consumes(MediaType.APPLICATION_XML) 142 142 @Produces(MediaType.APPLICATION_XML) 143 @Path("{remoteId: " + BackendConstants.regExpRemoteId + "}")143 @Path("{remoteId: " + BackendConstants.regExpRemoteId + "}") 144 144 public JAXBElement<User> addUser(@PathParam("remoteId") String remoteId, User user) throws SQLException, IOException { 145 145 final Number remoteUserID = dbIntegrityService.getUserInternalIDFromRemoteID(httpServletRequest.getRemoteUser()); … … 149 149 final Number userID = dbIntegrityService.addUser(user, remoteId); 150 150 if (userID != null) { 151 final User addedUser = dbIntegrityService.getUser(userID); 152 return new ObjectFactory().createUser(addedUser); 153 } 154 else { 151 final User addedUser = dbIntegrityService.getUser(userID); 152 return new ObjectFactory().createUser(addedUser); 153 } else { 155 154 httpServletResponse.sendError(HttpServletResponse.SC_CONFLICT, "The user with the given e-mail already exists in the database"); 156 155 return null; … … 193 192 } 194 193 195 196 197 194 @DELETE 198 195 @Path("{userId: " + BackendConstants.regExpRemoteId + "}") … … 205 202 if (userID != null) { 206 203 final Integer result = dbIntegrityService.deleteUser(userID); 207 return "There is " + result.toString()+" row deleted";204 return "There is " + result.toString() + " row deleted"; 208 205 } else { 209 206 httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND, "The user with the given id is not found in the database"); … … 219 216 } 220 217 } 221 } 222 223 224 225 218 226 219 private boolean ifLoggedIn(Number userID) { 227 220 return httpServletRequest.getRemoteUser().equals(dbIntegrityService.getUserRemoteID(userID));
Note: See TracChangeset
for help on using the changeset viewer.