Merge "Add Docker info" into casablanca
authorChuanyu Chen <chenchuanyu@huawei.com>
Thu, 29 Nov 2018 07:02:39 +0000 (07:02 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 29 Nov 2018 07:02:39 +0000 (07:02 +0000)
bpmn/MSOCommonBPMN/pom.xml
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
common/src/main/java/org/onap/so/client/HttpClient.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts

index 926e09c..42e9cb6 100644 (file)
                <dependency>
                        <groupId>org.onap.sdc.sdc-tosca</groupId>
                        <artifactId>sdc-tosca</artifactId>
-                       <version>1.4.1</version>                        
+                       <version>1.4.4</version>
                </dependency>
                <dependency>
                        <groupId>org.onap.sdc.jtosca</groupId>
                        <artifactId>jtosca</artifactId>
-                       <version>1.4.1</version>
+                       <version>1.4.4</version>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
index 44ee918..34f2f01 100644 (file)
@@ -28,13 +28,17 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.HttpClient
+//import org.onap.so.client.HttpClient
+//import org.onap.so.client.RestRequest
 import org.onap.so.logger.MessageEnum
 import org.onap.so.logger.MsoLogger
+import org.onap.so.rest.APIResponse
+import org.onap.so.rest.RESTClient
+import org.onap.so.rest.RESTConfig
 import org.onap.so.bpmn.core.UrnPropertiesReader
 
 import groovy.json.*
-import javax.ws.rs.core.Response
+//import javax.ws.rs.core.Response
 import org.onap.so.utils.TargetEntity
 
 /**
@@ -144,7 +148,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
      */
     public void createNetworkService(DelegateExecution execution) {
         msoLogger.trace("createNetworkService ")
-        String vfcAdapterUrl = execution.setVariable("vfcAdapterUrl")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String nsOperationKey = execution.getVariable("nsOperationKey");
         String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID");
         String nsParameters = execution.getVariable("nsParameters");
@@ -162,9 +166,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
                      "additionalParamForNs":${requestInputs}
                 }
                }"""
-        Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
-        String returnCode = apiResponse.getStatus()
-        String aaiResponseAsString = apiResponse.readEntity(String.class)
+        APIResponse apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
+        String returnCode = apiResponse.getStatusCode()
+        String aaiResponseAsString = apiResponse.getResponseBodyAsString()
         String nsInstanceId = "";
         if(returnCode== "200" || returnCode == "201"){
             nsInstanceId =  jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId")
@@ -178,7 +182,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
      */
     public void instantiateNetworkService(DelegateExecution execution) {
         msoLogger.trace("instantiateNetworkService ")
-        String vfcAdapterUrl = execution.setVariable("vfcAdapterUrl")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String nsOperationKey = execution.getVariable("nsOperationKey");
         String nsParameters = execution.getVariable("nsParameters");
         String nsServiceName = execution.getVariable("nsServiceName")
@@ -191,9 +195,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
        }"""
         String nsInstanceId = execution.getVariable("nsInstanceId")
         String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate"
-        Response apiResponse = postRequest(execution, url, reqBody)
-        String returnCode = apiResponse.getStatus()
-        String aaiResponseAsString = apiResponse.readEntity(String.class)
+        APIResponse apiResponse = postRequest(execution, url, reqBody)
+        String returnCode = apiResponse.getStatusCode()
+        String aaiResponseAsString = apiResponse.getResponseBodyAsString()
         String jobId = "";
         if(returnCode== "200"|| returnCode == "201"){
             jobId =  jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
@@ -207,13 +211,13 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
      */
     public void queryNSProgress(DelegateExecution execution) {
         msoLogger.trace("queryNSProgress ")
-        String vfcAdapterUrl = execution.setVariable("vfcAdapterUrl")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String jobId = execution.getVariable("jobId")
         String nsOperationKey = execution.getVariable("nsOperationKey");
         String url = vfcAdapterUrl + "/jobs/" + jobId
-        Response apiResponse = postRequest(execution, url, nsOperationKey)
-        String returnCode = apiResponse.getStatus()
-        String aaiResponseAsString = apiResponse.readEntity(String.class)
+        APIResponse apiResponse = postRequest(execution, url, nsOperationKey)
+        String returnCode = apiResponse.getStatusCode()
+        String aaiResponseAsString = apiResponse.getResponseBodyAsString()
         String operationStatus = "error"
         if(returnCode== "200"|| returnCode == "201"){
             operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status")
@@ -229,7 +233,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
         try {
             Thread.sleep(5000);
         } catch(InterruptedException e) {
-            msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e , "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+            msoLogger.error( "Time Delay exception" + e.getMessage());
         }
     }
 
@@ -254,7 +258,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
             getAAIClient().connect(nsUri,relatedServiceUri)
             msoLogger.info("NS relationship to Service added successfully")
         }catch(Exception e){
-            msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while Creating NS relationship.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage(),e);
+            msoLogger.error("Exception occured while Creating NS relationship."+ e.getMessage());
             throw new BpmnError("MSOWorkflowException")
         }
     }
@@ -264,26 +268,103 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
      * url: the url of the request
      * requestBody: the body of the request
      */
-    private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
+    private APIResponse postRequest(DelegateExecution execution, String urlString, String requestBody){
         msoLogger.trace("Started Execute VFC adapter Post Process ")
         msoLogger.info("url:" + urlString +"\nrequestBody:"+ requestBody)
-        Response apiResponse = null
-        try{
+        APIResponse apiResponse = null
+//        try{
 
-                       URL url = new URL(urlString);
+//                     URL url = new URL(urlString);
 
-                       HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
-                       httpClient.addAdditionalHeader("Accept", "application/json")
-                       httpClient.addAdditionalHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk")
+//                     HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
+//                     httpClient.addAdditionalHeader("Accept", "application/json")
+//                     httpClient.addAdditionalHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk")
 
-                       apiResponse = httpClient.post(requestBody)
+//                     apiResponse = httpClient.post(requestBody)
+//                     msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
 
-            msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
-            msoLogger.trace("Completed Execute VF-C adapter Post Process ")
-        }catch(Exception e){
-            msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
-            throw new BpmnError("MSOWorkflowException")
-        }
+               // Get the Basic Auth credentials for the VFCAdapter (yes... we ARE using the PO adapters credentials)
+               String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+               
+               msoLogger.debug("basicAuthValuePO: " + basicAuthValuePO)
+               if (basicAuthValuePO == null || basicAuthValuePO.isEmpty()) {
+                       msoLogger.debug("mso:adapters:po:auth URN mapping is not defined")
+               }                       
+
+               RESTConfig config = new RESTConfig(urlString)
+               RESTClient client = null;
+               int statusCode = 0;
+               try {
+                       client = new RESTClient(config).addHeader("Accept", "application/json").addAuthorizationHeader(basicAuthValuePO)
+
+                       apiResponse = client.httpPost(requestBody)
+                       
+                       statusCode = apiResponse.getStatusCode()
+                       
+                       if(statusCode == 200 || statusCode == 201) {
+                               return apiResponse
+                       }
+               }catch(Exception e){
+                       msoLogger.error("VFC Aatpter Post Call Exception using mso.adapters.po.auth:" + e.getMessage());
+               }
+               
+               msoLogger.debug("response code:"+ statusCode +"\nresponse body:"+ apiResponse.getResponseBodyAsString())
+               
+               msoLogger.debug("VFC Aatpter Post Call using mso.msoKey")
+               String basicAuthValue =  UrnPropertiesReader.getVariable("mso.msoKey", execution)
+               msoLogger.debug("basicAuthValue: " + basicAuthValue)
+               if (basicAuthValue == null || basicAuthValue.isEmpty()) {
+                       msoLogger.debug("mso:msoKey URN mapping is not defined")
+               }
+               try {
+                       client = new RESTClient(config).addHeader("Accept", "application/json").addAuthorizationHeader(basicAuthValue)
+
+                       apiResponse = client.httpPost(requestBody)
+                       
+                       statusCode = apiResponse.getStatusCode()
+                       
+                       if(statusCode == 200 || statusCode == 201) {
+                               return apiResponse
+                       }
+               }catch(Exception e){
+                       msoLogger.error("VFC Aatpter Post Call Exception using mso.msoKey:" + e.getMessage());
+                       
+               }
+                                       
+               msoLogger.debug("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString())
+               
+               msoLogger.debug("VFC Aatpter Post Call using mso.db.auth")
+               String basicAuthValuedb =  UrnPropertiesReader.getVariable("mso.db.auth", execution)
+               msoLogger.debug("basicAuthValuedb: " + basicAuthValuedb)
+               if (basicAuthValuedb == null || basicAuthValuedb.isEmpty()) {
+                       msoLogger.debug("mso:db.auth URN mapping is not defined")
+               }
+               try {
+                       client = new RESTClient(config).addHeader("Accept", "application/json").addAuthorizationHeader(basicAuthValuedb)
+
+                       apiResponse = client.httpPost(requestBody)
+                       statusCode = apiResponse.getStatusCode()
+                       
+                       if(statusCode == 200 || statusCode == 201) {
+                               return apiResponse
+                       }
+               }catch(Exception e){
+                       msoLogger.error("VFC Aatpter Post Call Exception using mso.msoKey:" + e.getMessage());
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VFC Aatpter Post Call Exception by using mso.msoKey or mso.adapters.po.auth")
+               }
+       
+                       
+               msoLogger.debug("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString())
+               String auth = "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"
+               msoLogger.debug("auth: " + basicAuthValuedb)
+               client = new RESTClient(config).addHeader("Accept", "application/json").addAuthorizationHeader(auth)
+               
+               apiResponse = client.httpPost(requestBody)
+               
+               msoLogger.debug("response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString())
+               
+               msoLogger.trace("Completed Execute VF-C adapter Post Process ")
+        
         return apiResponse
     }
 
index 09f159e..f4a542a 100644 (file)
@@ -31,6 +31,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
 import org.onap.so.logger.MessageEnum
 import org.onap.so.logger.MsoLogger
+import org.onap.so.bpmn.core.UrnPropertiesReader
 
 import org.onap.so.utils.TargetEntity
 
@@ -44,9 +45,6 @@ import javax.ws.rs.core.Response
 public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
        private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVFCNetworkServiceInstance.class);
 
-    String vfcUrl = "/vfc/rest/v1/vfcadapter"
-
-    String host = "http://mso.mso.testlab.openecomp.org:8080"
 
     ExceptionUtil exceptionUtil = new ExceptionUtil()
 
@@ -100,6 +98,19 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
            execution.setVariable("nsOperationKey", nsOperationKey);
            execution.setVariable("nsParameters", nsParameters)
 
+           String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+                  
+           if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+               msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+               msoLogger.debug(msg)
+           }
+
+           while (vfcAdapterUrl.endsWith('/')) {
+               vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+           }
+                  
+           execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
+
 
        } catch (BpmnError e) {
            throw e;
@@ -116,6 +127,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
      */
     public void createNetworkService(DelegateExecution execution) {
         msoLogger.trace("createNetworkService")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String nsOperationKey = execution.getVariable("nsOperationKey");
         String nsParameters = execution.getVariable("nsParameters");
         String nsServiceName = execution.getVariable("nsServiceName")
@@ -126,7 +138,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
                 "nsOperationKey":${nsOperationKey},
                 "nsParameters":${nsParameters}
                }"""
-        Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody)
+        Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
         String returnCode = apiResponse.getStatus()
         String aaiResponseAsString = apiResponse.readEntity(String.class)
         String nsInstanceId = "";
@@ -142,6 +154,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
      */
     public void instantiateNetworkService(DelegateExecution execution) {
         msoLogger.trace("instantiateNetworkService")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String nsOperationKey = execution.getVariable("nsOperationKey");
         String nsParameters = execution.getVariable("nsParameters");
         String nsServiceName = execution.getVariable("nsServiceName")
@@ -153,7 +166,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
         "nsParameters":${nsParameters}
        }"""
         String nsInstanceId = execution.getVariable("nsInstanceId")
-        String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate"
+        String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate"
         Response apiResponse = postRequest(execution, url, reqBody)
         String returnCode = apiResponse.getStatus()
         String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -170,9 +183,10 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
      */
     public void queryNSProgress(DelegateExecution execution) {
         msoLogger.trace("queryNSProgress")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String jobId = execution.getVariable("jobId")
         String nsOperationKey = execution.getVariable("nsOperationKey");
-        String url = host + vfcUrl + "/jobs/" + jobId
+        String url = vfcAdapterUrl + "/jobs/" + jobId
         Response apiResponse = postRequest(execution, url, nsOperationKey)
         String returnCode = apiResponse.getStatus()
         String aaiResponseAsString = apiResponse.readEntity(String.class)
index bae1349..e058616 100644 (file)
@@ -32,6 +32,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
 import org.onap.so.logger.MessageEnum
 import org.onap.so.logger.MsoLogger
 import org.onap.so.utils.TargetEntity
+import org.onap.so.bpmn.core.UrnPropertiesReader
 
 import javax.ws.rs.core.Response
 /**
@@ -41,11 +42,6 @@ import javax.ws.rs.core.Response
 public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
        private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVFCNetworkServiceInstance.class);
 
-
-    String vfcUrl = "/vfc/rest/v1/vfcadapter"
-
-    String host = "http://mso.mso.testlab.openecomp.org:8080"
-
     ExceptionUtil exceptionUtil = new ExceptionUtil()
 
     JsonUtils jsonUtil = new JsonUtils()
@@ -83,6 +79,20 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
              }"""
             execution.setVariable("nsOperationKey", nsOperationKey);
             msoLogger.info("nsOperationKey:" + nsOperationKey)
+
+            String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+                       
+            if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+                msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+                msoLogger.debug(msg)
+            }
+            while (vfcAdapterUrl.endsWith('/')) {
+                vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+            }
+                       
+            execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
+
         } catch (BpmnError e) {
             throw e;
         } catch (Exception ex){
@@ -123,8 +133,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
     public void deleteNetworkService(DelegateExecution execution) {
 
         msoLogger.trace("deleteNetworkService  start ")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String nsOperationKey = execution.getVariable("nsOperationKey");
-        String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId")
+        String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId")
         Response apiResponse = deleteRequest(execution, url, nsOperationKey)
         String returnCode = apiResponse.getStatus()
         String operationStatus = "error";
@@ -142,8 +153,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
     public void terminateNetworkService(DelegateExecution execution) {
 
         msoLogger.trace("terminateNetworkService  start ")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String nsOperationKey = execution.getVariable("nsOperationKey")
-        String url =  host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate"
+        String url =  vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate"
         Response apiResponse = postRequest(execution, url, nsOperationKey)
         String returnCode = apiResponse.getStatus()
         String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -161,9 +173,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
     public void queryNSProgress(DelegateExecution execution) {
 
         msoLogger.trace("queryNSProgress  start ")
+        String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
         String jobId = execution.getVariable("jobId")
         String nsOperationKey = execution.getVariable("nsOperationKey");
-        String url =  host + vfcUrl + "/jobs/" +  execution.getVariable("jobId")
+        String url =  vfcAdapterUrl + "/jobs/" +  execution.getVariable("jobId")
         Response apiResponse = postRequest(execution, url, nsOperationKey)
         String returnCode = apiResponse.getStatus()
         String apiResponseAsString = apiResponse.readEntity(String.class)
index 9c4b573..b991e79 100644 (file)
@@ -42,8 +42,6 @@ public class HttpClient extends RestClient {
 
        @Override
        protected void initializeHeaderMap(Map<String, String> headerMap) {
-               headerMap.put("Authorization", "Basic YnBlbDpwYXNzd29yZDEk");
-               headerMap.put("content-type", "application/json");
        }
 
        @Override
index 764d2b7..83fe051 100644 (file)
@@ -43,6 +43,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import com.openpojo.business.annotation.BusinessKey;
 
+import org.hibernate.annotations.NotFound;
+import org.hibernate.annotations.NotFoundAction;
 import uk.co.blackpepper.bowman.annotation.LinkedResource;
 
 @Entity
@@ -91,6 +93,7 @@ public class VnfResource implements Serializable {
        private Date created;
 
        @ManyToOne(fetch = FetchType.LAZY)
+       @NotFound(action = NotFoundAction.IGNORE)
        @JoinColumn(name = "HEAT_TEMPLATE_ARTIFACT_UUID")
        private HeatTemplate heatTemplates;
 
index 7967390..2e8f423 100644 (file)
@@ -30,6 +30,7 @@ import { environment } from '../environments/environment';
 import { HttpResponse } from '@angular/common/http';\r
 import { PII } from './model/processInstance.model';\r
 import { HttpErrorHandlerService } from './http-error-handler.service';\r
+import { ACTINST } from './model/activityInstance.model';\r
 \r
 \r
 @Injectable({\r
@@ -59,12 +60,12 @@ export class DataService {
   }\r
 \r
   // HTTP GET to return Activity instancs using ProcessInstanceID\r
-  getActivityInstance(processInstanceId) {\r
+  getActivityInstance(processInstanceId): Promise<ACTINST[]> {\r
     var url = environment.soMonitoringBackendURL + 'activity-instance/' + processInstanceId;\r
-    return this.http.get(url)\r
+    return this.http.get<ACTINST[]>(url)\r
       .pipe(\r
         catchError(this.httpErrorHandlerService.handleError("GET", url))\r
-      );\r
+      ).toPromise();\r
   }\r
 \r
   // HTTP GET to return Activity Instance using ProcessInstanceID\r
index 4c19ba1..bb464a9 100644 (file)
@@ -43,7 +43,6 @@ import { NgxSpinnerService } from 'ngx-spinner';
 })\r
 \r
 export class DetailsComponent implements OnInit {\r
-\r
   bpmnViewer: any;\r
 \r
   processInstanceID: string;\r
@@ -67,8 +66,8 @@ export class DetailsComponent implements OnInit {
   constructor(private route: ActivatedRoute, private data: DataService, private popup: ToastrNotificationService,\r
     private router: Router, private spinner: NgxSpinnerService) { }\r
 \r
-  getActInst(procInstId: string) {\r
-    this.data.getActivityInstance(procInstId).subscribe(\r
+  async getActInst(procInstId: string) {\r
+    await this.data.getActivityInstance(procInstId).then(\r
       (data: ACTINST[]) => {\r
         this.activityInstance = data;\r
         console.log(data);\r
@@ -90,7 +89,7 @@ export class DetailsComponent implements OnInit {
       });\r
   }\r
 \r
-  async  getProcInstance(procInstId) {\r
+  async getProcInstance(procInstId) {\r
     await this.data.getProcessInstance(procInstId).then(\r
       async (data: PII) => {\r
         this.processInstance = data;\r
@@ -160,4 +159,5 @@ export class DetailsComponent implements OnInit {
         this.getVarInst(this.processInstanceID);\r
       });\r
   }\r
+\r
 }\r