From 54b15dae509212f6661dc1f1bc4ca248cb487443 Mon Sep 17 00:00:00 2001 From: Kseniya Tomskikh Date: Fri, 20 Oct 2017 16:25:04 +0700 Subject: PDSUI-2336 Deleted api classes of play format, userhistory and message services --- .../formats/json/criterion/ApiCriterion.scala | 59 ---------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala') diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala deleted file mode 100644 index 239adb1..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/criterion/ApiCriterion.scala +++ /dev/null @@ -1,59 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.criterion - -import xyz.driver.pdsuicommon.json.Serialization.seqJsonFormat -import play.api.libs.functional.syntax._ -import play.api.libs.json._ -import xyz.driver.pdsuicommon.domain.{LongId, StringId} -import xyz.driver.pdsuidomain.entities.{EligibilityArm, Criterion, Trial} -import xyz.driver.pdsuidomain.formats.json.label.ApiCriterionLabel -import xyz.driver.pdsuidomain.services.CriterionService.RichCriterion - -final case class ApiCriterion(id: Long, - meta: Option[String], - arms: Seq[Long], - text: Option[String], - isCompound: Boolean, - labels: Seq[ApiCriterionLabel], - trialId: String, - inclusion: Option[Boolean]) { - - def toDomain = RichCriterion( - criterion = Criterion( - id = LongId[Criterion](id), - trialId = StringId[Trial](trialId), - text, - isCompound, - meta.getOrElse(""), - inclusion - ), - armIds = arms.map(LongId[EligibilityArm]), - labels = labels.map(_.toDomain(LongId[Criterion](id))) - ) -} - -object ApiCriterion { - - implicit val format: Format[ApiCriterion] = ( - (JsPath \ "id").format[Long] and - (JsPath \ "meta").formatNullable(Format(Reads { x => - JsSuccess(Json.stringify(x)) - }, Writes[String](Json.parse))) and - (JsPath \ "arms").format(seqJsonFormat[Long]) and - (JsPath \ "text").formatNullable[String] and - (JsPath \ "isCompound").format[Boolean] and - (JsPath \ "labels").format(seqJsonFormat[ApiCriterionLabel]) and - (JsPath \ "trialId").format[String] and - (JsPath \ "inclusion").formatNullable[Boolean] - )(ApiCriterion.apply, unlift(ApiCriterion.unapply)) - - def fromDomain(richCriterion: RichCriterion) = ApiCriterion( - id = richCriterion.criterion.id.id, - meta = Option(richCriterion.criterion.meta), - arms = richCriterion.armIds.map(_.id), - text = richCriterion.criterion.text, - isCompound = richCriterion.criterion.isCompound, - labels = richCriterion.labels.map(ApiCriterionLabel.fromDomain), - trialId = richCriterion.criterion.trialId.id, - inclusion = richCriterion.criterion.inclusion - ) -} -- cgit v1.2.3