diff options
author | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 16:31:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-10 16:31:00 -0700 |
commit | 385a9a99e5a95c3d623cddd927c37564e32dbd2d (patch) | |
tree | 0671a39174899dce09ade3c571ef21bab6172e0e /src/main/scala/xyz/driver/pdsuidomain/formats/json/label | |
parent | 0653b90dddc294fddb0e81059aef00b202113d78 (diff) | |
parent | 9c95eb7247cb0818af9a9e4afe884698360f994c (diff) | |
download | rest-query-385a9a99e5a95c3d623cddd927c37564e32dbd2d.tar.gz rest-query-385a9a99e5a95c3d623cddd927c37564e32dbd2d.tar.bz2 rest-query-385a9a99e5a95c3d623cddd927c37564e32dbd2d.zip |
Merge pull request #35 from drivergroup/trial-46-disease-entity
Trial 46 disease entity
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/label')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala | 6 | ||||
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala index d486749..edb0603 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiCriterionLabel.scala @@ -1,11 +1,11 @@ package xyz.driver.pdsuidomain.formats.json.label -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId} +import xyz.driver.pdsuicommon.domain.LongId import xyz.driver.pdsuidomain.entities.{Criterion, CriterionLabel} import play.api.data.validation.ValidationError import play.api.libs.functional.syntax._ import play.api.libs.json._ -import xyz.driver.entities.labels.{Label, LabelCategory} +import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue} /** * @param value Yes|No @@ -34,7 +34,7 @@ object ApiCriterionLabel { labelId = x.labelId.map(_.id), categoryId = x.categoryId.map(_.id), value = x.value.map { x => - FuzzyValue.valueToString(FuzzyValue.fromBoolean(x)) + LabelValue.fromBoolean(x).toString }, isDefining = x.isDefining ) diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala index f8161af..1497679 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/label/ApiExtractedDataLabel.scala @@ -1,11 +1,11 @@ package xyz.driver.pdsuidomain.formats.json.label -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId} +import xyz.driver.pdsuicommon.domain.LongId import xyz.driver.pdsuidomain.entities.{ExtractedData, ExtractedDataLabel} import play.api.data.validation.ValidationError import play.api.libs.functional.syntax._ import play.api.libs.json._ -import xyz.driver.entities.labels.{Label, LabelCategory} +import xyz.driver.entities.labels.{Label, LabelCategory, LabelValue} final case class ApiExtractedDataLabel(id: Option[Long], categoryId: Option[Long], value: Option[String]) { @@ -14,7 +14,7 @@ final case class ApiExtractedDataLabel(id: Option[Long], categoryId: Option[Long dataId = dataId, labelId = id.map(LongId[Label]), categoryId = categoryId.map(LongId[LabelCategory]), - value = value.map(FuzzyValue.fromString) + value = value.flatMap(LabelValue.fromString) ) } @@ -27,8 +27,8 @@ object ApiExtractedDataLabel { Format(Reads .of[String] .filter(ValidationError("unknown value"))({ - case x if FuzzyValue.fromString.isDefinedAt(x) => true - case _ => false + case x if LabelValue.fromString(x).isDefined => true + case _ => false }), Writes.of[String])) )(ApiExtractedDataLabel.apply, unlift(ApiExtractedDataLabel.unapply)) @@ -36,6 +36,6 @@ object ApiExtractedDataLabel { def fromDomain(dataLabel: ExtractedDataLabel) = ApiExtractedDataLabel( id = dataLabel.labelId.map(_.id), categoryId = dataLabel.categoryId.map(_.id), - value = dataLabel.value.map(FuzzyValue.valueToString) + value = dataLabel.value.map(_.toString) ) } |