summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-08-28 20:45:31 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-28 20:45:31 +0000
commit8bcd8968a8c19e8529da0854c2ce2c7678259eea (patch)
treeefebd4e06507775dbaaf6f12fe08e8b4739fa1dc /mso-catalog-db
parent8f146614a02c5013b2c7e2bbe4b3471f9ae74bd6 (diff)
parent1ffe9a2d3bec70d522ff65b72b6b2726e9ce7de6 (diff)
Merge "Converted ServiceInstances to catalog db client"
Diffstat (limited to 'mso-catalog-db')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java516
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java9
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java5
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java7
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java11
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java8
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java9
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java4
21 files changed, 380 insertions, 236 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
index 75461c6cde..1d3ee7c36e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
@@ -35,6 +35,7 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -70,7 +71,8 @@ public class AllottedResource implements Serializable {
@Column(name = "DESCRIPTION")
private String description;
-
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date created;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
index f68c6d2502..00ddf35a5f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
@@ -35,6 +35,7 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -55,6 +56,7 @@ public class AllottedResourceCustomization implements Serializable {
private String modelCustomizationUUID;
@Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@Temporal(TemporalType.TIMESTAMP)
private Date created;
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 e43fc1796d..a0e2409023 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
@@ -21,27 +21,34 @@
package org.onap.so.db.catalog.client;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkRecipe;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
+import org.onap.so.db.catalog.beans.VnfRecipe;
+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.CloudSite;
-import org.onap.so.db.catalog.beans.CloudIdentity;
-import org.onap.so.db.catalog.beans.CloudifyManager;
-import org.onap.so.db.catalog.beans.ServiceRecipe;
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.jersey.SpringClientFilter;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpHeaders;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -60,50 +67,136 @@ import java.util.List;
@Component("CatalogDbClient")
public class CatalogDbClient {
- private static final String SERVICE_RECIPE_SEARCH = "/serviceRecipe/search";
- private static final String SERVICE_MODEL_UUID = "SERVICE_MODEL_UUID";
- private static final String ACTION = "ACTION";
- private static final String MODEL_NAME = "MODEL_NAME";
- private static final String SERVICE_SEARCH = "/service/search";
- private static final String MODEL_VERSION = "MODEL_VERSION";
- private static final String MODEL_INVARIANT_UUID = "MODEL_INVARIANT_UUID";
+ private static final String CLOUD_SITE = "/cloudSite";
+ private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
+ private static final String RAINY_DAY_HANDLER_MACRO = "/rainy_day_handler_macro";
+ private static final String NORTHBOUND_REQUEST_REF_LOOKUP = "/northbound_request_ref_lookup";
+ private static final String NETWORK_RESOURCE_CUSTOMIZATION = "/networkResourceCustomization";
+ private static final String COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION = "/collectionResourceInstanceGroupCustomization";
+ private static final String VNFC_INSTANCE_GROUP_CUSTOMIZATION = "/vnfcInstanceGroupCustomization";
+ private static final String ORCHESTRATION_FLOW = "/orchestrationFlow";
+ private static final String ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE = "/orchestrationStatusStateTransitionDirective";
+ private static final String INSTANCE_GROUP = "/instanceGroup";
+ private static final String COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION = "/collectionNetworkResourceCustomization";
+ private static final String BUILDING_BLOCK_DETAIL = "/buildingBlockDetail";
+ private static final String NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION = "/networkCollectionResourceCustomization";
+ private static final String VNF_RESOURCE_CUSTOMIZATION = "/vnfResourceCustomization";
+ private static final String SERVICE = "/service";
+ private static final String VNF_RESOURCE = "/vnfResource";
+ private static final String VNF_RECIPE = "/vnfRecipe";
+ private static final String VFMODULE = "/vfModule";
+ private static final String VFMODULE_CUSTOMIZATION = "/vfModuleCustomization";
+ private static final String VNF_COMPONENTS_RECIPE = "/vnfComponentsRecipe";
+ private static final String SERVICE_RECIPE = "/serviceRecipe";
+ private static final String NETWORK_RECIPE = "/networkRecipe";
+
+ private static final String SEARCH = "/search";
+ private static final String URI_SEPARATOR = "/";
+
+ private static final String SERVICE_MODEL_UUID = "serviceModelUUID";
+ private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID";
+ private static final String ACTION = "action";
+ private static final String MODEL_NAME = "modelName";
+ private static final String MODEL_VERSION = "modelVersion";
+ private static final String MODEL_INVARIANT_UUID = "modelInvariantUUID";
+ private static final String MODEL_INSTANCE_NAME = "modelInstanceName";
+ private static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID";
+ private static final String NF_ROLE = "nfRole";
+ private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID";
+ private static final String VNF_COMPONENT_TYPE = "vnfComponentType";
+ private static final String BUILDING_BLOCK_NAME = "buildingBlockName";
+ private static final String RESOURCE_TYPE = "resourceType";
+ private static final String ORCHESTRATION_STATUS = "orchestrationStatus";
+ private static final String TARGET_ACTION = "targetAction";
+ private static final String REQUEST_SCOPE = "requestScope";
+ private static final String IS_ALACARTE = "isALaCarte";
+ private static final String FLOW_NAME = "flowName";
+ private static final String SERVICE_TYPE = "serviceType";
+ private static final String VNF_TYPE = "vnfType";
+ private static final String ERROR_CODE = "errorCode";
+ private static final String WORK_STEP = "workStep";
+ private static final String CLLI = "clli";
+ private static final String CLOUD_VERSION = "cloudVersion";
+
private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc";
private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction";
- private String findByModelVersionAndModelInvariantUUIDURI = "/findByModelVersionAndModelInvariantUUID";
-
- private Client<Service> serviceClient;
+ private String findFirstByModelVersionAndModelInvariantUUIDURI = "/findFirstByModelVersionAndModelInvariantUUID";
+ private String findByModelInvariantUUIDURI = "/findByModelInvariantUUIDOrderByModelVersionDesc";
+ private String findFirstByModelNameAndAction = "/findFirstByModelNameAndAction";
+ private String findFirstResourceByModelInvariantUUIDAndModelVersion = "/findFirstResourceByModelInvariantUUIDAndModelVersion";
+ private String findByModelInstanceNameAndVnfResources = "/findByModelInstanceNameAndVnfResources";
+ private String findFirstVnfRecipeByNfRoleAndAction = "/findFirstVnfRecipeByNfRoleAndAction";
+ private String findByModelCustomizationUUIDAndVfModuleModelUUID = "/findByModelCustomizationUUIDAndVfModuleModelUUID";
+ private String findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction";
+ private String findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction";
+ private String findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = "/findByModelInvariantUUIDOrderByModelVersionDesc";
+ private String findFirstVfModuleByModelInvariantUUIDAndModelVersion = "/findFirstVfModuleByModelInvariantUUIDAndModelVersion";
+ private String findOneByBuildingBlockName = "/findOneByBuildingBlockName";
+ private String findOneByResourceTypeAndOrchestrationStatusAndTargetAction = "/findOneByResourceTypeAndOrchestrationStatusAndTargetAction";
+ private String findByAction = "/findByAction";
+ private String findVnfcInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
+ private String findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
+ private String findOneByActionAndRequestScopeAndIsAlacarte = "/findOneByActionAndRequestScopeAndIsAlacarte";
+ private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
+ private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
- private Client<VfModuleCustomization> vfModuleCustomizationClient;
+ private String serviceURI;
+ private String vfModuleURI;
+ private String vnfResourceURI;
+ private String vfModuleCustomizationURI;
+ private String networkCollectionResourceCustomizationURI;
+ private String networkResourceCustomizationURI;
+ private String vnfResourceCustomizationURI;
+ private String collectionNetworkResourceCustomizationURI;
+ private String instanceGroupURI;
+ private String cloudifyManagerURI;
+ private String cloudSiteURI;
- private Client<OrchestrationFlow> orchestrationClient;
+ private final Client<Service> serviceClient;
- private Client<NorthBoundRequest> northBoundRequestClient;
+ private final Client<NetworkRecipe> networkRecipeClient;
- private Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient;
+ private final Client<NetworkResourceCustomization> networkResourceCustomizationClient;
- private Client<BuildingBlockDetail> buildingBlockDetailClient;
+ private final Client<VnfResource> vnfResourceClient;
- private Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient;
+ private final Client<VnfResourceCustomization> vnfResourceCustomizationClient;
- private Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient;
+ private final Client<VnfRecipe> vnfRecipeClient;
- private Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient;
+ private final Client<VfModuleCustomization> vfModuleCustomizationClient;
- private Client<InstanceGroup> instanceGroupClient;
-
- private Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient;
-
- private Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient;
+ private final Client<VfModule> vfModuleClient;
+
+ private final Client<VnfComponentsRecipe> vnfComponentsRecipeClient;
+
+ private final Client<OrchestrationFlow> orchestrationClient;
+
+ private final Client<NorthBoundRequest> northBoundRequestClient;
- private Client<ServiceRecipe> serviceRecipeClient;
+ private final Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient;
- private Client<CloudSite> cloudSiteClient;
+ private final Client<BuildingBlockDetail> buildingBlockDetailClient;
- private Client<CloudIdentity> cloudIdentityClient;
+ private final Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient;
- private Client<CloudifyManager> cloudifyManagerClient;
+ private final Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient;
- protected Client<ControllerSelectionReference> controllerSelectionReferenceClient;
+ private final Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient;
+
+ private final Client<InstanceGroup> instanceGroupClient;
+
+ private final Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient;
+
+ private final Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient;
+
+ private final Client<ServiceRecipe> serviceRecipeClient;
+
+ private final Client<CloudSite> cloudSiteClient;
+
+ private final Client<CloudifyManager> cloudifyManagerClient;
+
+ private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
@Value("${mso.catalog.db.spring.endpoint}")
private String endpoint;
@@ -111,28 +204,66 @@ public class CatalogDbClient {
@Value("${mso.db.auth}")
private String msoAdaptersAuth;
+
@PostConstruct
public void init(){
- findFirstByModelNameURI = endpoint + SERVICE_SEARCH + findFirstByModelNameURI;
- findByModelVersionAndModelInvariantUUIDURI = endpoint + SERVICE_SEARCH + findByModelVersionAndModelInvariantUUIDURI;
- findFirstByServiceModelUUIDAndActionURI = endpoint + SERVICE_RECIPE_SEARCH + findFirstByServiceModelUUIDAndActionURI;
+ findFirstByModelNameURI = endpoint + SERVICE + SEARCH + findFirstByModelNameURI;
+ findFirstByModelVersionAndModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findFirstByModelVersionAndModelInvariantUUIDURI;
+ findByModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findByModelInvariantUUIDURI;
+ findFirstByServiceModelUUIDAndActionURI = endpoint + SERVICE_RECIPE + SEARCH + findFirstByServiceModelUUIDAndActionURI;
+ findFirstByModelNameAndAction = endpoint + NETWORK_RECIPE + SEARCH + findFirstByModelNameAndAction;
+ findFirstResourceByModelInvariantUUIDAndModelVersion = endpoint + VNF_RESOURCE + SEARCH + findFirstResourceByModelInvariantUUIDAndModelVersion;
+ findByModelInstanceNameAndVnfResources = endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findByModelInstanceNameAndVnfResources;
+ findFirstVnfRecipeByNfRoleAndAction = endpoint + VNF_RECIPE + SEARCH + findFirstVnfRecipeByNfRoleAndAction;
+ findByModelCustomizationUUIDAndVfModuleModelUUID = endpoint + VFMODULE_CUSTOMIZATION + SEARCH + findByModelCustomizationUUIDAndVfModuleModelUUID;
+ findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction;
+ findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVnfComponentTypeAndAction;
+ findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = endpoint + VFMODULE + SEARCH +findVfModuleByModelInvariantUUIDOrderByModelVersionDesc;
+ findFirstVfModuleByModelInvariantUUIDAndModelVersion = endpoint + VFMODULE + SEARCH + findFirstVfModuleByModelInvariantUUIDAndModelVersion;
+ findOneByBuildingBlockName = endpoint + BUILDING_BLOCK_DETAIL + SEARCH + findOneByBuildingBlockName;
+ findOneByResourceTypeAndOrchestrationStatusAndTargetAction = endpoint + ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE + SEARCH + findOneByResourceTypeAndOrchestrationStatusAndTargetAction;
+ findByAction = endpoint + ORCHESTRATION_FLOW + SEARCH + findByAction;
+ findVnfcInstanceGroupCustomizationByModelCustomizationUUID = endpoint + VNFC_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findVnfcInstanceGroupCustomizationByModelCustomizationUUID;
+ findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = endpoint + COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID;
+ findOneByActionAndRequestScopeAndIsAlacarte = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarte;
+ findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
+ findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
+
+ serviceURI = endpoint + SERVICE + URI_SEPARATOR;
+ vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
+ vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR;
+ vfModuleCustomizationURI = endpoint + VFMODULE_CUSTOMIZATION + URI_SEPARATOR;
+ networkCollectionResourceCustomizationURI = endpoint + NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ networkResourceCustomizationURI = endpoint + NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ collectionNetworkResourceCustomizationURI = endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
+ cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR;
+ cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR;
}
public CatalogDbClient() {
ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
-
+
ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
restTemplate.getInterceptors().add((new SpringClientFilter()));
-
+
restTemplate.getInterceptors().add((request, body, execution) -> {
- request.getHeaders().add("Authorization", msoAdaptersAuth);
+ request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
return execution.execute(request, body);
});
}).build().buildClientFactory();
serviceClient = clientFactory.create(Service.class);
+ networkRecipeClient = clientFactory.create(NetworkRecipe.class);
+ networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
+ vnfResourceClient = clientFactory.create(VnfResource.class);
+ vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
+ vnfRecipeClient = clientFactory.create(VnfRecipe.class);
orchestrationClient = clientFactory.create(OrchestrationFlow.class);
vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
+ vfModuleClient = clientFactory.create(VfModule.class);
+ vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
@@ -145,47 +276,57 @@ public class CatalogDbClient {
networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
cloudSiteClient = clientFactory.create(CloudSite.class);
- cloudIdentityClient = clientFactory.create(CloudIdentity.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
}
-
+
public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) {
- NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
- this.getSingleNetworkCollectionResourceCustomization(UriBuilder.fromUri(endpoint + "/networkCollectionResourceCustomization/" + modelCustomizationUUID).build());
+ NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
+ this.getSingleResource(networkCollectionResourceCustomizationClient, getUri(networkCollectionResourceCustomizationURI + modelCustomizationUUID));
if (networkCollectionResourceCustomization != null) {
networkCollectionResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
}
return networkCollectionResourceCustomization;
}
- private NetworkCollectionResourceCustomization getSingleNetworkCollectionResourceCustomization(URI uri) {
- return networkCollectionResourceCustomizationClient.get(uri);
- }
-
public Service getServiceByID(String modelUUID) {
- Service service = this.getSingleService(UriBuilder.fromUri(endpoint + "/service/" + modelUUID).build());
+ Service service = getSingleResource(serviceClient,getUri(serviceURI + modelUUID));
if (service != null) {
service.setModelUUID(modelUUID);
}
return service;
}
- public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
- BuildingBlockDetail buildingBlockDetail = buildingBlockDetailClient
- .get(UriBuilder.fromUri(endpoint + "/buildingBlockDetail/search/findOneByBuildingBlockName")
- .queryParam("buildingBlockName", buildingBlockName).build());
- if (buildingBlockDetail != null) {
- buildingBlockDetail.setBuildingBlockName(buildingBlockName);
+ public VfModule getVfModuleByModelUUID(String modelUUID) {
+ VfModule vfModule = getSingleResource(vfModuleClient,getUri(vfModuleURI + modelUUID));
+ if (vfModule != null) {
+ vfModule.setModelUUID(modelUUID);
}
- return buildingBlockDetail;
+ return vfModule;
+ }
+
+ public VnfResource getVnfResourceByModelUUID(String modelUUID){
+
+ VnfResource vnfResource = this.getSingleResource(vnfResourceClient, getUri(vnfResourceURI + modelUUID));
+ if (vnfResource != null) {
+ vnfResource.setModelUUID(modelUUID);
+ }
+ return vnfResource;
+ }
+
+ public VnfResourceCustomization getVnfResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
+ VnfResourceCustomization vnfResourceCustomization = getSingleResource(vnfResourceCustomizationClient, getUri(vnfResourceCustomizationURI + modelCustomizationUUID));
+ if (vnfResourceCustomization != null) {
+ vnfResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return vnfResourceCustomization;
}
public CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomizationByID(String modelCustomizationUUID) {
- CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
- this.getSingleCollectionNetworkResourceCustomization(
- UriBuilder.fromUri(endpoint + "/collectionNetworkResourceCustomization/" + modelCustomizationUUID).build());
+ CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
+ this.getSingleResource(collectionNetworkResourceCustomizationClient,getUri(UriBuilder
+ .fromUri(collectionNetworkResourceCustomizationURI + modelCustomizationUUID).build().toString()));
if (collectionNetworkResourceCustomization != null) {
collectionNetworkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
}
@@ -193,202 +334,215 @@ public class CatalogDbClient {
}
public InstanceGroup getInstanceGroupByModelUUID(String modelUUID) {
- InstanceGroup instanceGroup = this
- .getSingleInstanceGroup(UriBuilder.fromUri(endpoint + "/instanceGroup/" + modelUUID).build());
+ InstanceGroup instanceGroup = this.getSingleResource(instanceGroupClient, getUri(instanceGroupURI + modelUUID));
if (instanceGroup != null) {
instanceGroup.setModelUUID(modelUUID);
}
return instanceGroup;
}
- public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
- ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) {
- return orchestrationStatusStateTransitionDirectiveClient.get(UriBuilder
- .fromUri(
- endpoint + "/orchestrationStatusStateTransitionDirective/search/findOneByResourceTypeAndOrchestrationStatusAndTargetAction")
- .queryParam("resourceType", resourceType.name())
- .queryParam("orchestrationStatus", orchestrationStatus.name())
- .queryParam("targetAction", targetAction.name()).build());
+ public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
+ VfModuleCustomization vfModuleCust = this.getSingleResource(vfModuleCustomizationClient, getUri(vfModuleCustomizationURI + modelCustomizationUUID));
+ if (vfModuleCust != null) {
+ vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return vfModuleCust;
}
- public List<OrchestrationFlow> getOrchestrationFlowByAction(String action) {
- return this
- .getMultipleOrchestrationFlows(UriBuilder.fromUri(endpoint + "/orchestrationFlow/search/findByAction")
- .queryParam("COMPOSITE_ACTION", action).build());
+ public NetworkResourceCustomization getNetworkResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
+ NetworkResourceCustomization networkResourceCustomization =
+ this.getSingleResource(networkResourceCustomizationClient, getUri(networkResourceCustomizationURI + modelCustomizationUUID));
+ if (networkResourceCustomization != null) {
+ networkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return networkResourceCustomization;
}
- public List<OrchestrationFlow> getAllOrchestrationFlows() {
- return this.getMultipleOrchestrationFlows(UriBuilder.fromUri(endpoint + "/orchestrationFlow/").build());
+ public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
+ BuildingBlockDetail buildingBlockDetail = getSingleResource(buildingBlockDetailClient, getUri(UriBuilder
+ .fromUri(findOneByBuildingBlockName).queryParam(BUILDING_BLOCK_NAME, buildingBlockName).build().toString()));
+ if (buildingBlockDetail != null) {
+ buildingBlockDetail.setBuildingBlockName(buildingBlockName);
+ }
+ return buildingBlockDetail;
}
- private List<OrchestrationFlow> getMultipleOrchestrationFlows(URI uri) {
- Iterable<OrchestrationFlow> orchIterator = orchestrationClient.getAll(uri);
- List<OrchestrationFlow> orchList = new ArrayList<>();
- Iterator<OrchestrationFlow> it = orchIterator.iterator();
- it.forEachRemaining(orchList::add);
- return orchList;
+
+ public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
+ ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) {
+ return getSingleResource(orchestrationStatusStateTransitionDirectiveClient, UriBuilder
+ .fromUri(findOneByResourceTypeAndOrchestrationStatusAndTargetAction)
+ .queryParam(RESOURCE_TYPE, resourceType.name())
+ .queryParam(ORCHESTRATION_STATUS, orchestrationStatus.name())
+ .queryParam(TARGET_ACTION, targetAction.name()).build());
+ }
+
+ public List<OrchestrationFlow> getOrchestrationFlowByAction(String action) {
+ return this.getMultipleResources(orchestrationClient, UriBuilder
+ .fromUri(findByAction).queryParam(ACTION, action).build());
}
public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupsByVnfResourceCust(String modelCustomizationUUID) {
- return this.getMultipleVnfcInstanceGroupCustomizations(
- UriBuilder.fromUri(endpoint + "/vnfcInstanceGroupCustomization/search/findByModelCustomizationUUID")
- .queryParam("MODEL_CUSTOMIZATION_UUID", modelCustomizationUUID).build());
+ return this.getMultipleResources(vnfcInstanceGroupCustomizationClient, UriBuilder
+ .fromUri(findVnfcInstanceGroupCustomizationByModelCustomizationUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
}
public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomizationByModelCustUUID(
String modelCustomizationUUID) {
- return this.getMultipleCollectionResourceInstanceGroupCustomizations(UriBuilder
- .fromUri(endpoint + "/collectionResourceInstanceGroupCustomization/search/findByModelCustomizationUUID")
- .queryParam("MODEL_CUSTOMIZATION_UUID", modelCustomizationUUID).build());
- }
-
- private List<CollectionResourceInstanceGroupCustomization> getMultipleCollectionResourceInstanceGroupCustomizations(
- URI uri) {
- Iterable<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustIter = collectionResourceInstanceGroupCustomizationClient
- .getAll(uri);
- List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustList = new ArrayList<>();
- Iterator<CollectionResourceInstanceGroupCustomization> it = collectionInstanceGroupCustIter.iterator();
- it.forEachRemaining(collectionInstanceGroupCustList::add);
- return collectionInstanceGroupCustList;
+ return this.getMultipleResources(collectionResourceInstanceGroupCustomizationClient, UriBuilder
+ .fromUri(findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
}
- private List<VnfcInstanceGroupCustomization> getMultipleVnfcInstanceGroupCustomizations(URI uri) {
- Iterable<VnfcInstanceGroupCustomization> vnfcIterator = vnfcInstanceGroupCustomizationClient.getAll(uri);
- List<VnfcInstanceGroupCustomization> vnfcList = new ArrayList<>();
- Iterator<VnfcInstanceGroupCustomization> it = vnfcIterator.iterator();
- it.forEachRemaining(vnfcList::add);
- return vnfcList;
- }
-
- public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
- VfModuleCustomization vfModuleCust = this.getSingleVfModuleCustomization(
- UriBuilder.fromUri(endpoint + "/vfModuleCustomization/" + modelCustomizationUUID).build());
- if (vfModuleCust != null) {
- vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return vfModuleCust;
+ public VfModuleCustomization getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(String modelCustomizationUUID, String vfModuleModelUUID) {
+ return this.getSingleResource(vfModuleCustomizationClient, getUri(UriBuilder
+ .fromUri(findByModelCustomizationUUIDAndVfModuleModelUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID,modelCustomizationUUID)
+ .queryParam(VF_MODULE_MODEL_UUID,vfModuleModelUUID).build().toString()));
}
public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(String requestAction,
String resourceName, boolean aLaCarte) {
- return this.getSingleNorthBoundRequest(UriBuilder
- .fromUri(endpoint + "/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarte")
- .queryParam("ACTION", requestAction).queryParam("REQUEST_SCOPE", resourceName)
- .queryParam("IS_ALACARTE", aLaCarte).build());
+ return this.getSingleResource(northBoundRequestClient, UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarte)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte).build());
}
public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
String flowName, String serviceType, String vnfType, String errorCode, String workStep) {
- return this.getSingleRainyDayHandlerStatus(UriBuilder
- .fromUri(
- endpoint + "/rainy_day_handler_macro/search/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep")
- .queryParam("FLOW_NAME", flowName).queryParam("SERVICE_TYPE", serviceType)
- .queryParam("VNF_TYPE", vnfType).queryParam("ERROR_CODE", errorCode).queryParam("WORK_STEP", workStep)
+ return this.getSingleResource(rainyDayHandlerStatusClient, UriBuilder
+ .fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep)
+ .queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
+ .queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
.build());
}
-
+
public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action){
- return this.getSingleServiceRecipe(UriBuilder.fromUri(findFirstByServiceModelUUIDAndActionURI)
+ return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstByServiceModelUUIDAndActionURI)
.queryParam(SERVICE_MODEL_UUID,modelUUID)
- .queryParam(ACTION,action)
- .build());
+ .queryParam(ACTION,action).build().toString()));
}
-
- public Service getFirstByModelNameOrderByModelVersionDesc(String modelName){
- return this.getSingleService(UriBuilder.fromUri(findFirstByModelNameURI)
+
+ public NetworkRecipe getFirstNetworkRecipeByModelNameAndAction(String modelName, String action){
+ return this.getSingleResource(networkRecipeClient, UriBuilder
+ .fromUri(findFirstByModelNameAndAction)
.queryParam(MODEL_NAME,modelName)
- .build());
+ .queryParam(ACTION,action).build());
}
public ControllerSelectionReference getControllerSelectionReferenceByVnfType(String vnfType) {
- return this.getSingleControllerSelectionReference(UriBuilder
+ return this.getSingleResource(controllerSelectionReferenceClient, UriBuilder
.fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfType")
.queryParam("VNF_TYPE", vnfType).build());
}
public ControllerSelectionReference getControllerSelectionReferenceByVnfTypeAndActionCategory(String vnfType, String actionCategory) {
- return this.getSingleControllerSelectionReference(UriBuilder
+ return this.getSingleResource(controllerSelectionReferenceClient, UriBuilder
.fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfTypeAndActionCategory")
.queryParam("VNF_TYPE", vnfType).queryParam("ACTION_CATEGORY", actionCategory).build());
}
-
- private CollectionNetworkResourceCustomization getSingleCollectionNetworkResourceCustomization(URI uri) {
- return collectionNetworkResourceCustomizationClient.get(uri);
- }
- public CloudifyManager getCloudifyManager(String id) {
- return this.getSingleCloudifyManager(UriBuilder.fromUri(endpoint+"/cloudifyManager/"+id).build());
- }
-
- public CloudSite getCloudSite(String id){
- return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/"+id).build());
- }
-
- public CloudIdentity getCloudIdentity(String id){
- return this.getSingleCloudIdentity(UriBuilder.fromUri(endpoint+"/cloudIdentity/"+id).build());
+ public Service getFirstByModelNameOrderByModelVersionDesc(String modelName){
+ return this.getSingleResource(serviceClient,UriBuilder
+ .fromUri(findFirstByModelNameURI)
+ .queryParam(MODEL_NAME,modelName).build());
}
-
- public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
- return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/search/findByClliAndCloudVersion")
- .queryParam("CLLI",clli).queryParam("CLOUD_VERSION",cloudVersion)
- .build());
+
+
+ public VnfResource getFirstVnfResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){
+ return this.getSingleResource(vnfResourceClient, getUri(UriBuilder
+ .fromUri(findFirstResourceByModelInvariantUUIDAndModelVersion)
+ .queryParam(MODEL_INVARIANT_UUID,modelInvariantUUID)
+ .queryParam(MODEL_VERSION,modelVersion).build().toString()));
}
- private InstanceGroup getSingleInstanceGroup(URI uri) {
- return instanceGroupClient.get(uri);
+
+ public VnfResourceCustomization getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(String modelInstanceName, VnfResource vnfResource){
+ return this.getSingleResource(vnfResourceCustomizationClient, getUri(UriBuilder
+ .fromUri(findByModelInstanceNameAndVnfResources)
+ .queryParam(MODEL_INSTANCE_NAME,modelInstanceName)
+ .queryParam(VNF_RESOURCE_MODEL_UUID,vnfResource.getModelUUID()).build().toString()));
}
- private Service getSingleService(URI uri) {
- return serviceClient.get(uri);
+ public VnfRecipe getFirstVnfRecipeByNfRoleAndAction(String nfRole, String action){
+ return this.getSingleResource(vnfRecipeClient,getUri(UriBuilder
+ .fromUri(findFirstVnfRecipeByNfRoleAndAction)
+ .queryParam(NF_ROLE,nfRole)
+ .queryParam(ACTION,action).build().toString()));
}
- private VfModuleCustomization getSingleVfModuleCustomization(URI uri) {
- return vfModuleCustomizationClient.get(uri);
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String vfModuleModelUUID, String vnfComponentType, String action){
+ return this.getSingleResource(vnfComponentsRecipeClient,getUri(UriBuilder
+ .fromUri(findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction)
+ .queryParam(VF_MODULE_MODEL_UUID,vfModuleModelUUID)
+ .queryParam(VNF_COMPONENT_TYPE,vnfComponentType)
+ .queryParam(ACTION,action).build().toString()));
}
- private NorthBoundRequest getSingleNorthBoundRequest(URI uri) {
- return northBoundRequestClient.get(uri);
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action) {
+ return this.getSingleResource(vnfComponentsRecipeClient,getUri(UriBuilder
+ .fromUri(findFirstVnfComponentsRecipeByVnfComponentTypeAndAction)
+ .queryParam(VNF_COMPONENT_TYPE,vnfComponentType)
+ .queryParam(ACTION,action).build().toString()));
+ }
+ protected URI getUri(String template){
+ return URI.create(template);
}
- private RainyDayHandlerStatus getSingleRainyDayHandlerStatus(URI uri) {
- return rainyDayHandlerStatusClient.get(uri);
+ public CloudifyManager getCloudifyManager(String id) {
+ return this.getSingleResource(cloudifyManagerClient,getUri(cloudifyManagerURI + id));
}
-
- private ServiceRecipe getSingleServiceRecipe(URI uri){
- return serviceRecipeClient.get(uri);
+
+ public CloudSite getCloudSite(String id){
+ return this.getSingleResource(cloudSiteClient, getUri(cloudSiteURI + id));
}
- protected CloudSite getSinglCloudSite(URI uri) {
- return cloudSiteClient.get(uri);
+ public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
+ return this.getSingleResource(cloudSiteClient, getUri(UriBuilder
+ .fromUri(findByClliAndCloudVersion)
+ .queryParam(CLLI,clli).queryParam(CLOUD_VERSION,cloudVersion).build().toString()));
}
- protected CloudIdentity getSingleCloudIdentity(URI uri) {
- return cloudIdentityClient.get(uri);
+ public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
+ return this.getSingleResource(serviceClient, getUri(UriBuilder
+ .fromUri(findFirstByModelVersionAndModelInvariantUUIDURI)
+ .queryParam(MODEL_VERSION, modelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
}
- protected CloudifyManager getSingleCloudifyManager(URI uri) {
- return cloudifyManagerClient.get(uri);
+ public VfModule getVfModuleByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){
+ return this.getSingleResource(vfModuleClient,getUri(UriBuilder
+ .fromUri(findFirstVfModuleByModelInvariantUUIDAndModelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID)
+ .queryParam(MODEL_VERSION, modelVersion).build().toString()));
}
- private ControllerSelectionReference getSingleControllerSelectionReference(URI uri) {
- return controllerSelectionReferenceClient.get(uri);
+ public List<Service> getServiceByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
+ return this.getMultipleResources(serviceClient, getUri(UriBuilder
+ .fromUri(findByModelInvariantUUIDURI)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
}
- public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
- return this.getSingleService(
- UriBuilder.fromUri(findByModelVersionAndModelInvariantUUIDURI)
- .queryParam(MODEL_VERSION, modelVersion)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build());
+ public List<VfModule> getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
+ return this.getMultipleResources(vfModuleClient, getUri(UriBuilder
+ .fromUri(findVfModuleByModelInvariantUUIDOrderByModelVersionDesc)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
}
- //USED FOR TEST ONLY
- public void setPortToEndpoint(String port) {
- endpoint = endpoint + port;
+ private <T> T getSingleResource(Client<T> client, URI uri) {
+ return client.get(uri);
}
-
- //USED FOR TEST ONLY
- public void removePortFromEndpoint() {
- endpoint = endpoint.substring(0, endpoint.lastIndexOf(':') + 1);
+
+ private <T> List<T> getMultipleResources(Client<T> client, URI uri) {
+ Iterable<T> iterator = client.getAll(uri);
+ List<T> list = new ArrayList<>();
+ Iterator<T> it = iterator.iterator();
+ it.forEachRemaining(list::add);
+ return list;
}
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java
index 58058da380..1241dac4ee 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java
@@ -27,5 +27,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "arRecipe", path = "arRecipe")
public interface ArRecipeRepository extends JpaRepository<ArRecipe, String> {
- public ArRecipe findByModelNameAndAction(String modelName, String action);
+ ArRecipe findByModelNameAndAction(String modelName, String action);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java
index 79ad9c77d1..d86377127c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java
@@ -22,10 +22,9 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "buildingBlockDetail", path = "buildingBlockDetail")
public interface BuildingBlockDetailRepository extends JpaRepository<BuildingBlockDetail, String> {
- BuildingBlockDetail findOneByBuildingBlockName(@Param("buildingBlockName") String buildingBlockName);
+ BuildingBlockDetail findOneByBuildingBlockName(String buildingBlockName);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
index 65181ff070..ba40a9c506 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
@@ -2,7 +2,6 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.CloudSite;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import javax.transaction.Transactional;
@@ -11,5 +10,5 @@ import javax.transaction.Transactional;
@Transactional
public interface CloudSiteRepository extends JpaRepository<CloudSite, String> {
- CloudSite findByClliAndCloudVersion(@Param("CLLI") String clli,@Param("CLOUD_VERSION") String cloudVersion);
+ CloudSite findByClliAndCloudVersion(String clli,String cloudVersion);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java
index 6ad1c64196..c54331b43d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java
@@ -28,6 +28,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface ModelRecipeRepository extends JpaRepository<ModelRecipe, Integer> {
- public ModelRecipe findByModelIdAndAction(String modelId, String action);
+ ModelRecipe findByModelIdAndAction(String modelId, String action);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java
index 4ace731817..e6e2904d43 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java
@@ -28,6 +28,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface ModelRepository extends JpaRepository<Model, Integer> {
- public Model findByModelVersionIdAndModelType(String modelVersionid, String modelType);
+ Model findByModelVersionIdAndModelType(String modelVersionid, String modelType);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java
index 3fb7d7aa19..10290b5877 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java
@@ -26,5 +26,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "networkRecipe", path = "networkRecipe")
public interface NetworkRecipeRepository extends JpaRepository<NetworkRecipe, String> {
- NetworkRecipe findByModelNameAndAction(String modelName, String action);
+ NetworkRecipe findFirstByModelNameAndAction(String modelName, String action);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java
index 842c888091..94c57945d1 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java
@@ -21,8 +21,6 @@
package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.NetworkResource;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfResource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@@ -38,6 +36,6 @@ public interface NetworkResourceRepository extends JpaRepository<NetworkResource
@Query(value = "SELECT * FROM network_resource WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true)
NetworkResource findFirstByModelNameOrderByModelVersionDesc(String modelName);
- public NetworkResource findResourceByModelUUID(String modelUUID);
+ NetworkResource findResourceByModelUUID(String modelUUID);
NetworkResource findOneByModelName(String modelName);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
index b568d6c09b..92a46d51f7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
@@ -22,11 +22,9 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "northbound_request_ref_lookup", path = "northbound_request_ref_lookup")
public interface NorthBoundRequestRepository extends JpaRepository<NorthBoundRequest, Integer> {
- NorthBoundRequest findOneByActionAndRequestScopeAndIsAlacarte(@Param("ACTION") String action,
- @Param("REQUEST_SCOPE") String requestScope, @Param("IS_ALACARTE") Boolean isALaCarte);
+ NorthBoundRequest findOneByActionAndRequestScopeAndIsAlacarte(String action, String requestScope, Boolean isALaCarte);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java
index db9cd745db..12fbc418f7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java
@@ -20,16 +20,15 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
@RepositoryRestResource(collectionResourceRel = "orchestrationFlow", path = "orchestrationFlow")
public interface OrchestrationFlowRepository extends JpaRepository<OrchestrationFlow, Integer> {
- List<OrchestrationFlow> findByAction(@Param("COMPOSITE_ACTION") String action);
+ List<OrchestrationFlow> findByAction(String action);
- OrchestrationFlow findOneByAction(@Param("COMPOSITE_ACTION") String action);
+ OrchestrationFlow findOneByAction(String action);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java
index ab728f46bf..e88480a022 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java
@@ -25,10 +25,9 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "orchestrationStatusStateTransitionDirective", path = "orchestrationStatusStateTransitionDirective")
public interface OrchestrationStatusStateTransitionDirectiveRepository extends JpaRepository<OrchestrationStatusStateTransitionDirective, String> {
- OrchestrationStatusStateTransitionDirective findOneByResourceTypeAndOrchestrationStatusAndTargetAction(@Param("resourceType") ResourceType resourceType, @Param("orchestrationStatus") OrchestrationStatus orchestrationStatus, @Param("targetAction") OrchestrationAction targetAction);
+ OrchestrationStatusStateTransitionDirective findOneByResourceTypeAndOrchestrationStatusAndTargetAction(ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
index 283c9623c8..5039384845 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
@@ -22,13 +22,10 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "rainy_day_handler_macro", path = "rainy_day_handler_macro")
public interface RainyDayHandlerStatusRepository extends JpaRepository<RainyDayHandlerStatus, Integer> {
RainyDayHandlerStatus findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- @Param("FLOW_NAME") String flowName, @Param("SERVICE_TYPE") String serviceType,
- @Param("VNF_TYPE") String vnfType, @Param("ERROR_CODE") String errorCode,
- @Param("WORK_STEP") String workStep);
+ String flowName, String serviceType, String vnfType, String errorCode, String workStep);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
index cd46846d78..40ab1704fd 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
@@ -22,14 +22,13 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "serviceRecipe", path = "serviceRecipe")
public interface ServiceRecipeRepository extends JpaRepository<ServiceRecipe, Long> {
- public ServiceRecipe findByActionAndServiceModelUUID(String action, String serviceModelUUID);
+ ServiceRecipe findByActionAndServiceModelUUID(String action, String serviceModelUUID);
- public ServiceRecipe findByAction(String action);
+ ServiceRecipe findByAction(String action);
- public ServiceRecipe findFirstByServiceModelUUIDAndAction(@Param("SERVICE_MODEL_UUID") String serviceModelUUID, @Param("ACTION") String action);
+ ServiceRecipe findFirstByServiceModelUUIDAndAction(String serviceModelUUID, String action);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
index 25b1757185..6d432c443c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
@@ -20,15 +20,14 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.data.projections.InlineService;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
@RepositoryRestResource(collectionResourceRel = "service", path = "service", excerptProjection = InlineService.class)
public interface ServiceRepository extends JpaRepository<Service, String> {
List<Service> findByModelName(String modelName);
@@ -41,7 +40,7 @@ public interface ServiceRepository extends JpaRepository<Service, String> {
* @return
*/
@Query(value = "SELECT * FROM service WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true)
- Service findFirstByModelNameOrderByModelVersionDesc(@Param("MODEL_NAME") String modelName);
+ Service findFirstByModelNameOrderByModelVersionDesc(String modelName);
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
@@ -73,8 +72,7 @@ public interface ServiceRepository extends JpaRepository<Service, String> {
@Query(value = "SELECT * FROM service WHERE MODEL_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true)
Service findOneByModelUUIDOrderByModelVersionDesc(String modelUUID);
- Service findByModelVersionAndModelInvariantUUID(@Param("MODEL_VERSION") String modelVersion,
- @Param("MODEL_INVARIANT_UUID") String modelInvariantUUID);
+ Service findFirstByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID);
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
@@ -90,9 +88,9 @@ public interface ServiceRepository extends JpaRepository<Service, String> {
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
- * @param modelInvariantId
+ * @param modelInvariantUUID
* @return
*/
@Query(value = "SELECT * FROM service WHERE MODEL_INVARIANT_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC;", nativeQuery = true)
- List<Service> findByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantId);
+ List<Service> findByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java
index 6b403b312e..cd985dba9f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java
@@ -20,25 +20,24 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
import org.onap.so.db.catalog.beans.VfModule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
@RepositoryRestResource(collectionResourceRel = "vfModule", path = "vfModule")
public interface VFModuleRepository extends JpaRepository<VfModule, String> {
VfModule findByModelUUID(String modelUUID);
- VfModule findByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion);
+ VfModule findFirstVfModuleByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion);
VfModule findByModelName(String modelName);
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
- * @param modelInvariantUUID
+ * @param modelName
* @return
*/
@Query(value = "SELECT * FROM vf_module WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true)
@@ -46,7 +45,7 @@ public interface VFModuleRepository extends JpaRepository<VfModule, String> {
VfModule findByModelInvariantUUIDAndModelUUID(String modelCustomizationUUID, String modelUUID);
- VfModule findByModelInvariantUUID(@Param("ACTION") String modelCustomizationUUID);
+ VfModule findByModelInvariantUUID(String modelCustomizationUUID);
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java
index 822ac44be2..440a675c97 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java
@@ -27,13 +27,13 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "vnfComponentsRecipe", path = "vnfComponentsRecipe")
public interface VnfComponentRecipeRepository extends JpaRepository<VnfComponentsRecipe, String> {
- VnfComponentsRecipe findVnfComponentsRecipeByVfModuleModelUUIDAndVnfTypeAndAction(String vfModuleModelUUID,
+ VnfComponentsRecipe findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfTypeAndAction(String vfModuleModelUUID,
String vnfType, String action);
- VnfComponentsRecipe findVnfComponentsRecipeByVnfTypeAndAction(String vnfType, String action);
+ VnfComponentsRecipe findFirstVnfComponentsRecipeByVnfTypeAndAction(String vnfType, String action);
- VnfComponentsRecipe findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String modelUUID,
+ VnfComponentsRecipe findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String vfModuleModelUUID,
String vnfComponentType, String action);
- VnfComponentsRecipe findVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action);
+ VnfComponentsRecipe findFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
index 0d9ac2b33d..46a4cfba11 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
@@ -20,20 +20,21 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
-import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.data.projections.InlineVnf;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
@RepositoryRestResource(collectionResourceRel = "vnfResourceCustomization", path = "vnfResourceCustomization", excerptProjection = InlineVnf.class)
public interface VnfCustomizationRepository extends JpaRepository<VnfResourceCustomization, String> {
List<VnfResourceCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
VnfResourceCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
- VnfResourceCustomization findByModelInstanceNameAndVnfResources(String modelInstanceName, VnfResource vnfResource);
+ @Query(value = "SELECT * FROM vnf_resource_customization WHERE MODEL_INSTANCE_NAME = ?1 AND VNF_RESOURCE_MODEL_UUID = ?2 LIMIT 1;", nativeQuery = true)
+ VnfResourceCustomization findByModelInstanceNameAndVnfResources(String modelInstanceName, String vnfResourceModelUUID);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java
index 97d6669c58..dbc86cbb8f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java
@@ -28,5 +28,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface VnfRecipeRepository extends JpaRepository<VnfRecipe, String> {
VnfRecipe findVnfRecipeByServiceTypeAndAction(String serviceType, String action);
- VnfRecipe findVnfRecipeByNfRoleAndAction(String nfRole, String action);
+ VnfRecipe findFirstVnfRecipeByNfRoleAndAction(String nfRole, String action);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java
index 5b0258238e..e48f8bb653 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java
@@ -35,7 +35,7 @@ public interface VnfResourceRepository extends JpaRepository<VnfResource, String
VnfResource findResourceByModelUUID(String modelUUID);
- VnfResource findResourceByModelInvariantUUID(String modelInvariantId);
+ VnfResource findResourceByModelInvariantUUID(String modelInvariantUUID);
- VnfResource findResourceByModelInvariantUUIDAndModelVersion(String relatedInstanceModelInvariantId, String relatedInstanceVersion);
+ VnfResource findFirstResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion);
} \ No newline at end of file