Roberto Sánchez
2014-09-18 52ce72b22ef8d92a1f35b4993bcddaaa66d67350
securis/src/main/java/net/curisit/securis/services/ApplicationResource.java
....@@ -46,7 +46,7 @@
4646 @Inject
4747 Provider<EntityManager> emProvider;
4848
49
- private static final Logger log = LogManager.getLogger(ApplicationResource.class);
49
+ private static final Logger LOG = LogManager.getLogger(ApplicationResource.class);
5050
5151 public ApplicationResource() {
5252 }
....@@ -60,7 +60,7 @@
6060 @Produces(
6161 { MediaType.APPLICATION_JSON })
6262 public Response index() {
63
- log.info("Getting applications list ");
63
+ LOG.info("Getting applications list ");
6464
6565 EntityManager em = emProvider.get();
6666 TypedQuery<Application> q = em.createNamedQuery("list-applications", Application.class);
....@@ -78,16 +78,16 @@
7878 @Produces(
7979 { MediaType.APPLICATION_JSON })
8080 public Response get(@PathParam("appid") String appid, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
81
- log.info("Getting application data for id: {}: ", appid);
81
+ LOG.info("Getting application data for id: {}: ", appid);
8282 if (appid == null || appid.equals("")) {
83
- log.error("Application ID is mandatory");
83
+ LOG.error("Application ID is mandatory");
8484 return Response.status(Status.NOT_FOUND).build();
8585 }
8686
8787 EntityManager em = emProvider.get();
8888 Application app = em.find(Application.class, Integer.parseInt(appid));
8989 if (app == null) {
90
- log.error("Application with id {} not found in DB", appid);
90
+ LOG.error("Application with id {} not found in DB", appid);
9191
9292 return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Application not found with ID: " + appid).build();
9393 }
....@@ -101,7 +101,7 @@
101101 { MediaType.APPLICATION_JSON })
102102 @Transactional
103103 public Response create(Application app, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
104
- log.info("Creating new application");
104
+ LOG.info("Creating new application");
105105 EntityManager em = emProvider.get();
106106 app.setCreationTimestamp(new Date());
107107 em.persist(app);
....@@ -117,11 +117,11 @@
117117 @Produces(
118118 { MediaType.APPLICATION_JSON })
119119 public Response modify(Application app, @PathParam("appid") String appid, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
120
- log.info("Modifying application with id: {}", appid);
120
+ LOG.info("Modifying application with id: {}", appid);
121121 EntityManager em = emProvider.get();
122122 Application currentapp = em.find(Application.class, Integer.parseInt(appid));
123123 if (currentapp == null) {
124
- log.error("Application with id {} not found in DB", appid);
124
+ LOG.error("Application with id {} not found in DB", appid);
125125 return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Application not found with ID: " + appid).build();
126126 }
127127 currentapp.setName(app.getName());
....@@ -137,11 +137,11 @@
137137 @Produces(
138138 { MediaType.APPLICATION_JSON })
139139 public Response delete(@PathParam("appid") String appid, @Context HttpServletRequest request) {
140
- log.info("Deleting app with id: {}", appid);
140
+ LOG.info("Deleting app with id: {}", appid);
141141 EntityManager em = emProvider.get();
142142 Application app = em.find(Application.class, Integer.parseInt(appid));
143143 if (app == null) {
144
- log.error("Application with id {} can not be deleted, It was not found in DB", appid);
144
+ LOG.error("Application with id {} can not be deleted, It was not found in DB", appid);
145145 return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Application not found with ID: " + appid).build();
146146 }
147147