diff --git a/ScalliGraph b/ScalliGraph index 7eace99b4d..0aae9f429e 160000 --- a/ScalliGraph +++ b/ScalliGraph @@ -1 +1 @@ -Subproject commit 7eace99b4d7bd6605afff82c9fb7cd316a04abaf +Subproject commit 0aae9f429e6bb0b493b445d183ad9eaf431867d9 diff --git a/thehive/app/org/thp/thehive/services/IntegrityCheckSerializer.scala b/thehive/app/org/thp/thehive/services/IntegrityCheckSerializer.scala index 1e9cfb7114..23b62e3369 100644 --- a/thehive/app/org/thp/thehive/services/IntegrityCheckSerializer.scala +++ b/thehive/app/org/thp/thehive/services/IntegrityCheckSerializer.scala @@ -1,6 +1,7 @@ package org.thp.thehive.services import akka.serialization.Serializer +import play.api.libs.json.{Json, OFormat} import java.io.NotSerializableException @@ -9,12 +10,19 @@ class IntegrityCheckSerializer extends Serializer { override def includeManifest: Boolean = false + implicit val duplicationCheckResultFormat: OFormat[DuplicationCheckResult] = Json.format[DuplicationCheckResult] + implicit val globalCheckResultFormat: OFormat[GlobalCheckResult] = Json.format[GlobalCheckResult] + override def toBinary(o: AnyRef): Array[Byte] = o match { - case EntityAdded(name) => 0.toByte +: name.getBytes - case NeedCheck(name) => 1.toByte +: name.getBytes - case DuplicationCheck(name) => 2.toByte +: name.getBytes - case _ => throw new NotSerializableException + case EntityAdded(name) => 0.toByte +: name.getBytes + case NeedCheck(name) => 1.toByte +: name.getBytes + case DuplicationCheck(name) => 2.toByte +: name.getBytes + case duplicationCheckResult: DuplicationCheckResult => 3.toByte +: Json.toJson(duplicationCheckResult).toString.getBytes + case GlobalCheckRequest(name) => 4.toByte +: name.getBytes + case globalCheckResult: GlobalCheckResult => 5.toByte +: Json.toJson(globalCheckResult).toString.getBytes + case GetCheckStats(name) => 6.toByte +: name.getBytes + case _ => throw new NotSerializableException } override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = @@ -22,6 +30,10 @@ class IntegrityCheckSerializer extends Serializer { case 0 => EntityAdded(new String(bytes.tail)) case 1 => NeedCheck(new String(bytes.tail)) case 2 => DuplicationCheck(new String(bytes.tail)) + case 3 => Json.parse(bytes.tail).as[DuplicationCheckResult] + case 4 => GlobalCheckRequest(new String(bytes.tail)) + case 5 => Json.parse(bytes.tail).as[GlobalCheckResult] + case 6 => GetCheckStats(new String(bytes.tail)) case _ => throw new NotSerializableException } }