Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/DALA-5170_data_unavailable_statu…
Browse files Browse the repository at this point in the history
…s_as_status_for_data_requests' into DALA-5170_data_unavailable_status_as_status_for_data_requests
  • Loading branch information
saz-im-netz committed Nov 28, 2024
2 parents 0382f57 + fa77119 commit 4526c7c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data class NonSourceableEntity(
@Column(name = "reporting_period", nullable = false)
var reportingPeriod: String,
@Column(name = "is_non_sourceable")
var isNonSourceable: Boolean,
var isNonSourceable: Boolean?,
@Column(name = "reason", nullable = true)
var reason: String,
@Column(name = "creation_time", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ interface NonSourceableDataRepository : JpaRepository<NonSourceableEntity, Strin

/**
* Searches for non-sourceable data entries based on a filter defined in NonSourceableDataSearchFilter.
* The filtering parameters are companyId, dataType, reportingPeriod, and nonSourceable.
* The filtering parameters are companyId, dataType, reportingPeriod, and isNonSourceable.
*
* If a filter for companyId, dataType, or reportingPeriod is set (non-null or non-empty),
* only entries matching the criteria will be returned. If the filter is not set, this criterion is ignored.
* The nonSourceable filter allows filtering for entries where the `nonSourceable` field is either `true` or `false`.
* If the filter is not set (null), no filtering is applied on the `nonSourceable` field.
* The query is designed to return results matching all specified criteria. If no entries match the criteria, an empty list is returned.
*
* @param searchFilter The set of filtering criteria encapsulated in a NonSourceableDataSearchFilter object.
Expand All @@ -49,8 +47,8 @@ interface NonSourceableDataRepository : JpaRepository<NonSourceableEntity, Strin
"OR nonSourceableData.dataType = :#{#searchFilter.preparedDataType}) AND " +
"(:#{#searchFilter.shouldFilterByReportingPeriod} = false " +
"OR nonSourceableData.reportingPeriod = :#{#searchFilter.preparedReportingPeriod}) AND " +
"(:#{#searchFilter.shouldFilterByNonSourceable} = false " +
"OR nonSourceableData.isNonSourceable = :#{#searchFilter.preparedNonSourceable}) " +
"(:#{#searchFilter.shouldFilterByIsNonSourceable} = false " +
"OR nonSourceableData.isNonSourceable = :#{#searchFilter.preparedIsNonSourceable}) " +
"ORDER BY nonSourceableData.creationTime DESC",
)
fun searchNonSourceableData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ data class NonSourceableDataSearchFilter(
val shouldFilterByDataType: Boolean
get() = dataType != null

val preparedDataType: String
get() = dataType?.name ?: ""
val preparedDataType: DataType?
get() = dataType

val shouldFilterByReportingPeriod: Boolean
get() = !reportingPeriod.isNullOrEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class NonSourceableDataManager(
fun createEventDatasetNonSourceable(nonSourceableInfo: NonSourceableInfo) {
val correlationId = generateCorrelationId(nonSourceableInfo.companyId, null)

storeNonSourceableData(nonSourceableInfo)
cloudEventMessageHandler.buildCEMessageAndSendToQueue(
body = objectMapper.writeValueAsString(nonSourceableInfo),
type = MessageType.DATA_NONSOURCEABLE,
Expand Down

0 comments on commit 4526c7c

Please sign in to comment.