Fix sonar violations
[aai/gizmo.git] / src / main / java / org / onap / crud / dao / champ / ChampDao.java
index 65d1d99..fd5de57 100644 (file)
@@ -27,14 +27,13 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.http.NameValuePair;
 import org.apache.http.client.utils.URLEncodedUtils;
 import org.apache.http.message.BasicNameValuePair;
 import org.eclipse.jetty.util.security.Password;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.eelf.LoggerFactory;
 import org.onap.aai.cl.mdc.MdcContext;
 import org.onap.aai.logging.LoggingContext;
 import org.onap.aai.restclient.client.OperationResult;
@@ -64,8 +63,6 @@ public class ChampDao implements GraphDao {
   protected static final String RELATIONSHIP_SUB_URL = "relationships";
   protected static final String TRANSACTION_SUB_URL = "transaction";
 
-  private Logger logger = LoggerFactory.getInstance().getLogger(ChampDao.class.getName());
-
   // We use a custom vertex serializer for champ because it expects "key"
   // instead of "id"
   protected static final Gson champGson = new GsonBuilder()
@@ -172,8 +169,8 @@ public class ChampDao implements GraphDao {
   }
 
   @Override
-  public OperationResult getVertices(String type, Map<String, Object> filter, HashSet<String> properties, String version) throws CrudException {
-    filter.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+  public OperationResult getVertices(String type, Map<String, Object> filter, Set<String> properties, String version) throws CrudException {
+    filter.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     List<NameValuePair> queryParams = convertToNameValuePair(filter);
     queryParams.addAll(convertToNameValuePair("properties", properties));
@@ -209,7 +206,7 @@ public class ChampDao implements GraphDao {
       if (!edge.getType().equalsIgnoreCase(type)) {
         // We didn't find an edge with the supplied type, so just throw an
         // exception.
-        throw new CrudException("No edge with id " + id + "and type " + type + " found in graph",
+        throw new CrudException("No edge with id " + id + " and type " + type + " found in graph",
             javax.ws.rs.core.Response.Status.NOT_FOUND);
       }
       return getResult;
@@ -242,7 +239,7 @@ public class ChampDao implements GraphDao {
 
     // Add the aai_node_type so that AAI can read the data created by gizmo
     // TODO: This probably shouldn't be here
-    properties.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+    properties.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
     properties.forEach(insertVertexBuilder::property);
@@ -266,7 +263,7 @@ public class ChampDao implements GraphDao {
 
     // Add the aai_node_type so that AAI can read the data created by gizmo
     // TODO: This probably shouldn't be here
-    properties.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+    properties.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
     insertVertexBuilder.id(id);
@@ -414,7 +411,7 @@ public class ChampDao implements GraphDao {
 
     // Add the aai_node_type so that AAI can read the data created by gizmo
     // TODO: This probably shouldn't be here
-    properties.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+    properties.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
     properties.forEach(insertVertexBuilder::property);
@@ -463,7 +460,7 @@ public class ChampDao implements GraphDao {
 
     // Add the aai_node_type so that AAI can read the data created by gizmo
     // TODO: This probably shouldn't be here
-    properties.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+    properties.put(org.onap.schema.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
     insertVertexBuilder.id(id);
@@ -537,7 +534,7 @@ public class ChampDao implements GraphDao {
       if (!edge.getType().equalsIgnoreCase(type)) {
         // We didn't find an edge with the supplied type, so just throw an
         // exception.
-        throw new CrudException("No edge with id " + id + "and type " + type + " found in graph",
+        throw new CrudException("No edge with id " + id + " and type " + type + " found in graph",
             javax.ws.rs.core.Response.Status.NOT_FOUND);
       }
       return edge;
@@ -558,7 +555,7 @@ public class ChampDao implements GraphDao {
       if (!vert.getType().equalsIgnoreCase(type)) {
         // We didn't find a vertex with the supplied type, so just throw an
         // exception.
-        throw new CrudException("No vertex with id " + id + "and type " + type + " found in graph",
+        throw new CrudException("No vertex with id " + id + " and type " + type + " found in graph",
             javax.ws.rs.core.Response.Status.NOT_FOUND);
       }
       return vert;
@@ -579,7 +576,7 @@ public class ChampDao implements GraphDao {
   }
 
   // https://stackoverflow.com/questions/26942330/convert-mapstring-string-to-listnamevaluepair-is-this-the-most-efficient
-  private List<NameValuePair> convertToNameValuePair(String k, HashSet<String> values) {
+  private List<NameValuePair> convertToNameValuePair(String k, Set<String> values) {
     List<NameValuePair> nvpList = new ArrayList<>(values.size());
 
     values.forEach((v) -> nvpList.add(new BasicNameValuePair(k, v)));