From 2c9ee21f2cf8fc230decfc48e3f652fe11862216 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Wed, 9 Nov 2022 12:41:32 +0000 Subject: Reduce the number of raw-type related warnings in aai-common Issue-ID: AAI-3586 Signed-off-by: Fiete Ostkamp Change-Id: If4affb02cfe40b4b82ecbdbb1a25d919d88be25c --- .../org/onap/aai/dmaap/AAIDmaapEventJMSConsumer.java | 2 +- .../java/org/onap/aai/introspection/JSONStrategy.java | 2 +- .../java/org/onap/aai/introspection/MoxyStrategy.java | 19 +++++++++++++------ .../aai/introspection/sideeffect/PrivateEdge.java | 8 ++++++-- .../org/onap/aai/prevalidation/ValidationService.java | 4 ++-- .../onap/aai/query/builder/GraphTraversalBuilder.java | 9 +++++++-- .../src/main/java/org/onap/aai/restcore/RESTAPI.java | 2 +- .../org/onap/aai/serialization/db/DBSerializer.java | 10 +++++----- .../aai/serialization/queryformats/Aggregate.java | 16 +++++++++++++--- .../onap/aai/serialization/queryformats/GraphSON.java | 2 +- .../aai/serialization/queryformats/HistoryFormat.java | 10 +++++++--- .../aai/serialization/queryformats/SimpleFormat.java | 2 +- .../aai/serialization/queryformats/TreeFormat.java | 11 +++++++---- .../main/java/org/onap/aai/util/RestController.java | 2 +- 14 files changed, 66 insertions(+), 33 deletions(-) (limited to 'aai-core/src/main') diff --git a/aai-core/src/main/java/org/onap/aai/dmaap/AAIDmaapEventJMSConsumer.java b/aai-core/src/main/java/org/onap/aai/dmaap/AAIDmaapEventJMSConsumer.java index 2858ece3..d3addebb 100644 --- a/aai-core/src/main/java/org/onap/aai/dmaap/AAIDmaapEventJMSConsumer.java +++ b/aai-core/src/main/java/org/onap/aai/dmaap/AAIDmaapEventJMSConsumer.java @@ -119,7 +119,7 @@ public class AAIDmaapEventJMSConsumer implements MessageListener { } metricLog.pre(eventName, aaiEvent, transactionId, serviceName); - HttpEntity httpEntity = new HttpEntity(aaiEvent, httpHeaders); + HttpEntity httpEntity = new HttpEntity(aaiEvent, httpHeaders); String transportType = environment.getProperty("dmaap.ribbon.transportType", "http"); String baseUrl = transportType + "://" + environment.getProperty("dmaap.ribbon.listOfServers"); diff --git a/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java b/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java index 40352360..02288c35 100644 --- a/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java +++ b/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java @@ -150,7 +150,7 @@ public class JSONStrategy extends Introspector { Class resultClass = null; Object resultObject = this.getValue(name); if (resultObject instanceof JSONArray) { - resultClass = ((List) resultObject).get(0).getClass(); + resultClass = ((List) resultObject).get(0).getClass(); } return resultClass; diff --git a/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java b/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java index df8e9238..55980c3b 100644 --- a/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java +++ b/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java @@ -25,8 +25,15 @@ import com.google.common.base.Joiner; import java.io.StringWriter; import java.io.UnsupportedEncodingException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; @@ -170,12 +177,12 @@ public class MoxyStrategy extends Introspector { DatabaseMapping mapping = cd.getMappingForAttributeName(propName); Map result = new HashMap<>(); if (mapping != null) { - Set entrySet = mapping.getProperties().entrySet(); - for (Entry entry : entrySet) { + Set> entrySet = mapping.getProperties().entrySet(); + for (Entry entry : entrySet) { result.put( - PropertyMetadata.valueOf( - CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, (String) entry.getKey())), - (String) entry.getValue()); + PropertyMetadata + .valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, entry.getKey())), + entry.getValue()); } } diff --git a/aai-core/src/main/java/org/onap/aai/introspection/sideeffect/PrivateEdge.java b/aai-core/src/main/java/org/onap/aai/introspection/sideeffect/PrivateEdge.java index 9e32ef40..e58ff9bc 100644 --- a/aai-core/src/main/java/org/onap/aai/introspection/sideeffect/PrivateEdge.java +++ b/aai-core/src/main/java/org/onap/aai/introspection/sideeffect/PrivateEdge.java @@ -25,8 +25,12 @@ import com.google.common.collect.Multimap; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; import javax.ws.rs.core.MultivaluedMap; @@ -92,7 +96,7 @@ public class PrivateEdge extends SideEffect { List results = uriQuery.getQueryBuilder().toList(); if (results.size() == 1) { Vertex otherVertex = results.get(0); - VertexProperty otherVProperty = otherVertex.property("aai-node-type"); + VertexProperty otherVProperty = otherVertex.property("aai-node-type"); if (otherVProperty.isPresent()) { diff --git a/aai-core/src/main/java/org/onap/aai/prevalidation/ValidationService.java b/aai-core/src/main/java/org/onap/aai/prevalidation/ValidationService.java index c66511f0..70e16e27 100644 --- a/aai-core/src/main/java/org/onap/aai/prevalidation/ValidationService.java +++ b/aai-core/src/main/java/org/onap/aai/prevalidation/ValidationService.java @@ -222,7 +222,7 @@ public class ValidationService { httpHeaders.put("Content-Type", "application/json"); List violations = new ArrayList<>(); - ResponseEntity responseEntity; + ResponseEntity responseEntity; try { responseEntity = validationRestClient.execute(VALIDATION_ENDPOINT, HttpMethod.POST, httpHeaders, body); @@ -267,7 +267,7 @@ public class ValidationService { return violations; } - boolean isSuccess(ResponseEntity responseEntity) { + boolean isSuccess(ResponseEntity responseEntity) { return responseEntity != null && responseEntity.getStatusCode().is2xxSuccessful(); } diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java b/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java index 2517e2c0..312be4f9 100644 --- a/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java +++ b/aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java @@ -23,7 +23,12 @@ package org.onap.aai.query.builder; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.Path; @@ -904,7 +909,7 @@ public abstract class GraphTraversalBuilder extends QueryBuilder { protected void executeQuery() { - Admin admin; + Admin admin; if (start != null) { this.completeTraversal = traversal.asAdmin(); } else { diff --git a/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java b/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java index 3666eb67..31805fd4 100644 --- a/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java +++ b/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java @@ -341,7 +341,7 @@ public class RESTAPI { * @return the response */ public Response runner(String toe, String tba, String tdl, HttpHeaders headers, UriInfo info, HttpMethod httpMethod, - Callable c) { + Callable c) { Response response = null; Future handler = null; ExecutorService executor = null; diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java index dc478337..3be88df6 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java @@ -723,7 +723,7 @@ public class DBSerializer { throws IllegalArgumentException, SecurityException, UnsupportedEncodingException, AAIException { HashMap relatedVertices = new HashMap<>(); - VertexProperty aaiUriProperty = v.property(AAIProperties.AAI_URI); + VertexProperty aaiUriProperty = v.property(AAIProperties.AAI_URI); if (!aaiUriProperty.isPresent()) { if (LOGGER.isDebugEnabled()) { @@ -1232,7 +1232,7 @@ public class DBSerializer { throw new AAIException("AAI_6136", "query object mismatch: this object cannot hold multiple items." + obj.getDbName()); } else if (obj.isContainer()) { - final List getList; + final List getList; String listProperty = null; for (String property : obj.getProperties()) { if (obj.isListType(property) && obj.isComplexGenericType(property)) { @@ -1565,7 +1565,7 @@ public class DBSerializer { throws UnsupportedEncodingException, AAIException { List relationshipObjList = obj.getValue(RELATIONSHIP); - VertexProperty nodeTypeProperty = v.property(AAIProperties.NODE_TYPE); + VertexProperty nodeTypeProperty = v.property(AAIProperties.NODE_TYPE); if (!nodeTypeProperty.isPresent()) { LOGGER.warn("Not processing the vertex {} because its missing required property aai-node-type", v.id()); @@ -1651,7 +1651,7 @@ public class DBSerializer { private Object processEdgeRelationship(Introspector relationshipObj, Vertex cousin, String cleanUp, String edgeLabel, boolean isSkipRelatedTo) throws UnsupportedEncodingException, AAIUnknownObjectException { - VertexProperty aaiUriProperty = cousin.property("aai-uri"); + VertexProperty aaiUriProperty = cousin.property("aai-uri"); if (!aaiUriProperty.isPresent()) { return null; @@ -1670,7 +1670,7 @@ public class DBSerializer { return null; } - VertexProperty cousinVertexNodeType = cousin.property(AAIProperties.NODE_TYPE); + VertexProperty cousinVertexNodeType = cousin.property(AAIProperties.NODE_TYPE); if (cousinVertexNodeType.isPresent()) { String cousinType = cousinVertexNodeType.value().toString(); diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java index 28362826..457c0b8b 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java @@ -20,10 +20,19 @@ package org.onap.aai.serialization.queryformats; -import com.google.gson.*; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import java.io.UnsupportedEncodingException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -194,7 +203,8 @@ public class Aggregate extends MultiFormatMapper { return Optional.of(json); } - private Optional processInput(Object input, Map properties) throws AAIFormatVertexException { + private Optional processInput(Object input, Map> properties) + throws AAIFormatVertexException { JsonArray json = new JsonArray(); for (Object l : (ArrayList) input) { if (l instanceof ArrayList) { diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java index fc3316d4..e73b9902 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java @@ -105,7 +105,7 @@ public class GraphSON implements FormatMapper { */ private void removePrivateEdges(JsonObject jsonObject, JsonObject edges, String edgeDirection) { - Iterator it = edges.entrySet().iterator(); + Iterator> it = edges.entrySet().iterator(); while (it.hasNext()) { Map.Entry outEntry = (Map.Entry) it.next(); JsonArray edgePropertiesArray = outEntry.getValue().getAsJsonArray(); diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/HistoryFormat.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/HistoryFormat.java index fccc17c6..5d583c56 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/HistoryFormat.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/HistoryFormat.java @@ -31,7 +31,11 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.apache.tinkerpop.gremlin.structure.*; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Property; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.onap.aai.db.props.AAIProperties; import org.onap.aai.introspection.Loader; import org.onap.aai.serialization.db.DBSerializer; @@ -90,10 +94,10 @@ public abstract class HistoryFormat extends MultiFormatMapper { protected JsonObject createMetaPropertiesObject(VertexProperty prop) { JsonObject json = new JsonObject(); - Iterator iter = prop.properties(); + Iterator> iter = prop.properties(); while (iter.hasNext()) { - Property metaProp = (Property) iter.next(); + Property metaProp = iter.next(); mapPropertyValues(json, metaProp.key(), metaProp.value()); } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/SimpleFormat.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/SimpleFormat.java index f1d1c26e..ea4cd1c4 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/SimpleFormat.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/SimpleFormat.java @@ -77,7 +77,7 @@ public class SimpleFormat extends RawFormat { @Override protected void addEdge(Edge e, Vertex v, JsonArray array) throws AAIFormatVertexException { - Property property = e.property("private"); + Property property = e.property("private"); if (property.isPresent()) { if ("true".equals(e.property("private").value().toString())) { diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/TreeFormat.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/TreeFormat.java index 2e1cbf6e..d8167308 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/TreeFormat.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/TreeFormat.java @@ -28,8 +28,11 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import java.io.UnsupportedEncodingException; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet; import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; @@ -181,9 +184,9 @@ public class TreeFormat extends MultiFormatMapper { // DSL Query if (o instanceof BulkSet) { - BulkSet bs = (BulkSet) o; - for (Object o1 : bs) { - Optional obj = this.getJsonFromVertex((Vertex) o1); + BulkSet bs = (BulkSet) o; + for (Vertex o1 : bs) { + Optional obj = this.getJsonFromVertex(o1); if (obj.isPresent()) { jsonObject = obj.get(); for (Map.Entry mapEntry : jsonObject.entrySet()) { diff --git a/aai-core/src/main/java/org/onap/aai/util/RestController.java b/aai-core/src/main/java/org/onap/aai/util/RestController.java index 6c57040d..18a85e4d 100644 --- a/aai-core/src/main/java/org/onap/aai/util/RestController.java +++ b/aai-core/src/main/java/org/onap/aai/util/RestController.java @@ -256,7 +256,7 @@ public class RestController implements RestControllerInterface { * @return the list * @throws Exception the exception */ - private List mapJsonToObjectList(T typeDef, String json, Class clazz) throws Exception { + private List mapJsonToObjectList(T typeDef, String json, Class clazz) throws Exception { List list; ObjectMapper mapper = new ObjectMapper(); System.out.println(json); -- cgit 1.2.3-korg