Skip to content

Commit

Permalink
#254 Include attachment information in artifact sent to cortex
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jul 27, 2017
1 parent f2c296b commit bb019ba
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import connectors.cortex.models._
import models.Artifact
import org.elastic4play.controllers.Fields
import org.elastic4play.services._
import org.elastic4play.services.JsonFormat.attachmentFormat
import org.elastic4play.{ InternalError, NotFoundError }
import play.api.libs.json.{ JsObject, Json }
import play.api.libs.ws.WSClient
Expand Down Expand Up @@ -257,7 +258,7 @@ class CortexSrv @Inject() (
"dataType" artifact.dataType())
cortexArtifact = (artifact.data(), artifact.attachment()) match {
case (Some(data), None) DataArtifact(data, artifactAttributes)
case (None, Some(attachment)) FileArtifact(attachmentSrv.source(attachment.id), artifactAttributes)
case (None, Some(attachment)) FileArtifact(attachmentSrv.source(attachment.id), artifactAttributes + ("attachment" Json.toJson(attachment)))
case _ throw InternalError(s"Artifact has invalid data : ${artifact.attributes}")
}
cortexJobJson cortex.analyze(analyzerId, cortexArtifact)
Expand Down

0 comments on commit bb019ba

Please sign in to comment.