diff --git a/thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala b/thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala index 3160db8278..0166f69f8f 100644 --- a/thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala +++ b/thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala @@ -277,7 +277,7 @@ class CaseTemplateIntegrityCheckOps @Inject() ( override def resolve(entities: List[CaseTemplate with Entity])(implicit graph: Graph): Try[Unit] = entities match { case head :: tail => tail.foreach(copyEdge(_, head, e => e.label() == "CaseCaseTemplate" || e.label() == "AlertCaseTemplate")) - tail.foreach(service.get(_).remove()) + service.getByIds(tail.map(_._id): _*).remove() Success(()) case _ => Success(()) } diff --git a/thehive/app/org/thp/thehive/services/CustomFieldSrv.scala b/thehive/app/org/thp/thehive/services/CustomFieldSrv.scala index 4adb6fe96b..bc433afeb1 100644 --- a/thehive/app/org/thp/thehive/services/CustomFieldSrv.scala +++ b/thehive/app/org/thp/thehive/services/CustomFieldSrv.scala @@ -190,7 +190,7 @@ class CustomFieldIntegrityCheckOps @Inject() (@Named("with-thehive-schema") val override def resolve(entities: List[CustomField with Entity])(implicit graph: Graph): Try[Unit] = entities match { case head :: tail => tail.foreach(copyEdge(_, head)) - tail.foreach(service.get(_).remove()) + service.getByIds(tail.map(_._id): _*).remove() Success(()) case _ => Success(()) } diff --git a/thehive/app/org/thp/thehive/services/DataSrv.scala b/thehive/app/org/thp/thehive/services/DataSrv.scala index 6775cc32c2..f3854a2fde 100644 --- a/thehive/app/org/thp/thehive/services/DataSrv.scala +++ b/thehive/app/org/thp/thehive/services/DataSrv.scala @@ -64,7 +64,7 @@ class DataIntegrityCheckOps @Inject() (@Named("with-thehive-schema") val db: Dat override def resolve(entities: List[Data with Entity])(implicit graph: Graph): Try[Unit] = entities match { case head :: tail => tail.foreach(copyEdge(_, head)) - tail.foreach(service.get(_).remove()) + service.getByIds(tail.map(_._id): _*).remove() Success(()) case _ => Success(()) } diff --git a/thehive/app/org/thp/thehive/services/ImpactStatusSrv.scala b/thehive/app/org/thp/thehive/services/ImpactStatusSrv.scala index 5fad55ce4a..331f44978b 100644 --- a/thehive/app/org/thp/thehive/services/ImpactStatusSrv.scala +++ b/thehive/app/org/thp/thehive/services/ImpactStatusSrv.scala @@ -56,7 +56,7 @@ class ImpactStatusIntegrityCheckOps @Inject() (@Named("with-thehive-schema") val override def resolve(entities: List[ImpactStatus with Entity])(implicit graph: Graph): Try[Unit] = entities match { case head :: tail => tail.foreach(copyEdge(_, head)) - tail.foreach(service.get(_).remove()) + service.getByIds(tail.map(_._id): _*).remove() Success(()) case _ => Success(()) } diff --git a/thehive/app/org/thp/thehive/services/ObservableTypeSrv.scala b/thehive/app/org/thp/thehive/services/ObservableTypeSrv.scala index 7762f572e6..cbe4fefb24 100644 --- a/thehive/app/org/thp/thehive/services/ObservableTypeSrv.scala +++ b/thehive/app/org/thp/thehive/services/ObservableTypeSrv.scala @@ -65,7 +65,7 @@ class ObservableTypeIntegrityCheckOps @Inject() (@Named("with-thehive-schema") v override def resolve(entities: List[ObservableType with Entity])(implicit graph: Graph): Try[Unit] = entities match { case head :: tail => tail.foreach(copyEdge(_, head)) - tail.foreach(service.get(_).remove()) + service.getByIds(tail.map(_._id): _*).remove() Success(()) case _ => Success(()) } diff --git a/thehive/app/org/thp/thehive/services/OrganisationSrv.scala b/thehive/app/org/thp/thehive/services/OrganisationSrv.scala index 79fc551d0a..48cb63af6e 100644 --- a/thehive/app/org/thp/thehive/services/OrganisationSrv.scala +++ b/thehive/app/org/thp/thehive/services/OrganisationSrv.scala @@ -200,7 +200,7 @@ class OrganisationIntegrityCheckOps @Inject() (@Named("with-thehive-schema") val override def resolve(entities: List[Organisation with Entity])(implicit graph: Graph): Try[Unit] = entities match { case head :: tail => tail.foreach(copyEdge(_, head)) - tail.foreach(service.get(_).remove()) + service.getByIds(tail.map(_._id): _*).remove() Success(()) case _ => Success(()) } diff --git a/thehive/app/org/thp/thehive/services/ProfileSrv.scala b/thehive/app/org/thp/thehive/services/ProfileSrv.scala index f6a3818c65..39367b2f73 100644 --- a/thehive/app/org/thp/thehive/services/ProfileSrv.scala +++ b/thehive/app/org/thp/thehive/services/ProfileSrv.scala @@ -90,7 +90,7 @@ class ProfileIntegrityCheckOps @Inject() (@Named("with-thehive-schema") val db: override def resolve(entities: List[Profile with Entity])(implicit graph: Graph): Try[Unit] = entities match { case head :: tail => tail.foreach(copyEdge(_, head)) - tail.foreach(service.get(_).remove()) + service.getByIds(tail.map(_._id): _*).remove() Success(()) case _ => Success(()) } diff --git a/thehive/app/org/thp/thehive/services/ResolutionStatusSrv.scala b/thehive/app/org/thp/thehive/services/ResolutionStatusSrv.scala index 64ee2eea13..243fac9956 100644 --- a/thehive/app/org/thp/thehive/services/ResolutionStatusSrv.scala +++ b/thehive/app/org/thp/thehive/services/ResolutionStatusSrv.scala @@ -58,7 +58,7 @@ class ResolutionStatusIntegrityCheckOps @Inject() (@Named("with-thehive-schema") override def resolve(entities: List[ResolutionStatus with Entity])(implicit graph: Graph): Try[Unit] = entities match { case head :: tail => tail.foreach(copyEdge(_, head)) - tail.foreach(service.get(_).remove()) + service.getByIds(tail.map(_._id): _*).remove() Success(()) case _ => Success(()) }