@RequestMapping("/view/{id}")
public String view(@PathVariable Long id, ModelMap modelMap) {
UserDetails user = UserDetails.findCurrentUser();
InvestmentTransaction transaction = InvestmentTransaction.findInvestmentTransaction(id);
Account account = transaction.getAccountTransaction().getAccount();
if (account.belongsTo(user)) {
modelMap.addAttribute("account", account);
modelMap.addAttribute("transaction", transaction);
modelMap.addAttribute("investments", Investment.findInvestmentsByOwner(user));
}
return "investment/view";