diff options
author | MD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com> | 2021-06-17 14:08:57 +0530 |
---|---|---|
committer | MD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com> | 2021-06-17 14:11:09 +0530 |
commit | 77b03b51cd278eb7a972df467ffd0308cf810220 (patch) | |
tree | a4319e4eaa5dd15f5e2f6d56278bf72685d4560c /mso-catalog-db | |
parent | e7dc04d315cacbe219c9044dbfd4b3ccd078621f (diff) |
Merging dynamic_BPMN code to Custom_Workflow branch
Issue-ID: SO-3674
Signed-off-by: MD IRSHAD SHEIKH <md.irshad.sheikh@huawei.com>
Change-Id: I565ef9e4efa1955739d3963fa2d28a4f875ff7c5
Diffstat (limited to 'mso-catalog-db')
-rw-r--r-- | mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java | 2 | ||||
-rw-r--r-- | mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java | 90 |
2 files changed, 90 insertions, 2 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java index 36d3c98413..2b95f3bd70 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java @@ -95,7 +95,7 @@ public class CloudIdentity { @Column(name = "MEMBER_ROLE") private String memberRole; - @JsonProperty("tenant_meta_data") + @JsonProperty("tenant_metadata") @BusinessKey @Column(name = "TENANT_METADATA") private Boolean tenantMetadata; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index 91cfb00911..e87d31bbac 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -70,6 +70,7 @@ 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; import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; +import org.onap.so.rest.catalog.beans.Vnf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -275,6 +276,8 @@ public class CatalogDbClient { private final Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient; private final Client<ServiceRecipe> serviceRecipeClient; + + private final Client<NetworkResource> networkResourceClient; private final Client<ExternalServiceToInternalService> externalServiceToInternalServiceClient; @@ -441,6 +444,7 @@ public class CatalogDbClient { workflowClient = clientFactory.create(Workflow.class); bbNameSelectionReferenceClient = clientFactory.create(BBNameSelectionReference.class); processingFlagsClient = clientFactory.create(ProcessingFlags.class); + networkResourceClient= clientFactory.create(NetworkResource.class); } @@ -494,6 +498,7 @@ public class CatalogDbClient { workflowClient = clientFactory.create(Workflow.class); bbNameSelectionReferenceClient = clientFactory.create(BBNameSelectionReference.class); processingFlagsClient = clientFactory.create(ProcessingFlags.class); + networkResourceClient= clientFactory.create(NetworkResource.class); } public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID( @@ -1057,7 +1062,90 @@ public class CatalogDbClient { throw e; } } - + + public void deleteServiceRecipe(String recipeId) { + this.deleteSingleResource(serviceRecipeClient, + UriBuilder.fromUri(endpoint + SERVICE_RECIPE + URI_SEPARATOR + recipeId).build()); + } + + public void postServiceRecipe(ServiceRecipe recipe) { + + try { + HttpHeaders headers = getHttpHeaders(); + HttpEntity<ServiceRecipe> entity = new HttpEntity<>(recipe, headers); + restTemplate + .exchange(UriComponentsBuilder.fromUriString(endpoint + "/serviceRecipe").build().encode().toString(), + HttpMethod.POST, entity, ServiceRecipe.class) + .getBody(); + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + throw new EntityNotFoundException("Unable to find ServiceRecipe with Id: " + recipe.getId()); + } + throw e; + } + } + + public void postVnfRecipe(VnfRecipe recipe) { + try { + HttpHeaders headers = getHttpHeaders(); + HttpEntity<VnfRecipe> entity = new HttpEntity<>(recipe, headers); + restTemplate + .exchange(UriComponentsBuilder.fromUriString(endpoint + "/vnfRecipe").build().encode().toString(), + HttpMethod.POST, entity, VnfRecipe.class) + .getBody(); + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + throw new EntityNotFoundException("Unable to find VnfRecipe with Id: " + recipe.getId()); + } + throw e; + } + } + + public void postNetworkRecipe(NetworkRecipe recipe) { + try { + HttpHeaders headers = getHttpHeaders(); + HttpEntity<NetworkRecipe> entity = new HttpEntity<>(recipe, headers); + restTemplate + .exchange(UriComponentsBuilder.fromUriString(endpoint + "/networkRecipe").build().encode().toString(), + HttpMethod.POST, entity, NetworkRecipe.class) + .getBody(); + } catch (HttpClientErrorException e) { + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + throw new EntityNotFoundException("Unable to find NetworkRecipe with Id: " + recipe.getId()); + } + throw e; + } + } + + public List<ServiceRecipe> getServiceRecipes() { + return this.getMultipleResources(serviceRecipeClient, + UriBuilder.fromUri(endpoint + SERVICE_RECIPE).queryParam("size", "1000").build()); + } + + public List<NetworkRecipe> getNetworkRecipes() { + return this.getMultipleResources(networkRecipeClient, + UriBuilder.fromUri(endpoint + NETWORK_RECIPE).queryParam("size", "1000").build()); + } + + public List<NetworkResource> getNetworkResources() { + return this.getMultipleResources(networkResourceClient, + UriBuilder.fromUri(endpoint + "/networkResource").queryParam("size", "1000").build()); + } + + public List<VnfResource> getVnfResources() { + return this.getMultipleResources(vnfResourceClient, + UriBuilder.fromUri(endpoint + "/vnfResource").queryParam("size", "1000").build()); + } + + public List<VnfRecipe> getVnfRecipes() { + return this.getMultipleResources(vnfRecipeClient, + UriBuilder.fromUri(endpoint + VNF_RECIPE).queryParam("size", "1000").build()); + } + + private <T> void deleteSingleResource(Client<T> client, URI uri) { + client.delete(uri); + } + public org.onap.so.rest.catalog.beans.Vnf getVnfModelInformation(String serviceModelUUID, String vnfCustomizationUUID, String depth) { if (Strings.isNullOrEmpty(serviceModelUUID)) { |