Return expression instead of temporary variable 41/64841/2
authorasgar <sammoham@in.ibm.com>
Wed, 5 Sep 2018 18:31:04 +0000 (00:01 +0530)
committerMohamed Asgar Samiulla <sammoham@in.ibm.com>
Thu, 6 Sep 2018 04:50:28 +0000 (04:50 +0000)
Change-Id: Ib5d939c99fc4fb9845f06e787b3915640acfce3e
Issue-ID: AAI-1575
Signed-off-by: Mohamed Asgar Samiulla <sammoham@in.ibm.com>
aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java
aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java
aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java
aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java

index e0ce203..aa4ec1a 100644 (file)
@@ -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<SchemaVersion, MoxyLoader> MOXYINSTANCEMAP = new ConcurrentHashMap<>();
-       @Autowired
-       NodeIngestor nodeIngestor;
+    private Map<SchemaVersion, MoxyLoader> 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<SchemaVersion, MoxyLoader> moxyLoaderInstance(SchemaVersions schemaVersions) {
-           for(SchemaVersion version : schemaVersions.getVersions()){
-                       if (!MOXYINSTANCEMAP.containsKey(version)) {
-                               MOXYINSTANCEMAP.put(version, new MoxyLoader(version, nodeIngestor));
-                       }
-               }
-               return MOXYINSTANCEMAP;
-       }
+    @Bean
+    public Map<SchemaVersion, MoxyLoader> moxyLoaderInstance(SchemaVersions schemaVersions) {
+        for(SchemaVersion version : schemaVersions.getVersions()){
+            if (!moxyInstanceMap.containsKey(version)) {
+                moxyInstanceMap.put(version, new MoxyLoader(version, nodeIngestor));
+            }
+        }
+        return moxyInstanceMap;
+    }
 }
index 2976329..6c56ff6 100644 (file)
@@ -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);
+    }
+    
+    
     
 }
index 20112bd..b00ecfb 100644 (file)
@@ -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();
-       }
+    }
 }
index a09018a..fbbb703 100644 (file)
@@ -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);
+    }
     
 }