summaryrefslogtreecommitdiffstats
path: root/ms/error-catalog/services/src
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 12:16:46 -0400
committerSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 13:49:05 -0400
commit1072867dfac0df993cbd3e44bcc11a5cac7465fd (patch)
tree4a821659cf3b50cf946cbb535d528be8508e9fff /ms/error-catalog/services/src
parentd97021cd756d63402545fdc2e14ac7611c3da118 (diff)
Enabling Code Formatter
Code Formatter was turned off due to java 11 migation Issue-ID: CCSDK-2852 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8
Diffstat (limited to 'ms/error-catalog/services/src')
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt1
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt9
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt30
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt14
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt12
-rwxr-xr-xms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt8
-rw-r--r--ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt1
7 files changed, 47 insertions, 28 deletions
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt
index f0a75e087..8fc5edf37 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogConfiguration.kt
@@ -28,6 +28,7 @@ open class ErrorCatalogConfiguration
@Component
@ConfigurationProperties(prefix = "error.catalog")
open class ErrorCatalogProperties {
+
lateinit var type: String
lateinit var applicationId: String
var errorDefinitionDir: String? = null
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt
index 95b44e683..4bb042e95 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogDBService.kt
@@ -41,7 +41,7 @@ open class ErrorCatalogDBService(
* This is a getAllDomains method to retrieve all the Domain in Error Catalog Database by pages
*
* @return Page<Domain> list of the domains by page
- </Domain> */
+ </Domain> */
open fun getAllDomains(pageRequest: Pageable): Page<Domain> {
return domainRepository.findAll(pageRequest)
}
@@ -50,7 +50,7 @@ open class ErrorCatalogDBService(
* This is a getAllDomains method to retrieve all the Domain in Error Catalog Database
*
* @return List<Domain> list of the domains
- </Domain> */
+ </Domain> */
open fun getAllDomains(): List<Domain> {
return domainRepository.findAll()
}
@@ -59,7 +59,7 @@ open class ErrorCatalogDBService(
* This is a getAllDomainsByApplication method to retrieve all the Domain that belong to an application in Error Catalog Database
*
* @return List<Domain> list of the domains
- </Domain> */
+ </Domain> */
open fun getAllDomainsByApplication(applicationId: String): List<Domain> {
return domainRepository.findAllByApplicationId(applicationId)
}
@@ -68,7 +68,7 @@ open class ErrorCatalogDBService(
* This is a getAllErrorMessagesByApplication method to retrieve all the Messages that belong to an application in Error Catalog Database
*
* @return MutableMap<String, ErrorCode> list of the abstractErrorModel
- </Domain> */
+ </Domain> */
open fun getAllErrorMessagesByApplication(applicationId: String): MutableMap<String, ErrorMessageModel> {
val domains = domainRepository.findAllByApplicationId(applicationId)
val errorMessages = mutableMapOf<String, ErrorMessageModel>()
@@ -93,6 +93,7 @@ open class ErrorCatalogDBService(
}
companion object {
+
private const val MESSAGE_KEY_SEPARATOR = "."
}
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt
index 258209f71..161b6b8e4 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogExceptionHandler.kt
@@ -39,40 +39,50 @@ abstract class ErrorCatalogExceptionHandler(private val errorCatalogService: Err
@ExceptionHandler
fun errorCatalogException(e: ServerWebInputException): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.REQUEST_NOT_FOUND),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.REQUEST_NOT_FOUND),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
@ExceptionHandler
fun errorCatalogException(e: IncorrectResultSizeDataAccessException): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.DUPLICATE_DATA),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.DUPLICATE_DATA),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
@ExceptionHandler
fun errorCatalogException(e: EmptyResultDataAccessException): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.RESOURCE_NOT_FOUND),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.RESOURCE_NOT_FOUND),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
@ExceptionHandler
fun errorCatalogException(e: JpaObjectRetrievalFailureException): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.RESOURCE_NOT_FOUND),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.RESOURCE_NOT_FOUND),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
@ExceptionHandler
fun errorCatalogException(e: Exception): ResponseEntity<ErrorPayload> {
- val error = ErrorCatalogException(HttpErrorCodes.code(ErrorCatalogCodes.GENERIC_FAILURE),
- e.errorMessageOrDefault(), e.errorCauseOrDefault())
+ val error = ErrorCatalogException(
+ HttpErrorCodes.code(ErrorCatalogCodes.GENERIC_FAILURE),
+ e.errorMessageOrDefault(), e.errorCauseOrDefault()
+ )
val errorPayload = ErrorPayload(error.code, error.name, error.errorMessageOrDefault())
return errorPayload.toResponseEntity()
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt
index df13724c6..bcde35029 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogLoadService.kt
@@ -100,7 +100,7 @@ open class ErrorCatalogLoadDBService(
havingValue = ErrorMessageLibConstants.ERROR_CATALOG_TYPE_PROPERTIES
)
open class ErrorCatalogLoadPropertyService(private var errorCatalogProperties: ErrorCatalogProperties) :
- ErrorCatalogLoadService {
+ ErrorCatalogLoadService {
private val propertyFileName = ErrorMessageLibConstants.ERROR_CATALOG_PROPERTIES_FILENAME
private lateinit var propertyFile: File
@@ -134,11 +134,15 @@ open class ErrorCatalogLoadPropertyService(private var errorCatalogProperties: E
inputStream = propertyFile.inputStream()
props.load(inputStream)
} catch (e: FileNotFoundException) {
- log.error("Application ID: ${errorCatalogProperties.applicationId} > Property File '$propertyFileName' " +
- "not found in the application directory.")
+ log.error(
+ "Application ID: ${errorCatalogProperties.applicationId} > Property File '$propertyFileName' " +
+ "not found in the application directory."
+ )
} catch (e: IOException) {
- log.error("Application ID: ${errorCatalogProperties.applicationId} > Fail to load property file " +
- "'$propertyFileName' for message errors.")
+ log.error(
+ "Application ID: ${errorCatalogProperties.applicationId} > Fail to load property file " +
+ "'$propertyFileName' for message errors."
+ )
} finally {
inputStream?.close()
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt
index 21fd51b2f..298daa6fc 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/ErrorCatalogService.kt
@@ -18,6 +18,7 @@
package org.onap.ccsdk.cds.error.catalog.services
import kotlinx.coroutines.runBlocking
+import org.apache.commons.lang3.exception.ExceptionUtils
import org.onap.ccsdk.cds.error.catalog.core.ErrorCatalog
import org.onap.ccsdk.cds.error.catalog.core.ErrorCatalogException
import org.onap.ccsdk.cds.error.catalog.core.ErrorMessageLibConstants
@@ -25,7 +26,6 @@ import org.onap.ccsdk.cds.error.catalog.core.ErrorPayload
import org.onap.ccsdk.cds.error.catalog.core.GrpcErrorCodes
import org.onap.ccsdk.cds.error.catalog.core.HttpErrorCodes
import org.onap.ccsdk.cds.error.catalog.core.utils.ErrorCatalogUtils
-import org.apache.commons.lang3.exception.ExceptionUtils
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
import org.springframework.stereotype.Service
import javax.annotation.PostConstruct
@@ -78,11 +78,11 @@ open class ErrorCatalogService(private var errorCatalogLoadService: ErrorCatalog
}
return ErrorCatalog(
- errorCatalogException.name,
- errorCatalogException.domain,
- errorCode,
- action,
- errorCause
+ errorCatalogException.name,
+ errorCatalogException.domain,
+ errorCode,
+ action,
+ errorCause
)
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt
index 7ade1c2a2..7216c0585 100755
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/Domain.kt
@@ -17,18 +17,18 @@
package org.onap.ccsdk.cds.error.catalog.services.domain
import java.io.Serializable
+import java.util.UUID
import javax.persistence.CascadeType
import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.FetchType
import javax.persistence.Id
+import javax.persistence.JoinColumn
+import javax.persistence.JoinTable
import javax.persistence.Lob
import javax.persistence.ManyToMany
import javax.persistence.Table
import javax.persistence.UniqueConstraint
-import java.util.UUID
-import javax.persistence.JoinTable
-import javax.persistence.JoinColumn
/**
* Provide ErrorCode Entity
@@ -40,6 +40,7 @@ import javax.persistence.JoinColumn
@Entity
@Table(name = "ERROR_DOMAINS", uniqueConstraints = [UniqueConstraint(columnNames = ["name", "application_id"])])
class Domain : Serializable {
+
@Id
var id: String = UUID.randomUUID().toString()
@@ -71,6 +72,7 @@ class Domain : Serializable {
}
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt
index a4e92af48..f2556e6c1 100644
--- a/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt
+++ b/ms/error-catalog/services/src/main/kotlin/org/onap/ccsdk/cds/error/catalog/services/domain/ErrorMessageModel.kt
@@ -56,6 +56,7 @@ class ErrorMessageModel : Serializable {
val domains: MutableSet<Domain> = mutableSetOf()
companion object {
+
private const val serialVersionUID = 1L
}