summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src/main/java')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java18
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java29
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java14
3 files changed, 38 insertions, 23 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
index a12edac8a0..1882ad5964 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
@@ -63,6 +63,10 @@ public class RainyDayHandlerStatus implements Serializable {
private String errorCode;
@BusinessKey
+ @Column(name = "REG_EX_ERROR_MESSAGE")
+ private String errorMessage;
+
+ @BusinessKey
@Column(name = "WORK_STEP")
private String workStep;
@@ -77,8 +81,8 @@ public class RainyDayHandlerStatus implements Serializable {
public String toString() {
return new ToStringBuilder(this).append("id", id).append("flowName", flowName)
.append("serviceType", serviceType).append("vnfType", vnfType).append("errorCode", errorCode)
- .append("workStep", workStep).append("policy", policy).append("secondaryPolicy", secondaryPolicy)
- .toString();
+ .append("errorMessage", errorMessage).append("workStep", workStep).append("policy", policy)
+ .append("secondaryPolicy", secondaryPolicy).toString();
}
@Override
@@ -161,4 +165,14 @@ public class RainyDayHandlerStatus implements Serializable {
public void setSecondaryPolicy(String secondaryPolicy) {
this.secondaryPolicy = secondaryPolicy;
}
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+
}
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 19200468ae..a1f926e25f 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
@@ -84,7 +84,6 @@ public class CatalogDbClient {
private static final String CLOUD_SITE = "/cloudSite";
private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
- private static final String CVNFC_CUSTOMZIATION = "/cvnfcCustomization";
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";
@@ -124,7 +123,6 @@ public class CatalogDbClient {
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";
@@ -137,6 +135,7 @@ public class CatalogDbClient {
private static final String IS_ALACARTE = "isALaCarte";
private static final String CLOUD_OWNER = "cloudOwner";
private static final String FLOW_NAME = "flowName";
+ private static final String ERROR_MESSAGE = "errorMessage";
private static final String SERVICE_TYPE = "serviceType";
private static final String VNF_TYPE = "vnfType";
private static final String ERROR_CODE = "errorCode";
@@ -184,8 +183,8 @@ public class CatalogDbClient {
"/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner";
private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType =
"/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType";
- private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep =
- "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
+
+ private static final String findRainyDayHandler = "/findRainyDayHandler";
private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid";
@@ -196,10 +195,8 @@ public class CatalogDbClient {
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;
@@ -258,8 +255,6 @@ public class CatalogDbClient {
private final Client<CloudifyManager> cloudifyManagerClient;
- private final Client<CvnfcCustomization> cvnfcCustomizationClient;
-
private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
private final Client<PnfResource> pnfResourceClient;
@@ -324,8 +319,6 @@ public class CatalogDbClient {
findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType =
endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH
+ findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType;
- findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH
- + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
findPnfResourceCustomizationByModelUuid =
@@ -340,12 +333,9 @@ public class CatalogDbClient {
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;
- cvnfcResourceCustomizationURI = endpoint + CVNFC_CUSTOMZIATION + URI_SEPARATOR;
- vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
collectionNetworkResourceCustomizationURI =
endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
@@ -400,7 +390,6 @@ public class CatalogDbClient {
homingInstanceClient = clientFactory.create(HomingInstance.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
- cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
pnfResourceClient = clientFactory.create(PnfResource.class);
@@ -450,7 +439,6 @@ public class CatalogDbClient {
homingInstanceClient = clientFactory.create(HomingInstance.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
- cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
pnfResourceClient = clientFactory.create(PnfResource.class);
@@ -645,13 +633,16 @@ public class CatalogDbClient {
.queryParam(SERVICE_TYPE, serviceType).build().toString()));
}
- public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- String flowName, String serviceType, String vnfType, String errorCode, String workStep) {
+ public RainyDayHandlerStatus getRainyDayHandlerStatus(String flowName, String serviceType, String vnfType,
+ String errorCode, String workStep, String errorMessage) {
+ logger.debug(
+ "Get Rainy Day Status - Flow Name {}, Service Type: {} , vnfType {} , errorCode {}, workStep {}, errorMessage {}",
+ flowName, serviceType, vnfType, errorCode, workStep, errorMessage);
return this.getSingleResource(rainyDayHandlerStatusClient,
- getUri(UriBuilder.fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep)
+ getUri(UriBuilder.fromUri(endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findRainyDayHandler)
.queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
.queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
- .build().toString()));
+ .queryParam(ERROR_MESSAGE, errorMessage).build().toString()));
}
public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action) {
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 2c61d91d6b..91ae10236b 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,10 +22,20 @@ 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.jpa.repository.Query;
+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(String flowName,
- String serviceType, String vnfType, String errorCode, String workStep);
+
+ @Query(value = "SELECT * FROM rainy_day_handler_macro WHERE (FLOW_NAME = :flowName ) AND SERVICE_TYPE IN (:serviceType ,'*') "
+ + " AND VNF_TYPE IN ( :vnfType , '*') AND ERROR_CODE IN (:errorCode ,'*') AND WORK_STEP IN (:workStep , '*' ) "
+ + " AND ( :errorMessage REGEXP rainy_day_handler_macro.REG_EX_ERROR_MESSAGE OR REG_EX_ERROR_MESSAGE = '*') "
+ + " ORDER BY CASE WHEN 'asdf' REGEXP REG_EX_ERROR_MESSAGE THEN 0 WHEN ERROR_CODE != '*' THEN 1 WHEN VNF_TYPE != '*' THEN 2 WHEN SERVICE_TYPE != '*' THEN 3 ELSE 4 END LIMIT 1;",
+ nativeQuery = true)
+ RainyDayHandlerStatus findRainyDayHandler(@Param("flowName") String flowName,
+ @Param("serviceType") String serviceType, @Param("vnfType") String vnfType,
+ @Param("errorCode") String errorCode, @Param("workStep") String workStep,
+ @Param("errorMessage") String errorMessage);
}