Roberto Sánchez
2014-01-21 b83a0ba903b56562751963c106b4c20352c26087
securis/src/main/java/net/curisit/securis/services/LicenseResource.java
....@@ -24,7 +24,7 @@
2424
2525 import net.curisit.integrity.commons.Utils;
2626 import net.curisit.integrity.exception.CurisException;
27
-import net.curisit.securis.SecurisErrorHandler;
27
+import net.curisit.securis.DefaultExceptionHandler;
2828 import net.curisit.securis.db.License;
2929 import net.curisit.securis.db.Pack;
3030 import net.curisit.securis.db.User;
....@@ -111,7 +111,7 @@
111111 pack = em.find(Pack.class, lic.getPackId());
112112 if (pack == null) {
113113 log.error("License pack with id {} not found in DB", lic.getPackId());
114
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "License's pack not found with ID: " + lic.getPackId()).build();
114
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License's pack not found with ID: " + lic.getPackId()).build();
115115 }
116116 }
117117
....@@ -121,7 +121,7 @@
121121 } catch (CurisException ex) {
122122 String createdByUsername = lic.getCreatedById();
123123 log.error("License created by user with id {} not found in DB", createdByUsername);
124
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "License's created by user not found with ID: " + createdByUsername).build();
124
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License's created by user not found with ID: " + createdByUsername).build();
125125 }
126126
127127 try {
....@@ -130,7 +130,7 @@
130130 } catch (CurisException ex) {
131131 String canceledByUsername = lic.getCreatedById();
132132 log.error("License canceled by user with id {} not found in DB", canceledByUsername);
133
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "License's canceled by user not found with ID: " + canceledByUsername).build();
133
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License's canceled by user not found with ID: " + canceledByUsername).build();
134134 }
135135
136136 lic.setCreationTimestamp(new Date());
....@@ -166,7 +166,7 @@
166166 pack = em.find(Pack.class, lic.getPackId());
167167 if (pack == null) {
168168 log.error("License pack with id {} not found in DB", lic.getPackId());
169
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "License's pack not found with ID: " + lic.getPackId()).build();
169
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License's pack not found with ID: " + lic.getPackId()).build();
170170 }
171171 }
172172 User createdBy = null;
....@@ -175,7 +175,7 @@
175175 } catch (CurisException ex) {
176176 String createdByUsername = lic.getCreatedById();
177177 log.error("License created by user with id {} not found in DB", createdByUsername);
178
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "License's created by user not found with ID: " + createdByUsername).build();
178
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License's created by user not found with ID: " + createdByUsername).build();
179179 }
180180
181181 User canceledBy = null;
....@@ -184,7 +184,7 @@
184184 } catch (CurisException ex) {
185185 String canceledByUsername = lic.getCreatedById();
186186 log.error("License canceled by user with id {} not found in DB", canceledByUsername);
187
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "License's canceled by user not found with ID: " + canceledByUsername).build();
187
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License's canceled by user not found with ID: " + canceledByUsername).build();
188188 }
189189
190190 lic.setCreatedBy(createdBy);
....@@ -206,7 +206,7 @@
206206 License org = em.find(License.class, Integer.parseInt(licId));
207207 if (org == null) {
208208 log.error("License with id {} can not be deleted, It was not found in DB", licId);
209
- return Response.status(Status.NOT_FOUND).header(SecurisErrorHandler.HEADER_ERROR_MESSAGE, "License was not found, ID: " + licId).build();
209
+ return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License was not found, ID: " + licId).build();
210210 }
211211
212212 em.remove(org);