| .. | .. |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | import net.curisit.integrity.commons.Utils; |
|---|
| 26 | 26 | import net.curisit.integrity.exception.CurisException; |
|---|
| 27 | | -import net.curisit.securis.SecurisErrorHandler; |
|---|
| 27 | +import net.curisit.securis.DefaultExceptionHandler; |
|---|
| 28 | 28 | import net.curisit.securis.db.License; |
|---|
| 29 | 29 | import net.curisit.securis.db.Pack; |
|---|
| 30 | 30 | import net.curisit.securis.db.User; |
|---|
| .. | .. |
|---|
| 111 | 111 | pack = em.find(Pack.class, lic.getPackId()); |
|---|
| 112 | 112 | if (pack == null) { |
|---|
| 113 | 113 | 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(); |
|---|
| 115 | 115 | } |
|---|
| 116 | 116 | } |
|---|
| 117 | 117 | |
|---|
| .. | .. |
|---|
| 121 | 121 | } catch (CurisException ex) { |
|---|
| 122 | 122 | String createdByUsername = lic.getCreatedById(); |
|---|
| 123 | 123 | 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(); |
|---|
| 125 | 125 | } |
|---|
| 126 | 126 | |
|---|
| 127 | 127 | try { |
|---|
| .. | .. |
|---|
| 130 | 130 | } catch (CurisException ex) { |
|---|
| 131 | 131 | String canceledByUsername = lic.getCreatedById(); |
|---|
| 132 | 132 | 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(); |
|---|
| 134 | 134 | } |
|---|
| 135 | 135 | |
|---|
| 136 | 136 | lic.setCreationTimestamp(new Date()); |
|---|
| .. | .. |
|---|
| 166 | 166 | pack = em.find(Pack.class, lic.getPackId()); |
|---|
| 167 | 167 | if (pack == null) { |
|---|
| 168 | 168 | 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(); |
|---|
| 170 | 170 | } |
|---|
| 171 | 171 | } |
|---|
| 172 | 172 | User createdBy = null; |
|---|
| .. | .. |
|---|
| 175 | 175 | } catch (CurisException ex) { |
|---|
| 176 | 176 | String createdByUsername = lic.getCreatedById(); |
|---|
| 177 | 177 | 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(); |
|---|
| 179 | 179 | } |
|---|
| 180 | 180 | |
|---|
| 181 | 181 | User canceledBy = null; |
|---|
| .. | .. |
|---|
| 184 | 184 | } catch (CurisException ex) { |
|---|
| 185 | 185 | String canceledByUsername = lic.getCreatedById(); |
|---|
| 186 | 186 | 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(); |
|---|
| 188 | 188 | } |
|---|
| 189 | 189 | |
|---|
| 190 | 190 | lic.setCreatedBy(createdBy); |
|---|
| .. | .. |
|---|
| 206 | 206 | License org = em.find(License.class, Integer.parseInt(licId)); |
|---|
| 207 | 207 | if (org == null) { |
|---|
| 208 | 208 | 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(); |
|---|
| 210 | 210 | } |
|---|
| 211 | 211 | |
|---|
| 212 | 212 | em.remove(org); |
|---|