Skip to content

Commit

Permalink
Fixed issue of Reports and RDLQ not using data_producer_id
Browse files Browse the repository at this point in the history
  • Loading branch information
manu-govind committed Aug 29, 2024
1 parent 3954206 commit 6c29e66
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class ReportManager: KoinComponent {
* @param content Any?
* @param jurisdiction String?
* @param senderId String?
* @param dataProducerId String?
* @param dispositionType DispositionType
* @param source Source
* @return String
Expand All @@ -76,6 +77,7 @@ class ReportManager: KoinComponent {
content: Any?,
jurisdiction: String?,
senderId:String?,
dataProducerId:String?,
dispositionType: DispositionType,
source: Source
): String {
Expand All @@ -93,6 +95,7 @@ class ReportManager: KoinComponent {
content,
jurisdiction,
senderId,
dataProducerId,
dispositionType,
source
)
Expand All @@ -116,6 +119,7 @@ class ReportManager: KoinComponent {
* @param content Any?
* @param jurisdiction String?
* @param senderId String?
* @param dataProducerId String?
* @param dispositionType DispositionType - indicates whether to add or replace any existing reports for the given stageName.
* @param source Source
* @return String - report identifier
Expand All @@ -132,6 +136,7 @@ class ReportManager: KoinComponent {
content: Any?,
jurisdiction: String?,
senderId:String?,
dataProducerId:String?,
dispositionType: DispositionType,
source: Source): String {

Expand Down Expand Up @@ -173,6 +178,7 @@ class ReportManager: KoinComponent {
content,
jurisdiction,
senderId,
dataProducerId,
source
)
}
Expand All @@ -191,6 +197,7 @@ class ReportManager: KoinComponent {
content,
jurisdiction,
senderId,
dataProducerId,
source
)
}
Expand All @@ -212,6 +219,7 @@ class ReportManager: KoinComponent {
* @param content Any?
* @param jurisdiction String?
* @param senderId String?
* @param dataProducerId String?
* @param source Source
* @return String
* @throws BadStateException
Expand All @@ -229,6 +237,7 @@ class ReportManager: KoinComponent {
content: Any?,
jurisdiction: String?,
senderId:String?,
dataProducerId:String?,
source: Source): String {
val stageReportId = UUID.randomUUID().toString()
val stageReport = Report().apply {
Expand All @@ -239,13 +248,12 @@ class ReportManager: KoinComponent {
this.dataStreamRoute = dataStreamRoute
this.dexIngestDateTime = dexIngestDateTime
this.jurisdiction = jurisdiction
this.senderId = senderId
this.messageMetadata = messageMetadata
this.stageInfo= stageInfo
this.tags = tags
this.data = data
this.jurisdiction = jurisdiction
this.senderId = senderId
this.dataProducerId=dataProducerId
this.contentType = contentType

if (contentType.lowercase() == "json") {
Expand All @@ -272,6 +280,7 @@ class ReportManager: KoinComponent {
* @param content String
* @param jurisdiction String?
* @param senderId String?
* @param dataProducerId String?
* @return String
* @throws BadStateException
*/
Expand All @@ -290,6 +299,7 @@ class ReportManager: KoinComponent {
content: Any?,
jurisdiction: String?,
senderId:String?,
dataProducerId: String?,
deadLetterReasons: List<String>,
validationSchemaFileNames:List<String>
): String {
Expand All @@ -304,12 +314,14 @@ class ReportManager: KoinComponent {
this.dexIngestDateTime = dexIngestDateTime
this.jurisdiction= jurisdiction
this.senderId= senderId
this.dataProducerId= dataProducerId
this.messageMetadata= messageMetadata
this.stageInfo= stageInfo
this.tags= tags
this.data= data
this.jurisdiction= jurisdiction
this.senderId= senderId
this.dataProducerId= dataProducerId
this.dispositionType= dispositionType.toString()
this.contentType = contentType
this.deadLetterReasons= deadLetterReasons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import java.util.*
* @property contentType String?
* @property jurisdiction String?
* @property senderId String?
* @property dataProducerId String?
* @property content Any?
* @property timestamp Date
* @constructor
Expand Down Expand Up @@ -66,6 +67,9 @@ open class Report(
@SerializedName("sender_id")
var senderId: String? = null,

@SerializedName("data_producer_id")
var dataProducerId: String? = null,

var content: Any? = null,

val timestamp: Date = Date()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class CreateReportSBMessage: ServiceBusMessage() {
@SerializedName("sender_id")
var senderId: String? = null

@SerializedName("data_producer_id")
var dataProducerId: String? = null

@SerializedName("content_type")
var contentType: String? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class ServiceBusProcessor {
createReportMessage.content!!, // it was Content I changed to ContentAsString
createReportMessage.jurisdiction,
createReportMessage.senderId,
createReportMessage.dataProducerId,
createReportMessage.dispositionType,
Source.SERVICEBUS
)
Expand Down Expand Up @@ -286,7 +287,7 @@ class ServiceBusProcessor {

jurisdiction = runCatching { jsonNode.get("jurisdiction") }.getOrNull()?.asText()
senderId = runCatching { jsonNode.get("sender_id") }.getOrNull()?.asText()

dataProducerId = runCatching { jsonNode.get("data_producer_id") }.getOrNull()?.asText()
contentType = runCatching { jsonNode.get("content_type") }.getOrNull()?.asText()
// Try to get the content as JSON object, but if not, get it as a string
val contentAsNode = runCatching { jsonNode.get("content") }.getOrNull()
Expand Down Expand Up @@ -327,6 +328,7 @@ class ServiceBusProcessor {
createReportMessage.content,
createReportMessage.jurisdiction,
createReportMessage.senderId,
createReportMessage.dataProducerId,
invalidData,
validationSchemaFileNames
)
Expand Down

0 comments on commit 6c29e66

Please sign in to comment.