uk.gov.hmrc.play.fsm

# JourneyController

###
Related Doc: package fsm

#### trait JourneyController extends HeaderCarrierProvider

Base controller for journeys based on Finite State Machine.

Provides 2 main extension points:

- getCallFor: what is the endpoint representing given state
- renderState: how to render given state

and action creation helpers:

- action
- actionShowState
- actionShowStateWhenAuthorised

and async result functions:

- showState
- showStateWhenAuthorised
- whenAuthorised
- whenAuthorisedWithForm
- whenAuthorisedWithBootstrapAndForm
- bindForm

Linear Supertypes
HeaderCarrierProvider, AnyRef, Any
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. JourneyController
2. HeaderCarrierProvider
3. AnyRef
4. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Type Members

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

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

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

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

### Abstract Value Members

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

   implement to map states into endpoints for redirection and back linking

2. #### abstract def hc(implicit rh: RequestHeader): HeaderCarrier

   Attributes
     protected
   Definition Classes
     HeaderCarrierProvider

3. #### abstract val journeyService: JourneyService

   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. #### def apply(transition: Transition, routeFactory: RouteFactory)(implicit hc: HeaderCarrier, request: Request[_], ec: ExecutionContext): Future[Result]

   applies transition to the current state

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

   Definition Classes
     Any

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

   gets call to the previous state

   gets call to the previous state

   Attributes
     protected

10. #### final def bindForm[T](form: Form[T], transition: (T) ⇒ Transition)(implicit hc: HeaderCarrier, 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

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

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

12. #### val display: RouteFactory

    displays template for the state and breadcrumbs

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

    Definition Classes
      AnyRef

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

    Definition Classes
      AnyRef → Any

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

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

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

    Definition Classes
      AnyRef → Any

17. #### 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()

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

    Definition Classes
      AnyRef → Any

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

    Definition Classes
      Any

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

    Definition Classes
      AnyRef

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

    Definition Classes
      AnyRef

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

    Definition Classes
      AnyRef

23. #### val redirect: RouteFactory

    redirects to the endpoint matching state

24. #### final def rewindTo(expectedState: PartialFunction[State, Unit])(stateAndBreadcrumbsOpt: Option[StateAndBreadcrumbs])(implicit hc: HeaderCarrier, 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

25. #### final def showState(expectedStates: ExpectedStates)(implicit hc: HeaderCarrier, 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

26. #### final def showStateWhenAuthorised[User](withAuthorised: WithAuthorised[User])(expectedStates: ExpectedStates)(implicit hc: HeaderCarrier, 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

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

    Definition Classes
      AnyRef

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

    Definition Classes
      AnyRef → Any

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

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

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

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

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

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

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

    applies transition parametrized by an authorised user

    applies transition parametrized by an authorised user

    Attributes
      protected

33. #### final def whenAuthorisedWithBootstrapAndForm[User, Payload, T](bootstrap: Transition)(withAuthorised: WithAuthorised[User])(form: Form[Payload])(transition: (User) ⇒ (Payload) ⇒ Transition)(implicit hc: HeaderCarrier, 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

34. #### final def whenAuthorisedWithForm[User, Payload](withAuthorised: WithAuthorised[User])(form: Form[Payload])(transition: (User) ⇒ (Payload) ⇒ Transition)(implicit hc: HeaderCarrier, 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

35. #### def withValidRequest(body: ⇒ Future[Result])(implicit hc: HeaderCarrier, request: Request[_], ec: ExecutionContext): Future[Result]

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

### Inherited from HeaderCarrierProvider

### Inherited from AnyRef

### Inherited from Any

### Ungrouped