diff options
Diffstat (limited to 'src')
26 files changed, 166 insertions, 141 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java index 283d8c52..052ea730 100644 --- a/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java @@ -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; diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java index e0a804e4..1fdc898a 100644 --- a/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsConfiguration.java @@ -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") diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java index 3f1403f1..92b0272a 100644 --- a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java @@ -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 -> { diff --git a/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java index 2977d1a8..55b90cc5 100644 --- a/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/spring/SdcControllerConfiguration.java @@ -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 -> { diff --git a/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java b/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java index c6b0d555..caf525ee 100644 --- a/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java +++ b/src/main/java/org/onap/clamp/clds/exception/BadRequestException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java b/src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java index c06d1015..93d98151 100644 --- a/src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java +++ b/src/main/java/org/onap/clamp/clds/exception/CldsConfigException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java b/src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java index 0f54f3bf..270bfa1e 100644 --- a/src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java +++ b/src/main/java/org/onap/clamp/clds/exception/CldsUsersException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java b/src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java index 02d57032..5892dfc5 100644 --- a/src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java +++ b/src/main/java/org/onap/clamp/clds/exception/ModelBpmnException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java b/src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java index b17616bc..8d474fc0 100644 --- a/src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java +++ b/src/main/java/org/onap/clamp/clds/exception/ModelPropertiesException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java b/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java index 4ea05039..1bdf18e7 100644 --- a/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java +++ b/src/main/java/org/onap/clamp/clds/exception/NotAuthorizedException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java b/src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java index 92d36633..3bfb5ea7 100644 --- a/src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java +++ b/src/main/java/org/onap/clamp/clds/exception/TcaRequestFormatterException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java b/src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java index 9e113217..e733da53 100644 --- a/src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java +++ b/src/main/java/org/onap/clamp/clds/exception/dcae/DcaeDeploymentException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java b/src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java index 85695a25..06dcdbf0 100644 --- a/src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java +++ b/src/main/java/org/onap/clamp/clds/exception/policy/PolicyClientException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java index 862b2133..b70b1140 100644 --- a/src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java +++ b/src/main/java/org/onap/clamp/clds/exception/sdc/SdcCommunicationException.java @@ -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); } /** diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java index 4e1b8eac..c3ebde1f 100644 --- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java +++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/CsarHandlerException.java @@ -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); diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java index eba3263d..523766af 100644 --- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java +++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcArtifactInstallerException.java @@ -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); diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java index 1a7afd26..d73001d7 100644 --- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java +++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcControllerException.java @@ -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); diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java index fa92499a..6cd3fb88 100644 --- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java +++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcDownloadException.java @@ -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); diff --git a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java index 8a11a6ef..bfe63cbf 100644 --- a/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java +++ b/src/main/java/org/onap/clamp/clds/exception/sdc/controller/SdcParametersException.java @@ -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); diff --git a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java index 0fb1e0f3..76417132 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsDictionaryService.java @@ -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 */ diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index b9cce087..2a89b198 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -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); diff --git a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java index d82e7c6e..f60c6383 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java @@ -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; } } diff --git a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java index adebd785..f2c75ead 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsToscaService.java @@ -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 { diff --git a/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java b/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java index 522f682b..f6530890 100644 --- a/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java +++ b/src/main/java/org/onap/clamp/clds/service/SecureServiceBase.java @@ -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; diff --git a/src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java b/src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java index ae30d2aa..a93732c3 100644 --- a/src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java +++ b/src/main/java/org/onap/clamp/clds/service/SecureServicePermission.java @@ -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; diff --git a/src/main/java/org/onap/clamp/clds/service/UserService.java b/src/main/java/org/onap/clamp/clds/service/UserService.java index cfe50c95..cf8f6630 100644 --- a/src/main/java/org/onap/clamp/clds/service/UserService.java +++ b/src/main/java/org/onap/clamp/clds/service/UserService.java @@ -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() { |