From d5f36a1f874e7045abec81dac2e249aa5e5be051 Mon Sep 17 00:00:00 2001 From: Vidyashree Rama Date: Tue, 16 Apr 2019 10:52:51 +0530 Subject: Fix Checkstyle issues Fix Checkstyle issues Issue-ID: CLAMP-328 Change-Id: Idecd87abbf3765a7e77e2219df1063e732bb04b0 Signed-off-by: Vidyashree Rama --- .../clamp/authorization/AuthorizationController.java | 6 +++--- .../org/onap/clamp/clds/config/AAFConfiguration.java | 1 + .../org/onap/clamp/clds/config/CamelConfiguration.java | 1 + .../java/org/onap/clamp/clds/config/ClampProperties.java | 4 ++-- .../org/onap/clamp/clds/config/CldsUserJsonDecoder.java | 6 ++++++ .../onap/clamp/clds/config/DefaultUserConfiguration.java | 2 +- .../org/onap/clamp/clds/config/PolicyConfiguration.java | 5 +++++ .../onap/clamp/clds/config/SystemPropertiesLoader.java | 2 +- .../config/sdc/BlueprintParserMappingConfiguration.java | 2 +- .../clds/config/sdc/SdcControllersConfiguration.java | 9 ++++++++- .../config/sdc/SdcSingleControllerConfiguration.java | 10 ++++++++-- .../onap/clamp/clds/config/spring/CldsConfiguration.java | 2 +- .../org/onap/clamp/clds/dao/CldsServiceDataMapper.java | 2 +- .../java/org/onap/clamp/clds/dao/ValueItemMapper.java | 2 +- .../onap/clamp/clds/service/CldsHealthcheckService.java | 11 +++++++---- .../onap/clamp/configuration/ClampGsonDataFormat.java | 9 +++++---- .../dao/model/jsontype/JsonStringSqlTypeDescriptor.java | 2 +- .../clamp/dao/model/jsontype/JsonTypeDescriptor.java | 16 +++++++++++----- .../clamp/dao/model/jsontype/StringJsonUserType.java | 2 +- .../org/onap/clamp/exception/OperationException.java | 16 ++++++++-------- .../clamp/policy/microservice/MicroServicePolicy.java | 4 ++-- 21 files changed, 75 insertions(+), 39 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/onap/clamp/authorization/AuthorizationController.java b/src/main/java/org/onap/clamp/authorization/AuthorizationController.java index 568af480..511b9509 100644 --- a/src/main/java/org/onap/clamp/authorization/AuthorizationController.java +++ b/src/main/java/org/onap/clamp/authorization/AuthorizationController.java @@ -76,7 +76,7 @@ public class AuthorizationController { * @param action * The action of the permissions. e.g. read */ - public void authorize (Exchange camelExchange, String typeVar, String instanceVar, String action) { + public void authorize(Exchange camelExchange, String typeVar, String instanceVar, String action) { String type = refProp.getStringValue(permPrefix + typeVar); String instance = refProp.getStringValue(permInstance); @@ -123,7 +123,7 @@ public class AuthorizationController { principalName, inPermission.getKey()); authorized = true; } else if (hasRole(inPermission.getKeyAllAction())) { - auditLogger.info("{} authorized because user has permission with * for action: {}", + auditLogger.info("{} authorized because user has permission with * for action: {}", principalName, inPermission.getKey()); authorized = true; } else { @@ -133,7 +133,7 @@ public class AuthorizationController { } /** - * Verify whether the user has the permission + * Verify whether the user has the permission. * * @param inPermission * The permissions to verify diff --git a/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java b/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java index c91494df..99d64fd8 100644 --- a/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java @@ -20,6 +20,7 @@ * =================================================================== * */ + package org.onap.clamp.clds.config; import javax.servlet.Filter; diff --git a/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java b/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java index f178ce03..3a98788f 100644 --- a/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java @@ -19,6 +19,7 @@ * ============LICENSE_END============================================ * =================================================================== */ + package org.onap.clamp.clds.config; import org.apache.camel.CamelContext; diff --git a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java index 4f1e8a28..9905585d 100644 --- a/src/main/java/org/onap/clamp/clds/config/ClampProperties.java +++ b/src/main/java/org/onap/clamp/clds/config/ClampProperties.java @@ -155,8 +155,8 @@ public class ClampProperties { } /** - * - * + * Returns the list of strings split with separator. + * * @param key * property key * @param separator diff --git a/src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java b/src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java index 8af1286c..602ee62e 100644 --- a/src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java +++ b/src/main/java/org/onap/clamp/clds/config/CldsUserJsonDecoder.java @@ -53,6 +53,12 @@ public class CldsUserJsonDecoder { } } + /** + * This method decodes the JSON string to a CldsUser Array. + * + * @param cldsUsersString JSON string + * @return CldsUser[] Array containing a list of the user defined in the JSON + */ public static CldsUser[] decodeJson(String cldsUsersString) { try { // the ObjectMapper readValue method closes the stream no need to do diff --git a/src/main/java/org/onap/clamp/clds/config/DefaultUserConfiguration.java b/src/main/java/org/onap/clamp/clds/config/DefaultUserConfiguration.java index a99dde20..6ec2221d 100644 --- a/src/main/java/org/onap/clamp/clds/config/DefaultUserConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/DefaultUserConfiguration.java @@ -86,7 +86,7 @@ public class DefaultUserConfiguration extends WebSecurityConfigurerAdapter { * defined in cldsUsersFile variable (this file path can be configured in the * application.properties). * - * @param auth + * @param auth authentication manager builder */ @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) { diff --git a/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java b/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java index cd89acbe..a4f37e8b 100644 --- a/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/PolicyConfiguration.java @@ -113,6 +113,11 @@ public class PolicyConfiguration { this.policyEnvironment = environment; } + /** + * Returns policy configuration properties. + * + * @return policy configuration properties + */ public Properties getProperties() { Properties prop = new Properties(); prop.put(PDP_URL1, pdpUrl1); diff --git a/src/main/java/org/onap/clamp/clds/config/SystemPropertiesLoader.java b/src/main/java/org/onap/clamp/clds/config/SystemPropertiesLoader.java index 093ad48f..7480beb8 100644 --- a/src/main/java/org/onap/clamp/clds/config/SystemPropertiesLoader.java +++ b/src/main/java/org/onap/clamp/clds/config/SystemPropertiesLoader.java @@ -43,7 +43,7 @@ public class SystemPropertiesLoader implements ApplicationListener>() { - }.getType(); + }.getType(); private String blueprintKey; private boolean dcaeDeployable; private BlueprintParserFilesConfiguration files; diff --git a/src/main/java/org/onap/clamp/clds/config/sdc/SdcControllersConfiguration.java b/src/main/java/org/onap/clamp/clds/config/sdc/SdcControllersConfiguration.java index b21c75f2..b7a7f0e7 100644 --- a/src/main/java/org/onap/clamp/clds/config/sdc/SdcControllersConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/sdc/SdcControllersConfiguration.java @@ -63,11 +63,18 @@ public class SdcControllersConfiguration { */ private JsonObject jsonRootNode; + /** + * Loads configuration from SDC controller config file. + * + * @throws IOException IO Exception + */ @PostConstruct public void loadConfiguration() throws IOException { Resource resource = appContext.getResource(sdcControllerFile); // Try to load json tree - jsonRootNode = JsonUtils.GSON.fromJson(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), JsonObject.class); + jsonRootNode = JsonUtils.GSON.fromJson(new InputStreamReader( + resource.getInputStream(), StandardCharsets.UTF_8), + JsonObject.class); } public SdcSingleControllerConfiguration getSdcSingleControllerConfiguration(String controllerName) { 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 564e01f1..283d8c52 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 @@ -81,7 +81,7 @@ public class SdcSingleControllerConfiguration implements IConfiguration { public static final String TOSCA_CSAR = "TOSCA_CSAR"; public static final String VF_MODULES_METADATA = "VF_MODULES_METADATA"; private static final String[] SUPPORTED_ARTIFACT_TYPES = { - TOSCA_CSAR, VF_MODULES_METADATA + TOSCA_CSAR, VF_MODULES_METADATA }; public static final List SUPPORTED_ARTIFACT_TYPES_LIST = Collections .unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); @@ -105,6 +105,11 @@ public class SdcSingleControllerConfiguration implements IConfiguration { return sdcControllerName; } + /** + * Sets SDC controller name. + * + * @param controllerName SDC controller name + */ public void setSdcControllerName(String controllerName) { this.sdcControllerName = controllerName; errorMessageKeyNotFound = " parameter cannot be found in config file for controller name" + sdcControllerName; @@ -198,7 +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 8e1c75bb..e0a804e4 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 @@ -47,7 +47,7 @@ public class CldsConfiguration { private ClampProperties refProp; /** - * Clds Identity database DataSource configuration + * Clds Identity database DataSource configuration. * * @return */ diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsServiceDataMapper.java b/src/main/java/org/onap/clamp/clds/dao/CldsServiceDataMapper.java index 4e0a50c4..2fc04781 100644 --- a/src/main/java/org/onap/clamp/clds/dao/CldsServiceDataMapper.java +++ b/src/main/java/org/onap/clamp/clds/dao/CldsServiceDataMapper.java @@ -39,7 +39,7 @@ import org.onap.clamp.clds.model.CldsVfcData; import org.springframework.jdbc.core.RowMapper; /** - * Generic mapper for CldsDBServiceCache + * Generic mapper for CldsDBServiceCache. */ public final class CldsServiceDataMapper implements RowMapper { diff --git a/src/main/java/org/onap/clamp/clds/dao/ValueItemMapper.java b/src/main/java/org/onap/clamp/clds/dao/ValueItemMapper.java index 4c3ff9dc..599bef7e 100644 --- a/src/main/java/org/onap/clamp/clds/dao/ValueItemMapper.java +++ b/src/main/java/org/onap/clamp/clds/dao/ValueItemMapper.java @@ -30,7 +30,7 @@ import org.onap.clamp.clds.model.ValueItem; import org.springframework.jdbc.core.RowMapper; /** - * Generic mapper for list of values + * Generic mapper for list of values. */ public final class ValueItemMapper implements RowMapper { @Override diff --git a/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java b/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java index c25e6e7a..1b0cca60 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsHealthcheckService.java @@ -19,6 +19,7 @@ * ============LICENSE_END============================================ * =================================================================== */ + package org.onap.clamp.clds.service; import com.att.eelf.configuration.EELFLogger; @@ -46,7 +47,7 @@ public class CldsHealthcheckService { @Autowired private CldsDao cldsDao; - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsHealthcheckService.class); + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsHealthcheckService.class); /** * REST service that retrieves clds healthcheck information. @@ -76,11 +77,13 @@ public class CldsHealthcheckService { } // audit log LoggingUtils.setTimeContext(startTime, new Date()); - if(healthcheckFailed) { - util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "Healthcheck failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR); + if (healthcheckFailed) { + util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "Healthcheck failed", Level.INFO, + ONAPLogConstants.ResponseStatus.ERROR); return new ResponseEntity<>(cldsHealthCheck, HttpStatus.INTERNAL_SERVER_ERROR); } else { - util.exiting("200", "Healthcheck failed", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED); + util.exiting("200", "Healthcheck failed", Level.INFO, + ONAPLogConstants.ResponseStatus.COMPLETED); return new ResponseEntity<>(cldsHealthCheck, HttpStatus.OK); } } diff --git a/src/main/java/org/onap/clamp/configuration/ClampGsonDataFormat.java b/src/main/java/org/onap/clamp/configuration/ClampGsonDataFormat.java index aad1ab4c..c4d28be2 100644 --- a/src/main/java/org/onap/clamp/configuration/ClampGsonDataFormat.java +++ b/src/main/java/org/onap/clamp/configuration/ClampGsonDataFormat.java @@ -19,6 +19,7 @@ * ============LICENSE_END============================================ * =================================================================== */ + package org.onap.clamp.configuration; import com.google.gson.Gson; @@ -50,7 +51,7 @@ public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, D } /** - * Use the default Gson {@link Gson} and with a custom unmarshal type + * Use the default Gson {@link Gson} and with a custom unmarshal type. * * @param unmarshalType * the custom unmarshal type @@ -60,7 +61,7 @@ public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, D } /** - * Use a custom Gson mapper and and unmarshal type + * Use a custom Gson mapper and and unmarshal type. * * @param gson * the custom mapper @@ -73,7 +74,7 @@ public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, D } /** - * Use the default Gson {@link Gson} and with a custom unmarshal generic type + * Use the default Gson {@link Gson} and with a custom unmarshal generic type. * * @param unmarshalGenericType * the custom unmarshal generic type @@ -83,7 +84,7 @@ public class ClampGsonDataFormat extends ServiceSupport implements DataFormat, D } /** - * Use a custom Gson mapper and and unmarshal token type + * Use a custom Gson mapper and and unmarshal token type. * * @param gson * the custom mapper diff --git a/src/main/java/org/onap/clamp/dao/model/jsontype/JsonStringSqlTypeDescriptor.java b/src/main/java/org/onap/clamp/dao/model/jsontype/JsonStringSqlTypeDescriptor.java index 611f5ec2..f5aba4e1 100644 --- a/src/main/java/org/onap/clamp/dao/model/jsontype/JsonStringSqlTypeDescriptor.java +++ b/src/main/java/org/onap/clamp/dao/model/jsontype/JsonStringSqlTypeDescriptor.java @@ -40,7 +40,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; public class JsonStringSqlTypeDescriptor implements SqlTypeDescriptor { /** - * + * The serial version ID. */ private static final long serialVersionUID = 1103168570216921981L; diff --git a/src/main/java/org/onap/clamp/dao/model/jsontype/JsonTypeDescriptor.java b/src/main/java/org/onap/clamp/dao/model/jsontype/JsonTypeDescriptor.java index 155758e1..518ec2d0 100644 --- a/src/main/java/org/onap/clamp/dao/model/jsontype/JsonTypeDescriptor.java +++ b/src/main/java/org/onap/clamp/dao/model/jsontype/JsonTypeDescriptor.java @@ -35,17 +35,20 @@ import org.onap.clamp.clds.util.JsonUtils; public class JsonTypeDescriptor extends AbstractTypeDescriptor { /** - * + * The serial version ID. */ private static final long serialVersionUID = -3439698221196089003L; public static final JsonTypeDescriptor INSTANCE = new JsonTypeDescriptor(); + /** + * Creates an instance of JsonTypeDescriptor. + */ public JsonTypeDescriptor() { super(JsonObject.class, new ImmutableMutabilityPlan() { /** - * + * The serial version ID. */ private static final long serialVersionUID = 1169396106518110214L; @@ -74,8 +77,9 @@ public class JsonTypeDescriptor extends AbstractTypeDescriptor { @Override public X unwrap(JsonObject value, Class type, WrapperOptions options) { - if (value == null) + if (value == null) { return null; + } if (String.class.isAssignableFrom(type)) { return (X) toString(value); @@ -89,11 +93,13 @@ public class JsonTypeDescriptor extends AbstractTypeDescriptor { @Override public JsonObject wrap(X value, WrapperOptions options) { - if (value == null) + if (value == null) { return null; + } - if (String.class.isInstance(value)) + if (String.class.isInstance(value)) { return JsonUtils.GSON_JPA_MODEL.fromJson((String) value, JsonObject.class); + } throw unknownWrap(value.getClass()); } diff --git a/src/main/java/org/onap/clamp/dao/model/jsontype/StringJsonUserType.java b/src/main/java/org/onap/clamp/dao/model/jsontype/StringJsonUserType.java index 1831c174..621fa8da 100644 --- a/src/main/java/org/onap/clamp/dao/model/jsontype/StringJsonUserType.java +++ b/src/main/java/org/onap/clamp/dao/model/jsontype/StringJsonUserType.java @@ -32,7 +32,7 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; public class StringJsonUserType extends AbstractSingleColumnStandardBasicType { /** - * + * The serial version ID. */ private static final long serialVersionUID = -7929809808079327767L; diff --git a/src/main/java/org/onap/clamp/exception/OperationException.java b/src/main/java/org/onap/clamp/exception/OperationException.java index 0233b092..6e26d294 100644 --- a/src/main/java/org/onap/clamp/exception/OperationException.java +++ b/src/main/java/org/onap/clamp/exception/OperationException.java @@ -30,20 +30,20 @@ package org.onap.clamp.exception; public class OperationException extends RuntimeException { /** - * The serial version ID. - */ - private static final long serialVersionUID = 2788967876393519620L; + * The serial version ID. + */ + private static final long serialVersionUID = 2788967876393519620L; - /** + /** * This constructor can be used to create a new CldsUsersException. - * + * * @param message * A string message detailing the problem - * @param e + * @param cause * The exception sent by the code */ - public OperationException(String message, Throwable e) { - super(message, e); + public OperationException(String message, Throwable cause) { + super(message, cause); } /** diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java index 332b20a0..2bbb9118 100644 --- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java +++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java @@ -100,7 +100,7 @@ public class MicroServicePolicy implements Serializable, Policy { * * @param name * The name of the MicroService - * @param type + * @param modelType * The model type of the MicroService * @param policyTosca * The policy Tosca of the MicroService @@ -132,7 +132,7 @@ public class MicroServicePolicy implements Serializable, Policy { * * @param name * The name of the MicroService - * @param type + * @param modelType * The model type of the MicroService * @param policyTosca * The policy Tosca of the MicroService -- cgit 1.2.3-korg