diff options
author | Steve Smokowski <ss835w@att.com> | 2019-08-09 12:27:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-09 12:27:07 +0000 |
commit | cdb523dd83161a9ceefec9c54364f9f8f0e56391 (patch) | |
tree | 2bbaa64e586fd3c13d840b770f2f8dd81c292088 /mso-catalog-db | |
parent | 767d75c00de86e1040c9dede18cf9778990ed5bf (diff) | |
parent | cb25a919f7af9dbcba9c0ee099547aaa134e63fb (diff) |
Merge "add rainy day handling with SERVICE_ROLE and type"
Diffstat (limited to 'mso-catalog-db')
3 files changed, 22 insertions, 7 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 1882ad5964..39217c75fa 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 @@ -77,12 +77,16 @@ public class RainyDayHandlerStatus implements Serializable { @Column(name = "SECONDARY_POLICY") private String secondaryPolicy; + @BusinessKey + @Column(name = "SERVICE_ROLE") + private String serviceRole; + @Override public String toString() { return new ToStringBuilder(this).append("id", id).append("flowName", flowName) .append("serviceType", serviceType).append("vnfType", vnfType).append("errorCode", errorCode) .append("errorMessage", errorMessage).append("workStep", workStep).append("policy", policy) - .append("secondaryPolicy", secondaryPolicy).toString(); + .append("secondaryPolicy", secondaryPolicy).append("serviceRole", serviceRole).toString(); } @Override @@ -93,13 +97,14 @@ public class RainyDayHandlerStatus implements Serializable { RainyDayHandlerStatus castOther = (RainyDayHandlerStatus) other; return new EqualsBuilder().append(flowName, castOther.flowName).append(serviceType, castOther.serviceType) .append(vnfType, castOther.vnfType).append(errorCode, castOther.errorCode) - .append(workStep, castOther.workStep).append(policy, castOther.policy).isEquals(); + .append(workStep, castOther.workStep).append(policy, castOther.policy) + .append(serviceRole, castOther.serviceRole).isEquals(); } @Override public int hashCode() { return new HashCodeBuilder().append(flowName).append(serviceType).append(vnfType).append(errorCode) - .append(workStep).append(policy).toHashCode(); + .append(workStep).append(policy).append(serviceRole).toHashCode(); } public Integer getId() { @@ -174,5 +179,12 @@ public class RainyDayHandlerStatus implements Serializable { this.errorMessage = errorMessage; } + public String getServiceRole() { + return serviceRole; + } + + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } } 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 a18f870970..a959f2f5a1 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 @@ -137,6 +137,7 @@ public class CatalogDbClient { 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_ROLE = "serviceRole"; private static final String SERVICE_TYPE = "serviceType"; private static final String VNF_TYPE = "vnfType"; private static final String ERROR_CODE = "errorCode"; @@ -638,7 +639,7 @@ public class CatalogDbClient { } public RainyDayHandlerStatus getRainyDayHandlerStatus(String flowName, String serviceType, String vnfType, - String errorCode, String workStep, String errorMessage) { + String errorCode, String workStep, String errorMessage, String serviceRole) { logger.debug( "Get Rainy Day Status - Flow Name {}, Service Type: {} , vnfType {} , errorCode {}, workStep {}, errorMessage {}", flowName, serviceType, vnfType, errorCode, workStep, errorMessage); @@ -646,7 +647,8 @@ public class CatalogDbClient { UriComponentsBuilder.fromUriString(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) - .queryParam(ERROR_MESSAGE, errorMessage).build().encode().toUri()); + .queryParam(ERROR_MESSAGE, errorMessage).queryParam(SERVICE_ROLE, serviceRole).build().encode() + .toUri()); } 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 6819657b78..efe078bbfc 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 @@ -32,10 +32,11 @@ public interface RainyDayHandlerStatusRepository extends JpaRepository<RainyDayH @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 :errorMessage 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;", + + " AND SERVICE_ROLE IN ( :serviceRole , '*') " + + " ORDER BY CASE WHEN :errorMessage REGEXP REG_EX_ERROR_MESSAGE THEN 0 WHEN ERROR_CODE != '*' THEN 1 WHEN VNF_TYPE != '*' THEN 2 WHEN SERVICE_TYPE != '*' THEN 3 WHEN SERVICE_ROLE != '*' THEN 4 ELSE 5 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); + @Param("errorMessage") String errorMessage, @Param("serviceRole") String serviceRole); } |