From 52ce72b22ef8d92a1f35b4993bcddaaa66d67350 Mon Sep 17 00:00:00 2001
From: Roberto Sánchez <roberto.sanchez@curisit.net>
Date: Thu, 18 Sep 2014 17:55:35 +0000
Subject: [PATCH] #396 fix - Fixed some SonarQube issues

---
 securis/src/main/java/net/curisit/securis/services/LicenseResource.java |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/securis/src/main/java/net/curisit/securis/services/LicenseResource.java b/securis/src/main/java/net/curisit/securis/services/LicenseResource.java
index 0c04736..f7f2ec5 100644
--- a/securis/src/main/java/net/curisit/securis/services/LicenseResource.java
+++ b/securis/src/main/java/net/curisit/securis/services/LicenseResource.java
@@ -47,7 +47,7 @@
 @Path("/license")
 public class LicenseResource {
 
-	private static final Logger log = LogManager.getLogger(LicenseResource.class);
+	private static final Logger LOG = LogManager.getLogger(LicenseResource.class);
 
 	@Inject
 	TokenHelper tokenHelper;
@@ -68,7 +68,7 @@
 	@Produces(
 		{ MediaType.APPLICATION_JSON })
 	public Response index(@QueryParam("packId") Integer packId, @Context BasicSecurityContext bsc) {
-		log.info("Getting licenses list ");
+		LOG.info("Getting licenses list ");
 
 		EntityManager em = emProvider.get();
 
@@ -77,7 +77,7 @@
 			if (pack == null)
 				return Response.ok().build();
 			if (!bsc.getOrganizationsIds().contains(pack.getOrganization().getId())) {
-				log.error("Pack with id {} not accesible by user {}", pack, bsc.getUserPrincipal());
+				LOG.error("Pack with id {} not accesible by user {}", pack, bsc.getUserPrincipal());
 				return Response.status(Status.UNAUTHORIZED).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Unathorized access to pack licenses").build();
 			}
 		}
@@ -99,7 +99,7 @@
 	@Produces(
 		{ MediaType.APPLICATION_JSON })
 	public Response get(@PathParam("licId") Integer licId, @Context BasicSecurityContext bsc) throws SeCurisServiceException {
-		log.info("Getting organization data for id: {}: ", licId);
+		LOG.info("Getting organization data for id: {}: ", licId);
 
 		EntityManager em = emProvider.get();
 		License lic = getCurrentLicense(licId, bsc, em);
@@ -122,11 +122,11 @@
 		License lic = getCurrentLicense(licId, bsc, em);
 
 		if (lic.getLicenseData() == null) {
-			log.error("License with id {} has not license file generated", licId, bsc.getUserPrincipal());
+			LOG.error("License with id {} has not license file generated", licId, bsc.getUserPrincipal());
 			throw new SeCurisServiceException(Status.FORBIDDEN.getStatusCode(), "License has not contain data to generate license file");
 		}
 		if (License.Status.isActionValid(License.Action.DOWNLOAD, lic.getStatus())) {
-			log.error("License with id {} is not active, so It can not downloaded", licId, bsc.getUserPrincipal());
+			LOG.error("License with id {} is not active, so It can not downloaded", licId, bsc.getUserPrincipal());
 			throw new SeCurisServiceException(Status.FORBIDDEN.getStatusCode(), "License is not active, so It can not be downloaded");
 		}
 		return Response.ok(lic.getLicenseData()).build();
@@ -146,7 +146,7 @@
 		License lic = getCurrentLicense(licId, bsc, em);
 
 		if (License.Status.isActionValid(License.Action.ACTIVATION, lic.getStatus())) {
-			log.error("License with id {} can not be activated from current license status", licId);
+			LOG.error("License with id {} can not be activated from current license status", licId);
 			throw new SeCurisServiceException(Status.FORBIDDEN.getStatusCode(), "License with id " + licId + " can not be activated from the current license status");
 		}
 
@@ -193,7 +193,7 @@
 		License lic = getCurrentLicense(licId, bsc, em);
 
 		if (License.Status.isActionValid(License.Action.CANCEL, lic.getStatus())) {
-			log.error("License with id {} can not be canceled from current license status", licId);
+			LOG.error("License with id {} can not be canceled from current license status", licId);
 			throw new SeCurisServiceException(Status.FORBIDDEN.getStatusCode(), "License with id " + licId + " can not be canceled from the current license status");
 		}
 
@@ -214,18 +214,18 @@
 		{ MediaType.APPLICATION_JSON })
 	@Transactional
 	public Response create(License lic, @Context BasicSecurityContext bsc) throws SeCurisServiceException {
-		log.info("Creating new license from create()");
+		LOG.info("Creating new license from create()");
 		EntityManager em = emProvider.get();
 		Pack pack = null;
 		if (lic.getPackId() != null) {
 			pack = em.find(Pack.class, lic.getPackId());
 			if (pack == null) {
-				log.error("License pack with id {} not found in DB", lic.getPackId());
+				LOG.error("License pack with id {} not found in DB", lic.getPackId());
 				return Response.status(Status.NOT_FOUND).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License's pack not found with ID: " + lic.getPackId()).build();
 			} else {
 				if (!bsc.isUserInRole(BasicSecurityContext.ROL_ADMIN)) {
 					if (!bsc.getOrganizationsIds().contains(pack.getOrganization().getId())) {
-						log.error("License for pack with id {} can not be created by user {}", pack.getId(), bsc.getUserPrincipal());
+						LOG.error("License for pack with id {} can not be created by user {}", pack.getId(), bsc.getUserPrincipal());
 						return Response.status(Status.UNAUTHORIZED).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "Unathorized action on pack license").build();
 					}
 				}
@@ -273,7 +273,7 @@
 	@Produces(
 		{ MediaType.APPLICATION_JSON })
 	public Response modify(License lic, @PathParam("licId") Integer licId, @Context BasicSecurityContext bsc) throws SeCurisServiceException {
-		log.info("Modifying organization with id: {}", licId);
+		LOG.info("Modifying organization with id: {}", licId);
 
 		EntityManager em = emProvider.get();
 
@@ -296,12 +296,12 @@
 	@Produces(
 		{ MediaType.APPLICATION_JSON })
 	public Response delete(@PathParam("licId") Integer licId, @Context BasicSecurityContext bsc) throws SeCurisServiceException {
-		log.info("Deleting license with id: {}", licId);
+		LOG.info("Deleting license with id: {}", licId);
 		EntityManager em = emProvider.get();
 		License lic = getCurrentLicense(licId, bsc, em);
 
 		if (lic.getStatus() != License.Status.CANCELED || lic.getStatus() != License.Status.CREATED) {
-			log.error("License {} can not be deleted with status {}", lic.getCode(), lic.getStatus());
+			LOG.error("License {} can not be deleted with status {}", lic.getCode(), lic.getStatus());
 			return Response.status(Status.FORBIDDEN).header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, "License can not be deleted in current status").build();
 		}
 
@@ -311,18 +311,18 @@
 
 	private License getCurrentLicense(Integer licId, BasicSecurityContext bsc, EntityManager em) throws SeCurisServiceException {
 		if (licId == null || licId.equals("")) {
-			log.error("License ID is mandatory");
+			LOG.error("License ID is mandatory");
 			throw new SeCurisServiceException(Status.NOT_FOUND.getStatusCode(), "Missing license ID");
 		}
 
 		License lic = em.find(License.class, licId);
 		if (lic == null) {
-			log.error("License with id {} not found in DB", licId);
+			LOG.error("License with id {} not found in DB", licId);
 			throw new SeCurisServiceException(Status.NOT_FOUND.getStatusCode(), "License not found for ID: " + licId);
 		}
 		if (!bsc.isUserInRole(BasicSecurityContext.ROL_ADMIN)) {
 			if (!bsc.getOrganizationsIds().contains(lic.getPack().getOrganization().getId())) {
-				log.error("License with id {} is not accesible by user {}", licId, bsc.getUserPrincipal());
+				LOG.error("License with id {} is not accesible by user {}", licId, bsc.getUserPrincipal());
 				throw new SeCurisServiceException(Status.UNAUTHORIZED.getStatusCode(), "Unathorized access to license data");
 			}
 		}

--
Gitblit v1.3.2