Remove Multiplicity feature
[aai/gizmo.git] / src / main / java / org / onap / crud / dao / champ / ChampDao.java
index 81980cc..554b9fa 100644 (file)
@@ -35,7 +35,6 @@ 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.mdc.MdcContext;
-import org.onap.aai.logging.LoggingContext;
 import org.onap.aai.restclient.client.OperationResult;
 import org.onap.aai.restclient.client.RestClient;
 import org.onap.aai.restclient.enums.RestAuthenticationMode;
@@ -75,9 +74,10 @@ public class ChampDao implements GraphDao {
 
   public ChampDao(String champUrl, String certPassword) {
     try {
+      String deobfuscatedCertPassword = certPassword.startsWith("OBF:")?Password.deobfuscate(certPassword):certPassword;
       client = new RestClient().authenticationMode(RestAuthenticationMode.SSL_CERT).validateServerHostname(false)
           .validateServerCertChain(false).clientCertFile(CrudServiceConstants.CRD_CHAMP_AUTH_FILE)
-          .clientCertPassword(Password.deobfuscate(certPassword));
+          .clientCertPassword(deobfuscatedCertPassword);
 
       baseObjectUrl = champUrl + OBJECT_SUB_URL;
       baseRelationshipUrl = champUrl + RELATIONSHIP_SUB_URL;
@@ -183,7 +183,7 @@ public class ChampDao implements GraphDao {
 
   @Override
   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);
+    filter.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     List<NameValuePair> queryParams = convertToNameValuePair(filter);
     queryParams.addAll(convertToNameValuePair("properties", properties));
@@ -252,7 +252,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.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+    properties.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
     properties.forEach(insertVertexBuilder::property);
@@ -276,7 +276,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.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+    properties.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
     insertVertexBuilder.id(id);
@@ -411,7 +411,7 @@ public class ChampDao implements GraphDao {
     String url = baseTransactionUrl + "/" + id;
     Map<String, List<String>> headers = new HashMap<>();
     headers.put(HEADER_FROM_APP, Arrays.asList("Gizmo"));
-    headers.put(HEADER_TRANS_ID, Arrays.asList(MDC.get(LoggingContext.LoggingField.REQUEST_ID.toString())));
+    headers.put(HEADER_TRANS_ID, Arrays.asList(MDC.get(MdcContext.MDC_REQUEST_ID)));
 
     OperationResult getResult = client.get(url, headers, MediaType.APPLICATION_JSON_TYPE);
 
@@ -424,7 +424,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.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+    properties.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
     properties.forEach(insertVertexBuilder::property);
@@ -473,7 +473,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.validation.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
+    properties.put(org.onap.schema.OxmModelValidator.Metadata.NODE_TYPE.propertyName(), type);
 
     Vertex.Builder insertVertexBuilder = new Vertex.Builder(type);
     insertVertexBuilder.id(id);
@@ -550,7 +550,7 @@ public class ChampDao implements GraphDao {
       throw createErrorException(getResult, javax.ws.rs.core.Response.Status.NOT_FOUND, "No edge with id " + id + " found in graph");
     }
   }
-  
+
   @Override
   public Edge getEdge(String id) throws CrudException {
     String url = baseRelationshipUrl + "/" + id;