Skip to content

Commit

Permalink
Update response
Browse files Browse the repository at this point in the history
  • Loading branch information
Annie Lee committed Mar 30, 2022
1 parent a18252a commit 088811b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package org.opensearch.alerting.action

import org.opensearch.action.ActionResponse
import org.opensearch.alerting.model.Finding
import org.opensearch.alerting.model.FindingWithDocs
import org.opensearch.common.io.stream.StreamInput
import org.opensearch.common.io.stream.StreamOutput
import org.opensearch.common.xcontent.ToXContent
Expand All @@ -18,12 +18,12 @@ import java.io.IOException
class GetFindingsSearchResponse : ActionResponse, ToXContentObject {
var status: RestStatus
var totalFindings: Int?
var findings: List<Finding>
var findings: List<FindingWithDocs>

constructor(
status: RestStatus,
totalFindings: Int?,
findings: List<Finding>
findings: List<FindingWithDocs>
) : super() {
this.status = status
this.totalFindings = totalFindings
Expand All @@ -33,11 +33,11 @@ class GetFindingsSearchResponse : ActionResponse, ToXContentObject {
@Throws(IOException::class)
constructor(sin: StreamInput) {
this.status = sin.readEnum(RestStatus::class.java)
val findings = mutableListOf<Finding>()
val findings = mutableListOf<FindingWithDocs>()
this.totalFindings = sin.readOptionalInt()
var currentSize = sin.readInt()
for (i in 0 until currentSize) {
findings.add(Finding.readFrom(sin))
findings.add(FindingWithDocs.readFrom(sin))
}
this.findings = findings
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class TransportGetFindingsSearchAction @Inject constructor(
// TODO: remove debug log
log.info("findingWithDoc: $findingWithDoc")
}
actionListener.onResponse(GetFindingsSearchResponse(RestStatus.OK, totalFindingCount, findings))
actionListener.onResponse(GetFindingsSearchResponse(RestStatus.OK, totalFindingCount, findingsWithDocs))
}

override fun onFailure(t: Exception) {
Expand Down

0 comments on commit 088811b

Please sign in to comment.