...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
private Response __createUser( User usr ) { Response resp; try { DBConnector connector = DBConnector.getConnector(); connector.loadAndConnect(); UserHandler.getLoader().addUser(connector.getConnection(), usr); resp = Response.status(200).entity(usr).build(); } catch (IOException ex) { resp = Response.status(200400).entity(new SimpleErrorMessage("CANNOT ADD USER - SERVER PROBLEM")).build(); Logger.getLogger(UserRestServices.class.getName()).log(Level.SEVERE, null, ex); } catch (ResponseException ex) { Logger.getLogger(UserRestServices.class.getName()).log(Level.SEVERE, null, ex); resp = Response.status(200400).entity(ex.getResponse()).build(); } catch (SQLException ex) { resp = Response.status(200400).entity(new SimpleErrorMessage(usr.getUserID() + " CANNOT BE ADDED - ALREADY EXIST")).build(); Logger.getLogger(UserRestServices.class.getName()).log(Level.SEVERE, null, ex); } return resp; } |
...