From a997aa6539d1f0af4ab4fc395ff2033335da312a Mon Sep 17 00:00:00 2001 From: vlad Date: Fri, 30 Jun 2017 12:29:54 -0700 Subject: Latest PDS UI utils --- .../services/PatientEligibleTrialService.scala | 58 ++++++++++------------ 1 file changed, 25 insertions(+), 33 deletions(-) (limited to 'src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala') diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala index 64b4b81..d322fdd 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/services/PatientEligibleTrialService.scala @@ -23,9 +23,7 @@ object PatientEligibleTrialService { def userMessage: String = "Access denied" } - case class RichPatientEligibleTrial(trial: Trial, - group: PatientTrialArmGroupView, - arms: List[Arm]) + case class RichPatientEligibleTrial(trial: Trial, group: PatientTrialArmGroupView, arms: List[Arm]) object RichPatientEligibleTrial { implicit def toPhiString(x: RichPatientEligibleTrial): PhiString = { phi"RichPatientEligibleTrial(group=${x.group}, trial=${x.trial}, arms=${x.arms})" @@ -34,14 +32,13 @@ object PatientEligibleTrialService { sealed trait GetListReply object GetListReply { - case class EntityList(xs: Seq[RichPatientEligibleTrial], totalFound: Int) - extends GetListReply + case class EntityList(xs: Seq[RichPatientEligibleTrial], totalFound: Int) extends GetListReply case object AuthorizationError - extends GetListReply with DomainError.AuthorizationError with DefaultAccessDeniedError + extends GetListReply with DomainError.AuthorizationError with DefaultAccessDeniedError case object PatientNotFoundError - extends GetListReply with DefaultPatientNotFoundError with DomainError.NotFoundError + extends GetListReply with DefaultPatientNotFoundError with DomainError.NotFoundError case class CommonError(userMessage: String) extends GetListReply with DomainError } @@ -52,38 +49,37 @@ object PatientEligibleTrialService { type Error = GetByIdReply with DomainError - case object NotFoundError - extends GetByIdReply with DefaultNotFoundError with DomainError.NotFoundError + case object NotFoundError extends GetByIdReply with DefaultNotFoundError with DomainError.NotFoundError case object PatientNotFoundError - extends GetByIdReply with DefaultPatientNotFoundError with DomainError.NotFoundError + extends GetByIdReply with DefaultPatientNotFoundError with DomainError.NotFoundError case object AuthorizationError - extends GetByIdReply with DomainError.AuthorizationError with DefaultAccessDeniedError + extends GetByIdReply with DomainError.AuthorizationError with DefaultAccessDeniedError case class CommonError(userMessage: String) extends GetByIdReply with DomainError implicit def toPhiString(reply: GetByIdReply): PhiString = reply match { case x: DomainError => phi"GetByIdReply.Error($x)" - case Entity(x) => phi"GetByIdReply.Entity($x)" + case Entity(x) => phi"GetByIdReply.Entity($x)" } } sealed trait GetCriterionListOfGroupReply object GetCriterionListOfGroupReply { case class EntityList(xs: Seq[(PatientCriterion, LongId[Label], List[Arm], Boolean)], totalFound: Int) - extends GetCriterionListOfGroupReply + extends GetCriterionListOfGroupReply type Error = GetCriterionListOfGroupReply with DomainError case object AuthorizationError - extends GetCriterionListOfGroupReply with DomainError.AuthorizationError with DefaultAccessDeniedError + extends GetCriterionListOfGroupReply with DomainError.AuthorizationError with DefaultAccessDeniedError case object NotFoundError - extends GetCriterionListOfGroupReply with DefaultNotFoundError with DomainError.NotFoundError + extends GetCriterionListOfGroupReply with DefaultNotFoundError with DomainError.NotFoundError case object PatientNotFoundError - extends GetCriterionListOfGroupReply with DefaultPatientNotFoundError with DomainError.NotFoundError + extends GetCriterionListOfGroupReply with DefaultPatientNotFoundError with DomainError.NotFoundError case class CommonError(userMessage: String) extends GetCriterionListOfGroupReply with DomainError } @@ -94,21 +90,19 @@ object PatientEligibleTrialService { case class Updated(updated: RichPatientEligibleTrial) extends UpdateReply - case object NotFoundError - extends UpdateReply with DefaultNotFoundError with DomainError.NotFoundError + case object NotFoundError extends UpdateReply with DefaultNotFoundError with DomainError.NotFoundError case object PatientNotFoundError - extends UpdateReply with DefaultPatientNotFoundError with DomainError.NotFoundError + extends UpdateReply with DefaultPatientNotFoundError with DomainError.NotFoundError case object AuthorizationError - extends UpdateReply with DomainError.AuthorizationError with DefaultAccessDeniedError + extends UpdateReply with DomainError.AuthorizationError with DefaultAccessDeniedError - case class CommonError(userMessage: String) - extends UpdateReply with DomainError + case class CommonError(userMessage: String) extends UpdateReply with DomainError implicit def toPhiString(reply: UpdateReply): PhiString = reply match { case Updated(x) => phi"Updated($x)" - case x: Error => DomainError.toPhiString(x) + case x: Error => DomainError.toPhiString(x) } } } @@ -120,18 +114,16 @@ trait PatientEligibleTrialService { def getAll(patientId: UuidId[Patient], filter: SearchFilterExpr = SearchFilterExpr.Empty, sorting: Option[Sorting] = None, - pagination: Option[Pagination] = None) - (implicit requestContext: AuthenticatedRequestContext): Future[GetListReply] + pagination: Option[Pagination] = None)( + implicit requestContext: AuthenticatedRequestContext): Future[GetListReply] - def getById(patientId: UuidId[Patient], - id: LongId[PatientTrialArmGroup]) - (implicit requestContext: AuthenticatedRequestContext): Future[GetByIdReply] + def getById(patientId: UuidId[Patient], id: LongId[PatientTrialArmGroup])( + implicit requestContext: AuthenticatedRequestContext): Future[GetByIdReply] - def getCriterionListByGroupId(patientId: UuidId[Patient], - id: LongId[PatientTrialArmGroup]) - (implicit requestContext: AuthenticatedRequestContext): Future[GetCriterionListOfGroupReply] + def getCriterionListByGroupId(patientId: UuidId[Patient], id: LongId[PatientTrialArmGroup])( + implicit requestContext: AuthenticatedRequestContext): Future[GetCriterionListOfGroupReply] def update(origEligibleTrialWithTrial: RichPatientEligibleTrial, - draftPatientTrialArmGroup: PatientTrialArmGroupView) - (implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] + draftPatientTrialArmGroup: PatientTrialArmGroupView)( + implicit requestContext: AuthenticatedRequestContext): Future[UpdateReply] } -- cgit v1.2.3