Fix Checkstyle issues 51/85551/2
authorVidyashree Rama <vidyashree.rama@huawei.com>
Wed, 17 Apr 2019 09:37:29 +0000 (15:07 +0530)
committerVidyashree Rama <vidyashree.rama@huawei.com>
Fri, 19 Apr 2019 07:07:00 +0000 (12:37 +0530)
Fix Checkstyle issues

Change-Id: I67fa832cc1ac3e4992837a8022bb7673ab81913d
Issue-ID: CLAMP-328
Signed-off-by: Vidyashree Rama <vidyashree.rama@huawei.com>
26 files changed:
src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java
src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java
src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java
src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java
src/main/java/org/onap/clamp/clds/exception/BadRequestException.java
src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java
src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java
src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java
src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java
src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java
src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java
src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java
src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java
src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java
src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java
src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java
src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java
src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java
src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java
src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java
src/main/java/org/onap/clamp/clds/service/CldsService.java
src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java
src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java
src/main/java/org/onap/clamp/clds/service/UserService.java

index 283d8c5..052ea73 100644 (file)
@@ -203,8 +203,8 @@ public class SdcSingleControllerConfiguration implements IConfiguration {
 
     @Override
     public boolean activateServerTLSAuth() {
-        if (jsonRootNode != null && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH) != null &&
-                jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).isJsonPrimitive()) {
+        if (jsonRootNode != null && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH) != null
+                && jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).isJsonPrimitive()) {
             return jsonRootNode.get(ACTIVATE_SERVER_TLS_AUTH).getAsBoolean();
         } else {
             return false;
index e0a804e..1fdc898 100644 (file)
@@ -49,7 +49,7 @@ public class CldsConfiguration {
     /**
      * Clds Identity database DataSource configuration.
      *
-     * @return
+     * @return encoded password data source
      */
     @Bean(name = "cldsDataSource")
     @ConfigurationProperties(prefix = "spring.datasource.cldsdb")
index 3f1403f..92b0272 100644 (file)
@@ -57,6 +57,9 @@ public class CldsSdcControllerConfiguration {
     @Autowired
     protected CsarInstaller csarInstaller;
 
+    /**
+     * Loads SDC controllers configuration.
+     */
     @PostConstruct
     public void loadSdcControllers() {
         SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
@@ -67,6 +70,9 @@ public class CldsSdcControllerConfiguration {
         });
     }
 
+    /**
+     * Checks whether all SDC controllers defined are up and running.
+     */
     @Scheduled(fixedRate = 120000)
     public void checkAllSdcControllers() {
         logger.info("Checking that all SDC Controllers defined are up and running");
@@ -82,6 +88,9 @@ public class CldsSdcControllerConfiguration {
         logger.info("SDC Controllers check completed");
     }
 
+    /**
+     * Closes all SDC Controller and the SDC Client.
+     */
     @PreDestroy
     public void killSdcControllers() {
         sdcControllersList.forEach(e -> {
index 2977d1a..55b90cc 100644 (file)
@@ -56,6 +56,9 @@ public class SdcControllerConfiguration {
     @Autowired
     protected CsarInstaller csarInstaller;
 
+    /**
+     * Loads SDC controller configuration.
+     */
     @PostConstruct
     public void loadSdcControllers() {
         SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
@@ -66,6 +69,9 @@ public class SdcControllerConfiguration {
         });
     }
 
+    /**
+     * Checks whether all SDC controllers defined are up and running.
+     */
     @Scheduled(fixedRate = 120000)
     public void checkAllSdcControllers() {
         logger.info("Checking that all SDC Controllers defined are up and running");
@@ -81,6 +87,9 @@ public class SdcControllerConfiguration {
         logger.info("SDC Controllers check completed");
     }
 
+    /**
+     * Closes all SDC Controller and the SDC Client.
+     */
     @PreDestroy
     public void killSdcControllers() {
         sdcControllersList.forEach(e -> {
index c6b0d55..caf525e 100644 (file)
@@ -30,20 +30,20 @@ package org.onap.clamp.clds.exception;
 public class BadRequestException extends RuntimeException {
 
     /**
-        * 
-        */
-       private static final long serialVersionUID = -5738167530541646123L;
+     * The serial version ID.
+     */
+    private static final long serialVersionUID = -5738167530541646123L;
 
-       /**
+    /**
      * This constructor can be used to create a new CldsConfigException.
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public BadRequestException(String message, Throwable e) {
-        super(message, e);
+    public BadRequestException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index c06d101..93d9815 100644 (file)
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception;
 public class CldsConfigException extends RuntimeException {
 
     /**
-     * 
+     * The serial version ID.
      */
     private static final long serialVersionUID = 5958873136187918505L;
 
@@ -39,11 +39,11 @@ public class CldsConfigException extends RuntimeException {
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public CldsConfigException(String message, Throwable e) {
-        super(message, e);
+    public CldsConfigException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index 0f54f3b..270bfa1 100644 (file)
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception;
 public class CldsUsersException extends RuntimeException {
 
     /**
-     * 
+     * The serial version ID.
      */
     private static final long serialVersionUID = 933535057227505342L;
 
@@ -39,11 +39,11 @@ public class CldsUsersException extends RuntimeException {
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public CldsUsersException(String message, Throwable e) {
-        super(message, e);
+    public CldsUsersException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index 02d5703..5892dfc 100644 (file)
@@ -41,11 +41,11 @@ public class ModelBpmnException extends RuntimeException {
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public ModelBpmnException(String message, Throwable e) {
-        super(message, e);
+    public ModelBpmnException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index b17616b..8d474fc 100644 (file)
@@ -40,11 +40,11 @@ public class ModelPropertiesException extends RuntimeException {
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public ModelPropertiesException(String message, Throwable e) {
-        super(message, e);
+    public ModelPropertiesException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index 4ea0503..1bdf18e 100644 (file)
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception;
 public class NotAuthorizedException extends RuntimeException {
 
     /**
-     * 
+     * The serial version ID.
      */
     private static final long serialVersionUID = -5738167530541646123L;
 
@@ -39,11 +39,11 @@ public class NotAuthorizedException extends RuntimeException {
      *
      * @param message
      *        A string message detailing the problem
-     * @param e
+     * @param ex
      *        The exception sent by the code
      */
-    public NotAuthorizedException(String message, Throwable e) {
-        super(message, e);
+    public NotAuthorizedException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index 92d3663..3bfb5ea 100644 (file)
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception;
 public class TcaRequestFormatterException extends RuntimeException {
 
     /**
-     * 
+     * The serial version ID.
      */
     private static final long serialVersionUID = 169875373143236667L;
 
@@ -40,11 +40,11 @@ public class TcaRequestFormatterException extends RuntimeException {
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public TcaRequestFormatterException(String message, Throwable e) {
-        super(message, e);
+    public TcaRequestFormatterException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index 9e11321..e733da5 100644 (file)
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception.dcae;
 public class DcaeDeploymentException extends RuntimeException {
 
     /**
-     * Generated ID
+     * Generated ID.
      */
     private static final long serialVersionUID = 8452294782552680243L;
 
@@ -39,11 +39,11 @@ public class DcaeDeploymentException extends RuntimeException {
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public DcaeDeploymentException(String message, Throwable e) {
-        super(message, e);
+    public DcaeDeploymentException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index 85695a2..06dcdbf 100644 (file)
@@ -39,11 +39,11 @@ public class PolicyClientException extends RuntimeException {
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public PolicyClientException(String message, Throwable e) {
-        super(message, e);
+    public PolicyClientException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index 862b213..b70b114 100644 (file)
@@ -30,7 +30,7 @@ package org.onap.clamp.clds.exception.sdc;
 public class SdcCommunicationException extends RuntimeException {
 
     /**
-     * Generated ID
+     * Generated ID.
      */
     private static final long serialVersionUID = 8452294782552680243L;
 
@@ -39,11 +39,11 @@ public class SdcCommunicationException extends RuntimeException {
      * 
      * @param message
      *            A string message detailing the problem
-     * @param e
+     * @param ex
      *            The exception sent by the code
      */
-    public SdcCommunicationException(String message, Throwable e) {
-        super(message, e);
+    public SdcCommunicationException(String message, Throwable ex) {
+        super(message, ex);
     }
 
     /**
index 4e1b8ea..c3ebde1 100644 (file)
@@ -29,25 +29,24 @@ package org.onap.clamp.clds.exception.sdc.controller;
 public class CsarHandlerException extends Exception {
 
     /**
-     * 
+     * The serial version ID.
      */
     private static final long serialVersionUID = -7628640776124409155L;
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new CsarHandlerException.
+     *
+     * @param message The message to dump
      */
     public CsarHandlerException(final String message) {
         super(message);
     }
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new CsarHandlerException.
+     *
+     * @param message The message to dump
+     * @param cause The Throwable cause object
      */
     public CsarHandlerException(final String message, final Throwable cause) {
         super(message, cause);
index eba3263..523766a 100644 (file)
@@ -34,20 +34,19 @@ public class SdcArtifactInstallerException extends Exception {
     private static final long serialVersionUID = 4095937499475915021L;
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new SdcArtifactInstallerException.
+     *
+     * @param message The message to dump
      */
     public SdcArtifactInstallerException(final String message) {
         super(message);
     }
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new SdcArtifactInstallerException.
+     *
+     * @param message The message to dump
+     * @param cause The Throwable cause object
      */
     public SdcArtifactInstallerException(final String message, final Throwable cause) {
         super(message, cause);
index 1a7afd2..d73001d 100644 (file)
@@ -34,20 +34,19 @@ public class SdcControllerException extends Exception {
     private static final long serialVersionUID = -4236006447255525130L;
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new SdcControllerException.
+     *
+     * @param message The message to dump
      */
     public SdcControllerException(final String message) {
         super(message);
     }
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new SdcControllerException.
+     *
+     * @param message The message to dump
+     * @param cause The Throwable cause object
      */
     public SdcControllerException(final String message, final Throwable cause) {
         super(message, cause);
index fa92499..6cd3fb8 100644 (file)
@@ -34,20 +34,19 @@ public class SdcDownloadException extends Exception {
     private static final long serialVersionUID = -5276848693231134901L;
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new SdcDownloadException.
+     *
+     * @param message The message to dump
      */
     public SdcDownloadException(final String message) {
         super(message);
     }
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new SdcDownloadException.
+     *
+     * @param message The message to dump
+     * @param cause The Throwable cause object
      */
     public SdcDownloadException(final String message, final Throwable cause) {
         super(message, cause);
index 8a11a6e..bfe63cb 100644 (file)
@@ -34,20 +34,19 @@ public class SdcParametersException extends RuntimeException {
     private static final long serialVersionUID = 8425657297510362736L;
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new SdcParametersException.
+     *
+     * @param message The message to dump
      */
     public SdcParametersException(final String message) {
         super(message);
     }
 
     /**
-     * @param message
-     *            The message to dump
-     * @param cause
-     *            The Throwable cause object
+     * This constructor can be used to create a new SdcParametersException.
+     *
+     * @param message The message to dump
+     * @param cause The Throwable cause object
      */
     public SdcParametersException(final String message, final Throwable cause) {
         super(message, cause);
index 0fb1e0f..7641713 100644 (file)
@@ -39,7 +39,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Component;
 
 /**
- * REST services to manage dictionary and dictionary items for Tosca Model
+ * REST services to manage dictionary and dictionary items for Tosca Model.
  */
 @Component
 public class CldsDictionaryService extends SecureServiceBase {
@@ -65,10 +65,10 @@ public class CldsDictionaryService extends SecureServiceBase {
     }
 
     /**
-     * REST Service that creates or Updates a Dictionary
+     * REST Service that creates or Updates a Dictionary.
      * 
-     * @param dictionaryName
-     * @param cldsDictionary
+     * @param dictionaryName dictionary name
+     * @param cldsDictionary clds dictionary
      * @return CldsDictionary that was created in DB.
      */
     public ResponseEntity<CldsDictionary> createOrUpdateDictionary(String dictionaryName,
@@ -90,10 +90,10 @@ public class CldsDictionaryService extends SecureServiceBase {
 
     /**
      * REST Service that creates or Updates a Dictionary Elements for dictionary
-     * in DB
+     * in DB.
      * 
-     * @param dictionaryName
-     * @param dictionaryItem
+     * @param dictionaryName dictionary name
+     * @param dictionaryItem dictionary item
      * @return CldsDictionaryItem A dictionary items that was created or updated
      *         in DB
      */
@@ -111,7 +111,7 @@ public class CldsDictionaryService extends SecureServiceBase {
     }
 
     /**
-     * Rest Service that retrieves all CLDS dictionary in DB
+     * Rest Service that retrieves all CLDS dictionary in DB.
      * 
      * @return CldsDictionary List List of CldsDictionary available in DB
      */
@@ -129,9 +129,9 @@ public class CldsDictionaryService extends SecureServiceBase {
 
     /**
      * Rest Service that retrieves all CLDS dictionary items in DB for a give
-     * dictionary name
+     * dictionary name.
      * 
-     * @param dictionaryName
+     * @param dictionaryName dictionary name
      * @return CldsDictionaryItem list List of CLDS Dictionary items for a given
      *         dictionary name
      */
index b9cce08..2a89b19 100644 (file)
@@ -85,7 +85,7 @@ public class CldsService extends SecureServiceBase {
      * The constant LIST_OF_SDC_SERVICE_INFO_TYPE.
      */
     public static final Type LIST_OF_SDC_SERVICE_INFO_TYPE = new TypeToken<List<SdcServiceInfo>>() {
-    }.getType();
+        }.getType();
     @Produce(uri = "direct:processSubmit")
     private CamelProxy camelProxy;
     /**
@@ -551,7 +551,7 @@ public class CldsService extends SecureServiceBase {
      * UUID. If not authorized, then NotAuthorizedException is thrown.
      *
      * @param model The clds model
-     * @return
+     * @return boolean or throws NotAuthorizedException
      */
     private boolean isAuthorizedForVf(CldsModel model) {
         String vf = ModelProperties.getVf(model);
index d82e7c6..f60c638 100644 (file)
@@ -52,7 +52,7 @@ public class CldsTemplateService extends SecureServiceBase {
     private SecureServicePermission permissionReadTemplate;
     private SecureServicePermission permissionUpdateTemplate;
     @Autowired
-       private HttpServletRequest request;
+    private HttpServletRequest request;
 
     @PostConstruct
     private final void afterConstruction() {
@@ -71,11 +71,11 @@ public class CldsTemplateService extends SecureServiceBase {
      * database. This is subset of the json getModel. This is only expected to
      * be used for testing purposes, not by the UI.
      *
-     * @param templateName
+     * @param templateName template name
      * @return bpmn xml text - content of bpmn given name
      */
     public String getBpmnTemplate(String templateName) {
-       util.entering(request, "CldsTemplateService: GET template bpmn");
+        util.entering(request, "CldsTemplateService: GET template bpmn");
         Date startTime = new Date();
         isAuthorized(permissionReadTemplate);
         logger.info("GET bpmnText for templateName=" + templateName);
@@ -92,11 +92,11 @@ public class CldsTemplateService extends SecureServiceBase {
      * database. This is subset of the json getModel. This is only expected to
      * be used for testing purposes, not by the UI.
      *
-     * @param templateName
+     * @param templateName template name
      * @return image xml text - content of image given name
      */
     public String getImageXml(String templateName) {
-       util.entering(request, "CldsTemplateService: GET template image");
+        util.entering(request, "CldsTemplateService: GET template image");
         Date startTime = new Date();
         isAuthorized(permissionReadTemplate);
         logger.info("GET imageText for templateName=" + templateName);
@@ -111,11 +111,11 @@ public class CldsTemplateService extends SecureServiceBase {
     /**
      * REST service that retrieves a CLDS template by name from the database.
      *
-     * @param templateName
+     * @param templateName template name
      * @return clds template - clds template for the given template name
      */
     public CldsTemplate getTemplate(String templateName) {
-       util.entering(request, "CldsTemplateService: GET template");
+        util.entering(request, "CldsTemplateService: GET template");
         Date startTime = new Date();
         isAuthorized(permissionReadTemplate);
         logger.info("GET model for  templateName=" + templateName);
@@ -131,12 +131,12 @@ public class CldsTemplateService extends SecureServiceBase {
     /**
      * REST service that saves a CLDS template by name in the database.
      *
-     * @param templateName
-     * @param cldsTemplate
+     * @param templateName template name
+     * @param cldsTemplate clds template
      * @return The CldsTemplate modified and saved in DB
      */
     public CldsTemplate putTemplate(String templateName, CldsTemplate cldsTemplate) {
-       util.entering(request, "CldsTemplateService: PUT template");
+        util.entering(request, "CldsTemplateService: PUT template");
         Date startTime = new Date();
         isAuthorized(permissionUpdateTemplate);
         logger.info("PUT Template for  templateName=" + templateName);
@@ -158,7 +158,7 @@ public class CldsTemplateService extends SecureServiceBase {
      * @return template names in JSON
      */
     public List<ValueItem> getTemplateNames() {
-       util.entering(request, "CldsTemplateService: GET template names");
+        util.entering(request, "CldsTemplateService: GET template names");
         Date startTime = new Date();
         isAuthorized(permissionReadTemplate);
         logger.info("GET list of template names");
@@ -171,7 +171,7 @@ public class CldsTemplateService extends SecureServiceBase {
     }
 
     // Created for the integration test
-    public void setLoggingUtil (LoggingUtils utilP) {
+    public void setLoggingUtil(LoggingUtils utilP) {
         util =  utilP;
     }
 }
index adebd78..f2c75ea 100644 (file)
@@ -41,7 +41,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Component;
 
 /**
- * REST services to manage Tosca Model
+ * REST services to manage Tosca Model.
  */
 @Component
 public class CldsToscaService extends SecureServiceBase {
index 522f682..f653089 100644 (file)
@@ -53,7 +53,7 @@ public abstract class SecureServiceBase {
     /**
      * Get the userId from AAF/CSP.
      *
-     * @return
+     * @return user ID
      */
     public String getUserId() {
         return getUserName();
@@ -62,7 +62,7 @@ public abstract class SecureServiceBase {
     /**
      * Get the Full name.
      *
-     * @return
+     * @return user name
      */
     public String getUserName() {
         String name = userNameHandler.retrieveUserName(securityContext);
@@ -76,7 +76,7 @@ public abstract class SecureServiceBase {
     /**
      * Get the principal name.
      *
-     * @return
+     * @return the principal name
      */
     public String getPrincipalName() {
         String principal = ((UserDetails)securityContext.getAuthentication().getPrincipal()).getUsername();
@@ -175,13 +175,16 @@ public abstract class SecureServiceBase {
             // the rest of these don't seem to be required - isUserInRole method
             // appears to take * as a wildcard
         } else if (hasRole(inPermission.getKeyAllInstance())) {
-            securityLogger.info("{} authorized because user has permission with * for instance: {}", getPrincipalName(), inPermission.getKey());
+            securityLogger.info("{} authorized because user has permission with * for instance: {}",
+                                getPrincipalName(), inPermission.getKey());
             authorized = true;
         } else if (hasRole(inPermission.getKeyAllInstanceAction())) {
-            securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}", getPrincipalName(), inPermission.getKey());
+            securityLogger.info("{} authorized because user has permission with * for instance and * for action: {}",
+                                getPrincipalName(), inPermission.getKey());
             authorized = true;
         } else if (hasRole(inPermission.getKeyAllAction())) {
-            securityLogger.info("{} authorized because user has permission with * for action: {}", getPrincipalName(), inPermission.getKey());
+            securityLogger.info("{} authorized because user has permission with * for action: {}",
+                                getPrincipalName(), inPermission.getKey());
             authorized = true;
         } else {
             throw new NotAuthorizedException("");
@@ -196,8 +199,9 @@ public abstract class SecureServiceBase {
         }
 
         for (GrantedAuthority auth : authentication.getAuthorities()) {
-            if (role.equals(auth.getAuthority()))
+            if (role.equals(auth.getAuthority())) {
                 return true;
+            }
         }
 
         return false;
index ae30d2a..a93732c 100644 (file)
@@ -37,10 +37,10 @@ public class SecureServicePermission {
     /**
      * Factory method to create permission given type, instance, and action.
      *
-     * @param type
-     * @param instance
-     * @param action
-     * @return
+     * @param type type of the permission
+     * @param instance instance of the permission
+     * @param action action of the permission
+     * @return instance of SecureServicePermission with type, instance and action
      */
     public static SecureServicePermission create(String type, String instance, String action) {
         return new SecureServicePermission(type, instance, action);
@@ -50,9 +50,9 @@ public class SecureServicePermission {
      * Factory method to create permission given type and instance. Default
      * action to ALL/*.
      *
-     * @param type
-     * @param instance
-     * @return
+     * @param type type of the permission
+     * @param instance instance of the permission
+     * @return instance of SecureServicePermission with type, instance and default action
      */
     public static SecureServicePermission create(String type, String instance) {
         return new SecureServicePermission(type, instance, ALL);
@@ -62,8 +62,8 @@ public class SecureServicePermission {
      * Factory method to create permission given type. Default instance and
      * action to ALL/*.
      *
-     * @param type
-     * @return
+     * @param type type of the permission
+     * @return instance of SecureServicePermission with type and default instance and action
      */
     public static SecureServicePermission create(String type) {
         return new SecureServicePermission(type, ALL, ALL);
@@ -72,9 +72,9 @@ public class SecureServicePermission {
     /**
      * Instantiate permission given type, instance, and action.
      *
-     * @param type
-     * @param instance
-     * @param action
+     * @param type type of the permission
+     * @param instance instance of the permission
+     * @param action action of the permission
      */
     public SecureServicePermission(String type, String instance, String action) {
         this.type = type;
@@ -99,7 +99,7 @@ public class SecureServicePermission {
     }
 
     /**
-     * Override toString - return permission in key format
+     * Override toString - return permission in key format.
      */
     @Override
     public String toString() {
@@ -110,7 +110,7 @@ public class SecureServicePermission {
      * Return Permission in Key format = type, instance, and action separate by
      * pipe character.
      *
-     * @return
+     * @return permission in key format
      */
     public String getKey() {
         return type + "|" + instance + "|" + action;
@@ -120,7 +120,7 @@ public class SecureServicePermission {
      * Return Permission in Key format = type, all instance, and action separate
      * by pipe character.
      *
-     * @return
+     * @return permission in key format
      */
     public String getKeyAllInstance() {
         return type + "|" + ALL + "|" + action;
@@ -130,7 +130,7 @@ public class SecureServicePermission {
      * Return Permission in Key format = type, all instance, and all action
      * separate by pipe character.
      *
-     * @return
+     * @return permission in key format
      */
     public String getKeyAllInstanceAction() {
         return type + "|" + ALL + "|" + ALL;
@@ -140,13 +140,15 @@ public class SecureServicePermission {
      * Return Permission in Key format = type, instance, and all action separate
      * by pipe character.
      *
-     * @return
+     * @return permission in key format
      */
     public String getKeyAllAction() {
         return type + "|" + instance + "|" + ALL;
     }
 
     /**
+     * Returns the permission type.
+     *
      * @return the type
      */
     public String getType() {
@@ -154,14 +156,17 @@ public class SecureServicePermission {
     }
 
     /**
-     * @param type
-     *            the type to set
+     * Sets the type of permission.
+     *
+     * @param type the type to set
      */
     public void setType(String type) {
         this.type = type;
     }
 
     /**
+     * Returns the instance of permission.
+     *
      * @return the instance
      */
     public String getInstance() {
@@ -169,14 +174,17 @@ public class SecureServicePermission {
     }
 
     /**
-     * @param instance
-     *            the instance to set
+     * Sets the instance of permission.
+     *
+     * @param instance the instance to set
      */
     public void setInstance(String instance) {
         this.instance = instance;
     }
 
     /**
+     * Returns the action of permission.
+     *
      * @return the action
      */
     public String getAction() {
@@ -184,8 +192,9 @@ public class SecureServicePermission {
     }
 
     /**
-     * @param action
-     *            the action to set
+     * Sets the action of permission.
+     *
+     * @param action the action to set
      */
     public void setAction(String action) {
         this.action = action;
index cfe50c9..cf8f663 100644 (file)
@@ -35,12 +35,11 @@ import org.springframework.stereotype.Controller;
 @Controller
 public class UserService {
 
-    private SecurityContext           securityContext= SecurityContextHolder.getContext();
+    private SecurityContext           securityContext = SecurityContextHolder.getContext();
 
     /**
      * REST service that returns the username.
      *
-     * @param userName
      * @return the user name
      */
     public String getUser() {