aboutsummaryrefslogtreecommitdiffstats
path: root/aai-schema-service/src/main/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'aai-schema-service/src/main/java/org/onap')
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java5
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ConfigTranslator.java2
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java19
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/MappingConfig.java36
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeResource.java17
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java17
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/healthcheck/EchoResource.java4
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/RequestTransactionLogging.java4
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java5
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaResource.java8
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java16
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/CheckEverythingStrategy.java2
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/DefaultVersionValidationModule.java2
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/NodeValidator.java2
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/VersionValidator.java2
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryResource.java13
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/versions/VersionResource.java15
-rw-r--r--aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java5
18 files changed, 89 insertions, 85 deletions
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
index 1cc7a36..5c36ed8 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/SchemaServiceApp.java
@@ -37,6 +37,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerA
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
+import org.springframework.core.env.Profiles;
@SpringBootApplication
// Component Scan provides a way to look for spring beans
@@ -114,8 +115,8 @@ public class SchemaServiceApp {
// This is only needed for tomcat keeping this as temporary
System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
- if (env.acceptsProfiles(Profiles.TWO_WAY_SSL)
- && env.acceptsProfiles(Profiles.ONE_WAY_SSL)) {
+ if (env.acceptsProfiles(Profiles.of(org.onap.aai.schemaservice.Profiles.TWO_WAY_SSL))
+ && env.acceptsProfiles(Profiles.of(org.onap.aai.schemaservice.Profiles.ONE_WAY_SSL))) {
logger.warn("You have seriously misconfigured your application");
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ConfigTranslator.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ConfigTranslator.java
index b86f9fa..a76e4df 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ConfigTranslator.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ConfigTranslator.java
@@ -25,7 +25,6 @@ import java.util.Map;
import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
-import org.springframework.beans.factory.annotation.Autowired;
/**
* Converts the contents of the schema config file
@@ -37,7 +36,6 @@ public abstract class ConfigTranslator {
protected SchemaLocationsBean bean;
protected SchemaVersions schemaVersions;
- @Autowired
public ConfigTranslator(SchemaLocationsBean schemaLocationbean, SchemaVersions schemaVersions) {
this.bean = schemaLocationbean;
this.schemaVersions = schemaVersions;
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java
index 83a1805..f81ca52 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/ErrorHandler.java
@@ -33,7 +33,6 @@ import javax.ws.rs.core.MediaType;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.logging.ErrorObject;
-import org.onap.aai.logging.ErrorObjectNotFoundException;
import org.onap.aai.logging.LogFormatTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -108,13 +107,8 @@ public class ErrorHandler extends OncePerRequestFilter {
AAIException aaiException = (AAIException) e;
String message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, aaiException,
templateVars);
- ErrorObject object = null;
- try {
- object = ErrorLogHelper.getErrorObject(aaiException.getCode());
- httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
- } catch (ErrorObjectNotFoundException e1) {
- LOGGER.error("getErrorObject exception {}", LogFormatTools.getStackTop(e1));
- }
+ ErrorObject object = ErrorLogHelper.getErrorObject(aaiException.getCode());
+ httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
httpServletResponse.setContentType(mediaTypeList.get(0).toString());
httpServletResponse.getWriter().write(message);
httpServletResponse.getWriter().close();
@@ -132,13 +126,8 @@ public class ErrorHandler extends OncePerRequestFilter {
LOGGER.error("Encountered an internal exception {}", LogFormatTools.getStackTop(e));
String message = ErrorLogHelper.getRESTAPIErrorResponse(mediaTypeList, aaiException,
templateVars);
- ErrorObject object = null;
- try {
- object = ErrorLogHelper.getErrorObject(aaiException.getCode());
- httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
- } catch (ErrorObjectNotFoundException e1) {
- LOGGER.error("getErrorObject exception {}", LogFormatTools.getStackTop(e1));
- }
+ ErrorObject object = ErrorLogHelper.getErrorObject(aaiException.getCode());
+ httpServletResponse.setStatus(object.getHTTPResponseCode().getStatusCode());
httpServletResponse.setContentType(mediaTypeList.get(0).toString());
httpServletResponse.getWriter().write(message);
httpServletResponse.getWriter().close();
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/MappingConfig.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/MappingConfig.java
new file mode 100644
index 0000000..45e0093
--- /dev/null
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/config/MappingConfig.java
@@ -0,0 +1,36 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2024 Deutsche Telekom. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.aai.schemaservice.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+@Configuration
+public class MappingConfig {
+
+ @Bean
+ public Gson gson() {
+ return new GsonBuilder().create();
+ }
+}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeResource.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeResource.java
index bae48c3..429fe02 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeResource.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeResource.java
@@ -23,6 +23,8 @@ package org.onap.aai.schemaservice.edges;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import lombok.RequiredArgsConstructor;
+
import java.util.Optional;
import javax.ws.rs.GET;
@@ -40,23 +42,18 @@ import org.onap.aai.restcore.RESTAPI;
import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
import org.onap.aai.schemaservice.nodeschema.validation.AAISchemaValidationException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.RestController;
@Path("/v1")
+@RestController
+@RequiredArgsConstructor
public class EdgeResource extends RESTAPI {
private final EdgeService edgeService;
private final SchemaVersions schemaVersions;
private final Gson gson;
- @Autowired
- public EdgeResource(EdgeService edgeService, SchemaVersions schemaVersions) {
- this.edgeService = edgeService;
- this.schemaVersions = schemaVersions;
- gson = new GsonBuilder().create();
- }
-
@GET
@Path("/edgerules")
@Produces({"application/json"})
@@ -66,7 +63,7 @@ public class EdgeResource extends RESTAPI {
try {
- if (StringUtils.isEmpty(version)) {
+ if (ObjectUtils.isEmpty(version)) {
throw new AAIException("AAI_3050");
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java
index 0b2cc75..af8d6f0 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/edges/EdgeService.java
@@ -41,7 +41,6 @@ import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
import org.onap.aai.schemaservice.nodeschema.SchemaVersions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -49,28 +48,26 @@ import org.springframework.stereotype.Service;
public class EdgeService {
private static final Logger LOGGER = LoggerFactory.getLogger(EdgeService.class);
-
private static final String FILESEP = System.getProperty("file.separator");
- private SchemaVersions schemaVersions;
- private String edgesLocation;
-
- private Map<String, EdgeRules> rulesMap;
+ private final SchemaVersions schemaVersions;
+ private final String edgesLocation;
+ private final Map<String, EdgeRules> rulesMap;
+ private final Gson gson;
- @Autowired
public EdgeService(SchemaVersions schemaVersions,
@Value("${schema.edges.location}") String edgesLocation) {
this.schemaVersions = schemaVersions;
this.edgesLocation = edgesLocation;
this.rulesMap = new HashMap<>();
+ this.gson = new GsonBuilder()
+ .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
+ .create();
}
@PostConstruct
public void initialize() throws IOException {
- Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
- .create();
-
for (SchemaVersion schemaVersion : schemaVersions.getVersions()) {
String edgeRuleVersionPath = edgesLocation + FILESEP + schemaVersion.toString();
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/healthcheck/EchoResource.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/healthcheck/EchoResource.java
index b0c8007..97aa2e2 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/healthcheck/EchoResource.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/healthcheck/EchoResource.java
@@ -33,11 +33,13 @@ import javax.ws.rs.core.Response.Status;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.restcore.RESTAPI;
+import org.springframework.web.bind.annotation.RestController;
/**
* The Class EchoResponse.
*/
@Path("/util")
+@RestController
public class EchoResource extends RESTAPI {
/**
@@ -87,7 +89,7 @@ public class EchoResource extends RESTAPI {
response = Response
.status(Status.OK).entity(ErrorLogHelper
- .getRESTAPIInfoResponse(headers.getAcceptableMediaTypes(), exceptionList))
+ .getRESTAPIInfoResponse(new ArrayList<>(headers.getAcceptableMediaTypes()), exceptionList))
.build();
} catch (Exception e) {
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/RequestTransactionLogging.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/RequestTransactionLogging.java
index cfbd364..0820a68 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/RequestTransactionLogging.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/interceptors/pre/RequestTransactionLogging.java
@@ -39,7 +39,7 @@ import org.glassfish.jersey.message.internal.ReaderWriter;
import org.glassfish.jersey.server.ContainerException;
import org.onap.aai.schemaservice.interceptors.AAIContainerFilter;
import org.onap.aai.schemaservice.interceptors.AAIHeaderProperties;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@@ -82,7 +82,7 @@ public class RequestTransactionLogging extends AAIContainerFilter
requestContext.getHeaders().putSingle(CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
}
- if (StringUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)) {
+ if (ObjectUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)) {
requestContext.getHeaders().putSingle(ACCEPT, DEFAULT_RESPONSE_TYPE);
}
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java
index ad39e49..6245479 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeIngestor.java
@@ -24,8 +24,6 @@ import com.google.common.base.CaseFormat;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
-import jakarta.xml.bind.JAXBException;
-
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -46,6 +44,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -56,7 +55,6 @@ import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
import org.onap.aai.schemaservice.config.ConfigTranslator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -78,7 +76,6 @@ public class NodeIngestor {
private Map<SchemaVersion, Document> schemaPerVersion = new TreeMap<>();
private ConfigTranslator translator;
- @Autowired
/**
* Instantiates the NodeIngestor bean.
*
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaResource.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaResource.java
index 9c1f894..bab6711 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaResource.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaResource.java
@@ -35,17 +35,17 @@ import org.onap.aai.exceptions.AAIException;
import org.onap.aai.restcore.HttpMethod;
import org.onap.aai.restcore.RESTAPI;
import org.onap.aai.schemaservice.nodeschema.validation.AAISchemaValidationException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.RestController;
@Path("/v1")
+@RestController
public class NodeSchemaResource extends RESTAPI {
private final NodeSchemaService nodeSchemaService;
private final SchemaVersions schemaVersions;
- @Autowired
public NodeSchemaResource(NodeSchemaService nodeSchemaService, SchemaVersions schemaVersions) {
this.nodeSchemaService = nodeSchemaService;
this.schemaVersions = schemaVersions;
@@ -60,7 +60,7 @@ public class NodeSchemaResource extends RESTAPI {
Optional<String> optionalSchema = nodeSchemaService.fetch(version);
try {
- if (StringUtils.isEmpty(version)) {
+ if (ObjectUtils.isEmpty(version)) {
throw new AAIException("AAI_3050");
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java
index 26214aa..1098989 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/NodeSchemaService.java
@@ -37,21 +37,17 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+
@Service
+@RequiredArgsConstructor
public class NodeSchemaService {
private static final Logger LOGGER = LoggerFactory.getLogger(NodeSchemaResource.class);
- private SchemaVersions schemaVersions;
-
- private NodeIngestor nodeIngestor;
-
- private Map<String, String> versionMap = new HashMap<>();
-
- public NodeSchemaService(NodeIngestor nodeIngestor, SchemaVersions schemaVersions) {
- this.nodeIngestor = nodeIngestor;
- this.schemaVersions = schemaVersions;
- }
+ private final SchemaVersions schemaVersions;
+ private final NodeIngestor nodeIngestor;
+ private final Map<String, String> versionMap = new HashMap<>();
@PostConstruct
public void initialize() {
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/CheckEverythingStrategy.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/CheckEverythingStrategy.java
index 40768b6..58079df 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/CheckEverythingStrategy.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/CheckEverythingStrategy.java
@@ -23,7 +23,7 @@ package org.onap.aai.schemaservice.nodeschema.validation;
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
/**
* When an error is found, mark that it is NOT ok to
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/DefaultVersionValidationModule.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/DefaultVersionValidationModule.java
index aacd66f..bcd69e5 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/DefaultVersionValidationModule.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/DefaultVersionValidationModule.java
@@ -25,7 +25,6 @@ import java.util.Map;
import org.onap.aai.schemaservice.config.ConfigTranslator;
import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -37,7 +36,6 @@ import org.springframework.stereotype.Component;
public class DefaultVersionValidationModule implements VersionValidationModule {
private ConfigTranslator config;
- @Autowired
public DefaultVersionValidationModule(ConfigTranslator config) {
this.config = config;
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/NodeValidator.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/NodeValidator.java
index faeadc5..daec4cc 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/NodeValidator.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/NodeValidator.java
@@ -25,7 +25,6 @@ import java.util.Map.Entry;
import org.onap.aai.schemaservice.config.ConfigTranslator;
import org.onap.aai.schemaservice.nodeschema.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@@ -34,7 +33,6 @@ public class NodeValidator {
private SchemaErrorStrategy strat;
private DuplicateNodeDefinitionValidationModule dupChecker;
- @Autowired
public NodeValidator(ConfigTranslator translator, SchemaErrorStrategy strategy,
DuplicateNodeDefinitionValidationModule dupChecker) {
this.translator = translator;
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/VersionValidator.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/VersionValidator.java
index 135bdcc..ccb44bb 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/VersionValidator.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/nodeschema/validation/VersionValidator.java
@@ -20,7 +20,6 @@
package org.onap.aai.schemaservice.nodeschema.validation;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -32,7 +31,6 @@ public class VersionValidator {
private SchemaErrorStrategy strat;
private VersionValidationModule verMod;
- @Autowired
public VersionValidator(SchemaErrorStrategy strategy, VersionValidationModule verMod) {
this.strat = strategy;
this.verMod = verMod;
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryResource.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryResource.java
index 69c9998..2f13b5b 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryResource.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/query/QueryResource.java
@@ -24,17 +24,16 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+import lombok.RequiredArgsConstructor;
@Path("/v1")
+@RestController
+@RequiredArgsConstructor
public class QueryResource {
- private QueryService queryService;
-
- @Autowired
- public QueryResource(QueryService queryService) {
- this.queryService = queryService;
- }
+ private final QueryService queryService;
@GET
@Path("/stored-queries")
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/versions/VersionResource.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/versions/VersionResource.java
index 4093769..80ba0db 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/versions/VersionResource.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/versions/VersionResource.java
@@ -22,29 +22,28 @@ package org.onap.aai.schemaservice.versions;
import com.google.gson.Gson;
+import lombok.RequiredArgsConstructor;
+
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
@Path("/v1")
+@RestController
+@RequiredArgsConstructor
public class VersionResource {
- private VersionService versionService;
-
- @Autowired
- public VersionResource(VersionService versionService) {
- this.versionService = versionService;
- }
+ private final VersionService versionService;
+ private final Gson gson;
@GET
@Path("/versions")
@Produces({MediaType.APPLICATION_JSON})
public Response getVersions() {
- Gson gson = new Gson();
return Response.ok(gson.toJson(versionService.getVersionInfo())).build();
}
}
diff --git a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java
index ad7e546..299c813 100644
--- a/aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java
+++ b/aai-schema-service/src/main/java/org/onap/aai/schemaservice/web/JerseyConfiguration.java
@@ -37,9 +37,9 @@ import org.onap.aai.schemaservice.query.QueryResource;
import org.onap.aai.schemaservice.versions.VersionResource;
import org.onap.logging.filter.base.AuditLogContainerFilter;
import org.reflections.Reflections;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
+import org.springframework.core.env.Profiles;
import org.springframework.stereotype.Component;
@Component
@@ -49,7 +49,6 @@ public class JerseyConfiguration extends ResourceConfig {
private Environment env;
- @Autowired
public JerseyConfiguration(Environment env) {
this.env = env;
@@ -87,7 +86,7 @@ public class JerseyConfiguration extends ResourceConfig {
// Turn the set back into a list
List<Class<? extends T>> filtersList = filters.stream().filter(f -> {
if (f.isAnnotationPresent(Profile.class)
- && !env.acceptsProfiles(f.getAnnotation(Profile.class).value())) {
+ && !env.acceptsProfiles(Profiles.of(f.getAnnotation(Profile.class).value()))) {
return false;
}
return true;