This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "schema": "http://json-schema.org/draft-04/schema#", | |
| "title": "F1450FormFields", | |
| "description": "Representation of the fields from ClaimForm F1450", | |
| "type": "object", | |
| "definitions": { | |
| "IHTDetails" :{ | |
| "type": "object", | |
| "properties": | |
| { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def setRelationWithLabel(source: LobbyNode,target: LobbyNode,label: String) = | |
| LDiEdge(source, target)(label) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | IndexedSeq[LDiEdge[LobbyNode]]( | |
| setRelationWithLabel(p,t,"IsPlayingAt"), | |
| setRelationWithLabel(t,p,"seatOccupiedBy") | |
| ) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def assignPlayersToTable(pairs: List[(Player,GameTable)]) = { | |
| lobby = lobby ++ | |
| pairs.foldLeft(IndexedSeq[LDiEdge[LobbyNode]]())((holder,nextPair) => { | |
| val rootToPlayer = setRelationWithLabel(playerRootNode,nextPair._1,"IsAPlayer") | |
| val playerToRoot = setRelationWithLabel(nextPair._1,playerRootNode,"RootedAt") | |
| (holder :+ rootToPlayer :+ playerToRoot) ++ giveSeatToPlayer(nextPair._1,nextPair._2) | |
| }).toList | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def assignPlayersToTable(pairs: List[(Player,GameTable)]) = { | |
| lobby = lobby ++ | |
| pairs.foldLeft(IndexedSeq[LDiEdge[LobbyNode]]())((holder,nextPair) => { | |
| (holder :+ rootToPlayer :+ playerToRoot) ++ giveSeatToPlayer(nextPair._1,nextPair._2) | |
| }).toList | |
| } | |
| def giveSeatToPlayer(p: Player, t: GameTable) = { | |
| IndexedSeq[LDiEdge[LobbyNode]]( | |
| setRelationWithLabel(p,t,"IsPlayingAt"), | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def assignPlayersToTable(pairs: List[(Player,GameTable)]) = { | |
| lobby = lobby ++ | |
| pairs.foldLeft(IndexedSeq[LDiEdge[LobbyNode]]())((holder,nextPair) => { | |
| (holder) ++ giveSeatToPlayer(nextPair._1,nextPair._2) | |
| }).toList | |
| } | |
| def giveSeatToPlayer(p: Player, t: GameTable) = { | |
| IndexedSeq[LDiEdge[LobbyNode]]( | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def retrieveAllPlayersOnTable(tableToSearch: GameTable) = { | |
| val innerTableNode = retrieveAllTablesInner | |
| .view | |
| .filter(nextTable => nextTable == tableToSearch) | |
| .head | |
| innerTableNode.outgoing | |
| .view.filter(nextOut => nextOut.label == "seatOccupiedBy") | |
| .view.map(e => e.target) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def retrieveTablesPlayerIsAt(p: Player) = { | |
| lobby.get(p).outgoing.view | |
| .filter(e => e.label == "IsPlayingAt") | |
| .map(e => e.target) | |
| .map(_.value) | |
| .collect { case t: GameTable => t } | |
| .toList | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | PatternsCS.pipe( | |
| PatternsCS.ask( | |
| circuitBreakerJeeves, | |
| new InteractionProtocol.RetrievableClubIDMessageWithFinalDeliveryAddress( | |
| clubID, getSender() | |
| ), | |
| ASK_TIMEOUT | |
| ) | |
| .handle((messageOK, exceptionReported) -> { | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | if ( arg0 instanceof ClubDetailsFromXternalSource) { | |
| ClubDetailsFromXternalSource m = (ClubDetailsFromXternalSource)arg0; | |
| ActorRef originalSender = m.originallyAskedBy; | |
| String details = m.clubInfoAsJSON; | |
| originalSender.tell (details, getSelf()); | |
| } else | |
| if ( arg0 instanceof TimedOutClubDetails ) { | |
| TimedOutClubDetails m = (TimedOutClubDetails) arg0; | |
| m.toBSentTo.tell("Service unresponsive, try again later", getSelf()); | 
OlderNewer