From 773f99551923739e47c53c7bc1ac4ed6b7e0eda1 Mon Sep 17 00:00:00 2001 From: asgar Date: Thu, 6 Sep 2018 00:01:04 +0530 Subject: Return expression instead of temporary variable Change-Id: Ib5d939c99fc4fb9845f06e787b3915640acfce3e Issue-ID: AAI-1575 Signed-off-by: Mohamed Asgar Samiulla --- .../org/onap/aai/config/IntrospectionConfig.java | 35 +++++++++--------- .../java/org/onap/aai/config/RestBeanConfig.java | 31 ++++++++-------- .../org/onap/aai/config/SchemaConfiguration.java | 26 ++++++------- .../aai/config/SwaggerGenerationConfiguration.java | 43 +++++++++++----------- 4 files changed, 67 insertions(+), 68 deletions(-) diff --git a/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java b/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java index e0ce203d..aa4ec1a1 100644 --- a/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java +++ b/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -35,23 +37,22 @@ import org.onap.aai.nodes.NodeIngestor; @Configuration public class IntrospectionConfig { - private Map MOXYINSTANCEMAP = new ConcurrentHashMap<>(); - @Autowired - NodeIngestor nodeIngestor; + private Map moxyInstanceMap = new ConcurrentHashMap<>(); + @Autowired + NodeIngestor nodeIngestor; - @Bean - public LoaderFactory loaderFactory(SchemaVersions schemaVersions) { - LoaderFactory loaderFactory = new LoaderFactory(moxyLoaderInstance(schemaVersions)); - return loaderFactory; - } + @Bean + public LoaderFactory loaderFactory(SchemaVersions schemaVersions) { + return new LoaderFactory(moxyLoaderInstance(schemaVersions)); + } - @Bean - public Map moxyLoaderInstance(SchemaVersions schemaVersions) { - for(SchemaVersion version : schemaVersions.getVersions()){ - if (!MOXYINSTANCEMAP.containsKey(version)) { - MOXYINSTANCEMAP.put(version, new MoxyLoader(version, nodeIngestor)); - } - } - return MOXYINSTANCEMAP; - } + @Bean + public Map moxyLoaderInstance(SchemaVersions schemaVersions) { + for(SchemaVersion version : schemaVersions.getVersions()){ + if (!moxyInstanceMap.containsKey(version)) { + moxyInstanceMap.put(version, new MoxyLoader(version, nodeIngestor)); + } + } + return moxyInstanceMap; + } } diff --git a/aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java b/aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java index 29763291..6c56ff69 100644 --- a/aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java +++ b/aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,21 +33,18 @@ import org.springframework.context.annotation.Scope; @Configuration public class RestBeanConfig { - @Bean(name = "traversalUriHttpEntry") - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public HttpEntry traversalUriHttpEntry() { - HttpEntry httpEntry = new HttpEntry(ModelType.MOXY, QueryStyle.TRAVERSAL_URI); - return httpEntry; - } - - @Bean(name = "traversalHttpEntry") - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public HttpEntry traversalHttpEntry() { - HttpEntry httpEntry = new HttpEntry(ModelType.MOXY, QueryStyle.TRAVERSAL); - - return httpEntry; - } - - + @Bean(name = "traversalUriHttpEntry") + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public HttpEntry traversalUriHttpEntry() { + return new HttpEntry(ModelType.MOXY, QueryStyle.TRAVERSAL_URI); + } + + @Bean(name = "traversalHttpEntry") + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public HttpEntry traversalHttpEntry() { + return new HttpEntry(ModelType.MOXY, QueryStyle.TRAVERSAL); + } + + } diff --git a/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java b/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java index 20112bde..b00ecfb7 100644 --- a/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java +++ b/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -43,20 +45,18 @@ public class SchemaConfiguration { return new EdgeSerializer(edgeIngestor); } - @Bean(name = "nodeIngestor") - public NodeIngestor nodeIngestor(ConfigTranslator configTranslator) { - NodeIngestor nodeIngestor = new NodeIngestor(configTranslator); - return nodeIngestor; - } + @Bean(name = "nodeIngestor") + public NodeIngestor nodeIngestor(ConfigTranslator configTranslator) { + return new NodeIngestor(configTranslator); + } - @Bean(name = "configTranslator") - public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions) { - ConfigTranslator aaiConfigTranslator = new AAIConfigTranslator(schemaLocationsBean, schemaVersions); - return aaiConfigTranslator; - } + @Bean(name = "configTranslator") + public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions) { + return new AAIConfigTranslator(schemaLocationsBean, schemaVersions); + } - @Bean - public SchemaErrorStrategy schemaErrorStrategy(){ + @Bean + public SchemaErrorStrategy schemaErrorStrategy(){ return new CheckEverythingStrategy(); - } + } } diff --git a/aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java b/aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java index a09018ad..fbbb703a 100644 --- a/aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java +++ b/aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -35,28 +37,25 @@ import org.springframework.context.annotation.Scope; @Configuration public class SwaggerGenerationConfiguration { - @Value("${schema.uri.base.path}") - private String basePath; + @Value("${schema.uri.base.path}") + private String basePath; - @Bean - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public NodesYAMLfromOXM nodesYamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { - NodesYAMLfromOXM nodesYamlFromOXM = new NodesYAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); - return nodesYamlFromOXM; - } - - @Bean - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public HTMLfromOXM htmlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { - HTMLfromOXM htmlFromOXM = new HTMLfromOXM(schemaVersions, nodeIngestor, edgeIngestor); - return htmlFromOXM; - } - - @Bean - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public YAMLfromOXM yamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { - YAMLfromOXM yamlFromOXM = new YAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); - return yamlFromOXM; - } + @Bean + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public NodesYAMLfromOXM nodesYamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { + return new NodesYAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); + } + + @Bean + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public HTMLfromOXM htmlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { + return new HTMLfromOXM(schemaVersions, nodeIngestor, edgeIngestor); + } + + @Bean + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public YAMLfromOXM yamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { + return new YAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); + } } -- cgit 1.2.3-korg