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 | |
parent | 1bb4b39dc9f407238307a121b2846ca79e3636e7 (diff) | |
download | rest-query-0.14.10.tar.gz rest-query-0.14.10.tar.bz2 rest-query-0.14.10.zip |
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/entities/DocumentHistory.scala | 20 | ||||
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/entities/MedicalRecordHistory.scala | 22 |
2 files changed, 13 insertions, 29 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentHistory.scala index 5c96f94..089658e 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentHistory.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/entities/DocumentHistory.scala @@ -8,8 +8,6 @@ import xyz.driver.pdsuicommon.logging._ import xyz.driver.pdsuicommon.utils.Utils import xyz.driver.pdsuidomain.entities.DocumentHistory.{Action, _} -import scala.collection.immutable - object DocumentHistory { implicit def toPhiString(x: DocumentHistory): PhiString = { @@ -25,18 +23,15 @@ object DocumentHistory { case object Flag extends State case object New 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.Extract, State.Review, State.Flag, State.New ) - 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) @@ -66,11 +61,7 @@ object DocumentHistory { case object CreatedDocument extends Action case object ReadDocument 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, @@ -82,7 +73,8 @@ object DocumentHistory { Action.ReadDocument ) - val All: Set[Action] = actionToName.keySet + 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) 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 = |