diff options
author | Aleksandr <ognelisar@gmail.com> | 2017-11-14 18:38:26 +0700 |
---|---|---|
committer | Aleksandr <ognelisar@gmail.com> | 2017-11-14 18:38:26 +0700 |
commit | aa7f7297daf13c6a31578959299484dc4be4ccc7 (patch) | |
tree | 06fcb7fd4f911607c0732a1cc5e7a0382ad5a249 /src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala | |
parent | 1bb4b39dc9f407238307a121b2846ca79e3636e7 (diff) | |
download | rest-query-aa7f7297daf13c6a31578959299484dc4be4ccc7.tar.gz rest-query-aa7f7297daf13c6a31578959299484dc4be4ccc7.tar.bz2 rest-query-aa7f7297daf13c6a31578959299484dc4be4ccc7.zip |
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala index f08f3de..bdbdc93 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala @@ -8,8 +8,6 @@ import xyz.driver.pdsuicommon.logging._ import xyz.driver.pdsuicommon.utils.Utils import xyz.driver.pdsuidomain.entities.MedicalRecordHistory._ -import scala.collection.immutable - object MedicalRecordHistory { implicit def toPhiString(x: MedicalRecordHistory): PhiString = { @@ -27,11 +25,7 @@ object MedicalRecordHistory { case object Review extends State case object Flag extends State - private implicit def stateToName(state: State): (State, String) = { - state -> state.toString - } - - private val stateToName = immutable.Map[State, String]( + val All: Set[State] = Set( State.New, State.Clean, State.Organize, @@ -39,7 +33,8 @@ object MedicalRecordHistory { State.Flag ) - val All: Set[State] = stateToName.keySet + private val stateToName: Map[State, String] = + All.map(s => s -> s.toString).toMap val fromString: PartialFunction[String, State] = for ((k, v) <- stateToName) yield (v, k) @@ -73,11 +68,7 @@ object MedicalRecordHistory { case object CreatedRecord extends Action case object ReadRecord extends Action - private implicit def stateToName(action: Action): (Action, String) = { - action -> action.toString - } - - private val actionToName = immutable.Map[Action, String]( + val All: Set[Action] = Set( Action.Start, Action.Submit, Action.Unassign, @@ -96,11 +87,12 @@ object MedicalRecordHistory { Action.ReadRecord ) + private val actionToName: Map[Action, String] = + All.map(a => a -> a.toString).toMap + val fromString: PartialFunction[String, Action] = for ((k, v) <- actionToName) yield (v, k) - val All: Set[Action] = actionToName.keySet - def actionToString: Action => String = actionToName implicit def toPhiString(x: Action): PhiString = |