@RequestMapping("/moves") @Transactional(propagation = Propagation.REQUIRES_NEW) public String generatePossibleMoves( @RequestParam(value = "b", required = false) String id, Model model) { ScribbleBoard board = null; try { if (id != null && !id.isEmpty()) { board = boardManager.openBoard(Long.parseLong(id)); } } catch (BoardLoadingException ignore) { } if (board != null) { ScribbleRobotBrain brain = new ScribbleRobotBrain(); final Personality playerTurn = board.getPlayerTurn(); final ScribblePlayerHand hand = board.getPlayerHand(playerTurn); if (hand != null) { model.addAttribute("board", board); model.addAttribute("words", brain.getAvailableMoves(board, hand.getTiles())); model.addAttribute("scoreEngine", board.getScoreEngine()); } } return "/content/maintain/admin/moves"; }
@RequestMapping("/membership") @Transactional(propagation = Propagation.REQUIRES_NEW) public String membership( @RequestParam(value = "p", required = false) String p, @RequestParam(value = "m", required = false) String m, @RequestParam(value = "d", required = false) String d, Model model) throws ParseException { if (p != null) { final Account account = accountManager.getAccount(Long.parseLong(p)); model.addAttribute("account", account); if (account != null) { final MembershipCard membershipCard = membershipManager.getPlayerMembership(account); model.addAttribute("membershipCard", membershipCard); if (d != null) { final Membership nm = Membership.valueOf(m.toUpperCase()); if (nm == null) { membershipManager.removePlayerMembership(account); } else { final Date parse = new SimpleDateFormat("dd.MM.yyyy").parse(d); membershipManager.updatePlayerMembership(account, nm, parse); } } } } return "/content/maintain/admin/membership"; }