uk.gov.hmrc.play.fsm

# JourneyController

###
Related Doc: package fsm

#### trait JourneyController[RequestContext] extends AnyRef

Controller mixin for journeys implementing Finite State Machine.

Provides 3 main extension points:

- getCallFor: what is the endpoint representing given state
- renderState: how to render given state
- context: custom request context to carry over to the service layer

and actions DSL

Linear Supertypes
AnyRef, Any
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. JourneyController
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Type Members

1. #### sealed trait Executable extends AnyRef

   Interface of Action building components

2. #### type ExpectedStates = PartialFunction[State, Unit]

3. #### type Route = (Request[_]) ⇒ Result

4. #### type RouteFactory = (StateAndBreadcrumbs) ⇒ Route

5. #### type WithAuthorised[User] = (Request[_]) ⇒ ((User) ⇒ Future[Result]) ⇒ Future[Result]

### Abstract Value Members

1. #### abstract def context(implicit rh: RequestHeader): RequestContext

   implement to provide customized request context you require in the service layer *

2. #### abstract def getCallFor(state: State)(implicit request: Request[_]): Call

   implement to map states into endpoints for redirection and back linking

3. #### abstract val journeyService: JourneyService[RequestContext]

   This has to be injected in the concrete controller

4. #### abstract def renderState(state: State, breadcrumbs: Breadcrumbs, formWithErrors: Option[Form[_]])(implicit request: Request[_]): Result

   implement to render state after transition or when form validation fails

### Concrete Value Members

1. #### final def !=(arg0: Any): Boolean

   Definition Classes
     AnyRef → Any

2. #### final def ##(): Int

   Definition Classes
     AnyRef → Any

3. #### final def ==(arg0: Any): Boolean

   Definition Classes
     AnyRef → Any

4. #### final def action(body: (Request[_]) ⇒ Future[Result])(implicit ec: ExecutionContext): Action[AnyContent]

   action for a given async result function

   action for a given async result function

   Attributes
     protected

5. #### final def actionShowState(expectedStates: ExpectedStates)(implicit ec: ExecutionContext): Action[AnyContent]

   action rendering current state or rewinding to the previous state matching expectation

   action rendering current state or rewinding to the previous state matching expectation

   Attributes
     protected

6. #### final def actionShowStateWhenAuthorised[User](withAuthorised: WithAuthorised[User])(expectedStates: ExpectedStates)(implicit ec: ExecutionContext): Action[AnyContent]

   action rendering current state or rewinding to the previous state matching expectation

   action rendering current state or rewinding to the previous state matching expectation

   Attributes
     protected

7. #### object actions

   Collection of DSL-style action builders

8. #### final def apply(transition: Transition, routeFactory: RouteFactory)(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

   applies transition to the current state

   applies transition to the current state

   Attributes
     protected

9. #### final def asInstanceOf[T0]: T0

   Definition Classes
     Any

10. #### def backLinkFor(breadcrumbs: Breadcrumbs)(implicit request: Request[_]): Call

    gets call to the previous state

    gets call to the previous state

    Attributes
      protected

11. #### final def bindForm[T](form: Form[T], transition: (T) ⇒ Transition)(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    binds form and applies transition parametrized by its outcome if success, otherwise redirects to the current state with form errors in flash scope

    binds form and applies transition parametrized by its outcome if success, otherwise redirects to the current state with form errors in flash scope

    Attributes
      protected

12. #### implicit def build(executable: Executable)(implicit ec: ExecutionContext): Action[AnyContent]

    Attributes
      protected

13. #### def clone(): AnyRef

    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

14. #### val display: RouteFactory

    displays template for the state and breadcrumbs, eventually override to change details

15. #### final def eq(arg0: AnyRef): Boolean

    Definition Classes
      AnyRef

16. #### def equals(arg0: Any): Boolean

    Definition Classes
      AnyRef → Any

17. #### def finalize(): Unit

    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )

18. #### final def getClass(): Class[_]

    Definition Classes
      AnyRef → Any

19. #### final def hasState(filter: PartialFunction[State, Unit], stateAndBreadcrumbs: StateAndBreadcrumbs): Boolean

    checks if some expected state can be found in journey history (breadcrumbs)

    checks if some expected state can be found in journey history (breadcrumbs)

    Attributes
      protected
    Annotations
      @tailrec()

20. #### def hashCode(): Int

    Definition Classes
      AnyRef → Any

21. #### final def isInstanceOf[T0]: Boolean

    Definition Classes
      Any

22. #### final def ne(arg0: AnyRef): Boolean

    Definition Classes
      AnyRef

23. #### final def notify(): Unit

    Definition Classes
      AnyRef

24. #### final def notifyAll(): Unit

    Definition Classes
      AnyRef

25. #### val redirect: RouteFactory

    redirects to the endpoint matching state, eventually override to change details

26. #### final def rewindTo(expectedState: PartialFunction[State, Unit])(stateAndBreadcrumbsOpt: Option[StateAndBreadcrumbs])(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    rewinds journey state and history (breadcrumbs) back to the latest expected state

    rewinds journey state and history (breadcrumbs) back to the latest expected state

    Attributes
      protected

27. #### final def showState(expectedStates: ExpectedStates)(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    renders current state or rewinds to the previous state matching expectation

    renders current state or rewinds to the previous state matching expectation

    Attributes
      protected

28. #### final def showStateOrApply(expectedStates: ExpectedStates)(transition: Transition)(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    renders current state or applies transition

    renders current state or applies transition

    Attributes
      protected

29. #### final def showStateUsingMerge[S <: State](expectedStates: ExpectedStates)(merge: Merger[S])(implicit arg0: ClassTag[S], rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    renders current state or rewinds to the previous state matching expectation

    renders current state or rewinds to the previous state matching expectation

    Attributes
      protected

30. #### final def showStateWhenAuthorised[User](withAuthorised: WithAuthorised[User])(expectedStates: ExpectedStates)(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    when user authorized then render current state or rewinds to the previous state matching expectation

    when user authorized then render current state or rewinds to the previous state matching expectation

    Attributes
      protected

31. #### final def showStateWhenAuthorisedUsingMerge[User, S <: State](withAuthorised: WithAuthorised[User])(expectedStates: ExpectedStates)(merge: Merger[S])(implicit arg0: ClassTag[S], rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    Attributes
      protected

32. #### final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
      AnyRef

33. #### def toString(): String

    Definition Classes
      AnyRef → Any

34. #### final def wait(): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

35. #### final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

36. #### final def wait(arg0: Long): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

37. #### final def whenAuthorised[User](withAuthorised: WithAuthorised[User])(transition: (User) ⇒ Transition)(routeFactory: RouteFactory)(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    applies transition parametrized by an authorised user

    applies transition parametrized by an authorised user

    Attributes
      protected

38. #### final def whenAuthorisedWithBootstrapAndForm[User, Payload, T](bootstrap: Transition)(withAuthorised: WithAuthorised[User])(form: Form[Payload])(transition: (User) ⇒ (Payload) ⇒ Transition)(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    applies 2 transitions in order: - first transition as provided - second transition parametrized by an authorised user and form output

    applies 2 transitions in order: - first transition as provided - second transition parametrized by an authorised user and form output

    Attributes
      protected

39. #### final def whenAuthorisedWithForm[User, Payload](withAuthorised: WithAuthorised[User])(form: Form[Payload])(transition: (User) ⇒ (Payload) ⇒ Transition)(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    applies transition parametrized by an authorised user and form output

    applies transition parametrized by an authorised user and form output

    Attributes
      protected

40. #### def withValidRequest(body: ⇒ Future[Result])(implicit rc: RequestContext, request: Request[_], ec: ExecutionContext): Future[Result]

    interceptor: override to do basic checks on every incoming request (headers, session, etc.)

### Inherited from AnyRef

### Inherited from Any

### Ungrouped