Merge "Workflow Recipe Lookup"
authorSteve Smokowski <ss835w@att.com>
Mon, 8 Apr 2019 16:45:20 +0000 (16:45 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 8 Apr 2019 16:45:20 +0000 (16:45 +0000)
1  2 
mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java

@@@ -59,6 -59,7 +59,7 @@@ import org.onap.so.db.catalog.beans.Vnf
  import org.onap.so.db.catalog.beans.VnfResource;
  import org.onap.so.db.catalog.beans.VnfResourceCustomization;
  import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+ import org.onap.so.db.catalog.beans.Workflow;
  import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
  import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
  import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
@@@ -110,6 -111,7 +111,7 @@@ public class CatalogDbClient 
      private static final String NETWORK_RECIPE = "/networkRecipe";
      private static final String PNF_RESOURCE = "/pnfResource";
      private static final String PNF_RESOURCE_CUSTOMIZATION = "/pnfResourceCustomization";
+     private static final String WORKFLOW = "/workflow";
  
  
      private static final String SEARCH = "/search";
      private static final String CLLI = "clli";
      private static final String CLOUD_VERSION = "cloudVersion";
      private static final String HOMING_INSTANCE = "/homingInstance";
+     private static final String ARTIFACT_UUID = "artifactUUID";
      
      private static final String TARGET_ENTITY = "SO:CatalogDB";
      private static final String ASTERISK = "*";
      private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
      private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
      private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid";
+     private String findWorkflowByArtifactUUID = "/findByArtifactUUID";
  
      private String serviceURI;
      private String vfModuleURI;
      private String cvnfcResourceCustomizationURI;
      private String pnfResourceURI;
      private String pnfResourceCustomizationURI;
+     private String workflowURI;
  
      private final Client<Service> serviceClient;
  
      private final Client<PnfResource> pnfResourceClient;
  
      private final Client<PnfResourceCustomization> pnfResourceCustomizationClient;
+     
+     private final Client<Workflow> workflowClient;
  
      @Value("${mso.catalog.db.spring.endpoint:#{null}}")
      private String endpoint;
  
          findPnfResourceCustomizationByModelUuid =
              endpoint + PNF_RESOURCE_CUSTOMIZATION + SEARCH + findPnfResourceCustomizationByModelUuid;
+         
+         findWorkflowByArtifactUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByArtifactUUID;
  
          serviceURI = endpoint + SERVICE + URI_SEPARATOR;
          vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
          homingInstanceURI = endpoint + HOMING_INSTANCE + URI_SEPARATOR;
          pnfResourceURI = endpoint + PNF_RESOURCE + URI_SEPARATOR;
          pnfResourceCustomizationURI = endpoint + PNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+         workflowURI = endpoint + WORKFLOW + URI_SEPARATOR;
  
      }
  
          externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
          pnfResourceClient = clientFactory.create(PnfResource.class);
          pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
+         workflowClient = clientFactory.create(Workflow.class);
      }
  
      public CatalogDbClient(String baseUri, String auth) {
          externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
          pnfResourceClient = clientFactory.create(PnfResource.class);
          pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
+         workflowClient = clientFactory.create(Workflow.class);
      }
  
      public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) {
              logger.debug("Found CvnfcCustomization: {}", filtered.get(0));
              return filtered.get(0);
          }else
 -            throw new EntityNotFoundException("Unable to find VfModuleCustomization ModelCustomizationUUID:" + cvnfcCustomizationUuid);
 +            throw new EntityNotFoundException("Unable to find CvnfcCustomization ModelCustomizationUUID:" + cvnfcCustomizationUuid);
      }
      
      public CvnfcConfigurationCustomization getCvnfcCustomization(String serviceModelUUID, String vnfCustomizationUuid,
          }else
              throw new EntityNotFoundException("Unable to find CvnfcConfigurationCustomization ModelCustomizationUUID:" + cvnfcCustomizationUuid);
      }
+     
+     public Workflow findWorkflowByArtifactUUID (String artifactUUID) {
+       return this.getSingleResource(workflowClient,getUri(UriBuilder
+                 .fromUri(findWorkflowByArtifactUUID)
+                 .queryParam(ARTIFACT_UUID, artifactUUID).build().toString()));                
+     }
  }