adding orchestration type to service models view
[vid.git] / vid-app-common / src / main / java / org / onap / vid / services / AaiServiceImpl.java
index fcdae44..9848121 100644 (file)
@@ -25,7 +25,6 @@ import static org.onap.vid.aai.AaiClient.QUERY_FORMAT_RESOURCE;
 import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import io.joshworks.restclient.http.HttpResponse;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.ArrayList;
@@ -43,7 +42,6 @@ import org.apache.http.HttpStatus;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.vid.aai.AaiClientInterface;
 import org.onap.vid.aai.AaiGetVnfResponse;
-import org.onap.vid.aai.AaiOverTLSClientInterface;
 import org.onap.vid.aai.AaiResponse;
 import org.onap.vid.aai.AaiResponseTranslator;
 import org.onap.vid.aai.ExceptionWithRequestInfo;
@@ -104,7 +102,6 @@ public class AaiServiceImpl implements AaiService {
     private int indexOfSubscriberName = 6;
 
     private AaiClientInterface aaiClient;
-    private AaiOverTLSClientInterface aaiOverTLSClient;
     private AaiResponseTranslator aaiResponseTranslator;
     private AAIServiceTree aaiServiceTree;
     private ExecutorService executorService;
@@ -115,13 +112,11 @@ public class AaiServiceImpl implements AaiService {
     @Autowired
     public AaiServiceImpl(
         AaiClientInterface aaiClient,
-        AaiOverTLSClientInterface aaiOverTLSClient,
         AaiResponseTranslator aaiResponseTranslator,
         AAIServiceTree aaiServiceTree,
         ExecutorService executorService)
     {
         this.aaiClient = aaiClient;
-        this.aaiOverTLSClient = aaiOverTLSClient;
         this.aaiResponseTranslator = aaiResponseTranslator;
         this.aaiServiceTree = aaiServiceTree;
         this.executorService = executorService;
@@ -142,7 +137,9 @@ public class AaiServiceImpl implements AaiService {
                         .setToscaModelURL(null)
                         .setLifecycleState(null)
                         .setArtifacts(null)
-                        .setResources(null).build();
+                        .setResources(null)
+                        .setOrchestrationType(modelVer.getOrchestrationType())
+                        .build();
 
 
 
@@ -241,13 +238,11 @@ public class AaiServiceImpl implements AaiService {
 
     @Override
     public SubscriberFilteredResults getFullSubscriberList(RoleValidator roleValidator) {
-        HttpResponse<SubscriberList> allSubscribers = aaiOverTLSClient.getAllSubscribers();
-        return new SubscriberFilteredResults(
-            roleValidator,
-            allSubscribers.getBody(),
-            allSubscribers.getStatusText(),
-            allSubscribers.getStatus()
-        );
+        AaiResponse<SubscriberList> subscriberResponse = aaiClient.getAllSubscribers();
+
+        return new SubscriberFilteredResults(roleValidator, subscriberResponse.getT(),
+                subscriberResponse.getErrorMessage(),
+                subscriberResponse.getHttpCode());
     }
 
     @Override
@@ -256,8 +251,8 @@ public class AaiServiceImpl implements AaiService {
     }
 
     @Override
-    public HttpResponse<SubscriberList> getFullSubscriberList() {
-        return aaiOverTLSClient.getAllSubscribers();
+    public AaiResponse<SubscriberList> getFullSubscriberList() {
+        return aaiClient.getAllSubscribers();
     }
 
     @Override
@@ -709,4 +704,9 @@ public class AaiServiceImpl implements AaiService {
         return "{\"start\":\"/cloud-infrastructure/cloud-regions/cloud-region/" + cloudOwner + "/" + cloudRegionId + "\"," +
                 "\"query\":\"query/l3-networks-by-cloud-region?tenantId=" + tenantId + networkRolePart + "\"}";
     }
+
+    @Override
+    public ModelVer getNewestModelVersionByInvariantId(String modelInvariantId){
+        return aaiClient.getLatestVersionByInvariantId(modelInvariantId);
+    }
 }