diff --git a/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/ReportManager.kt b/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/ReportManager.kt index d8e68690..0f166c1b 100644 --- a/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/ReportManager.kt +++ b/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/ReportManager.kt @@ -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 @@ -76,6 +77,7 @@ class ReportManager: KoinComponent { content: Any?, jurisdiction: String?, senderId:String?, + dataProducerId:String?, dispositionType: DispositionType, source: Source ): String { @@ -93,6 +95,7 @@ class ReportManager: KoinComponent { content, jurisdiction, senderId, + dataProducerId, dispositionType, source ) @@ -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 @@ -132,6 +136,7 @@ class ReportManager: KoinComponent { content: Any?, jurisdiction: String?, senderId:String?, + dataProducerId:String?, dispositionType: DispositionType, source: Source): String { @@ -173,6 +178,7 @@ class ReportManager: KoinComponent { content, jurisdiction, senderId, + dataProducerId, source ) } @@ -191,6 +197,7 @@ class ReportManager: KoinComponent { content, jurisdiction, senderId, + dataProducerId, source ) } @@ -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 @@ -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 { @@ -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") { @@ -272,6 +280,7 @@ class ReportManager: KoinComponent { * @param content String * @param jurisdiction String? * @param senderId String? + * @param dataProducerId String? * @return String * @throws BadStateException */ @@ -290,6 +299,7 @@ class ReportManager: KoinComponent { content: Any?, jurisdiction: String?, senderId:String?, + dataProducerId: String?, deadLetterReasons: List, validationSchemaFileNames:List ): String { @@ -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 diff --git a/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/Report.kt b/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/Report.kt index 1c8617aa..d7196c6b 100644 --- a/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/Report.kt +++ b/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/Report.kt @@ -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 @@ -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() diff --git a/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/CreateReportSBMessage.kt b/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/CreateReportSBMessage.kt index fad4bbad..1a4ef830 100644 --- a/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/CreateReportSBMessage.kt +++ b/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/CreateReportSBMessage.kt @@ -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 diff --git a/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/plugins/ServiceBusProcessor.kt b/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/plugins/ServiceBusProcessor.kt index 4753125b..78997096 100644 --- a/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/plugins/ServiceBusProcessor.kt +++ b/pstatus-report-sink-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/plugins/ServiceBusProcessor.kt @@ -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 ) @@ -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() @@ -327,6 +328,7 @@ class ServiceBusProcessor { createReportMessage.content, createReportMessage.jurisdiction, createReportMessage.senderId, + createReportMessage.dataProducerId, invalidData, validationSchemaFileNames )