Examples of belongsTo()


Examples of org.internna.ossmoney.model.Account.belongsTo()

    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public String edit(InvestmentTransaction transaction, ModelMap modelMap) {
      UserDetails user = UserDetails.findCurrentUser();
      InvestmentTransaction loaded = InvestmentTransaction.findInvestmentTransaction(transaction.getId());
      Account account = loaded.getAccountTransaction().getAccount();
      if (account.belongsTo(user)) {
        cache.invalidate(user);
        AccountTransaction accountTransaction = loaded.getAccountTransaction();
        if (transaction.getPrice() != null) {
          loaded.setQuantity(transaction.getQuantity());
          loaded.getPrice().setPrice(transaction.getPrice().getPrice());
View Full Code Here

Examples of org.internna.ossmoney.model.Account.belongsTo()

      UserDetails user = UserDetails.findCurrentUser();
      InvestmentTransaction transaction  = InvestmentTransaction.findInvestmentTransaction(id);
      if (transaction != null) {
        AccountTransaction accountTransaction = transaction.getAccountTransaction();
        Account account = accountTransaction.getAccount();
        if (account.belongsTo(user)) {
          cache.invalidate(user);
          accountId = account.getId();
          accountTransaction.remove();
        }
      }
View Full Code Here

Examples of org.internna.ossmoney.model.Account.belongsTo()

    }

    @SuppressWarnings("unchecked")
  protected void fillProvidedAccount(Long account, UserDetails user, ModelMap modelMap) {
        Account loaded = Account.findAccount(account);
        if ((loaded != null) && (loaded.belongsTo(user))) {
            modelMap.addAttribute("account", loaded);
            modelMap.addAttribute("currency",  loaded.getCurrency());
            List<Account> accounts = new ArrayList<Account>((List<Account>) modelMap.get("accounts"));
            accounts.remove(loaded);
            modelMap.addAttribute("accounts", accounts);
View Full Code Here

Examples of org.internna.ossmoney.model.Account.belongsTo()

    @RequestMapping("/balance/{accountId}")
    public String balance(@PathVariable Long accountId, ModelMap modelMap) {
      Account account = Account.findAccount(accountId);
        if (account != null) {
            UserDetails user = UserDetails.findCurrentUser();
            if (account.belongsTo(user) && account.isCreditCard()) {
              modelMap.addAttribute("account", account);
              modelMap.addAttribute("origin", user.getBankAccounts());
              modelMap.addAttribute("transactions", AccountTransaction.findUnreconciledTransactions(account));
            }
        }
View Full Code Here

Examples of org.internna.ossmoney.model.Account.belongsTo()

      if (hasText(transactions)) {
        Account origin = Account.findAccount(originId);
        Account account = Account.findAccount(accountId);
        if ((account != null) && (origin != null)) {
          UserDetails user = UserDetails.findCurrentUser();
          if (account.belongsTo(user) && origin.belongsTo(user)) {
            cache.invalidate(user);
            accountService.balance(user, account, origin, operationDate, transactions.split("-"));
          }
        }
      }
View Full Code Here

Examples of org.internna.ossmoney.model.Account.belongsTo()

    @RequestMapping("/view/{id}")
    public String view(@PathVariable Long id, ModelMap modelMap) {
      Account account = Account.findAccount(id);
      UserDetails user = UserDetails.findCurrentUser();
      modelMap.addAttribute("institutions", new TreeSet<FinancialInstitution>(user.getInstitutions()));
      if (account.belongsTo(user)) {
        modelMap.addAttribute("account", account);
      }
      return "accounts/view";
    }
View Full Code Here

Examples of org.internna.ossmoney.model.Account.belongsTo()

    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public String edit(Account account, ModelMap modelMap) {
      UserDetails user = UserDetails.findCurrentUser();
      Account loaded = Account.findAccount(account.getId());
      if (loaded.belongsTo(user)) {
        cache.invalidate(user);
      loaded.setIsbn(account.getIsbn());
        loaded.setName(account.getName());
        loaded.setLocale(account.getLocale());
        loaded.setOpened(account.getOpened());
View Full Code Here

Examples of org.internna.ossmoney.model.Account.belongsTo()

    public String remove(@PathVariable Long id, ModelMap modelMap) {
      Account account = null;
      AccountTransaction transaction  = AccountTransaction.findAccountTransaction(id);
      if (transaction != null) {
        account = transaction.getAccount();
        if (account.belongsTo(UserDetails.findCurrentUser())) {
          transaction.remove();
        }
      }
      return details(account, modelMap);
    }
View Full Code Here

Examples of org.internna.ossmoney.model.Account.belongsTo()

    Account account = qifImporterService.createAccount(Locale.US, institution, register);
    assertNotNull("Account created", account);
    assertEquals("Amount processed", new Double(20), new Double(account.calculateBalance().doubleValue()));
    assertEquals("Account name processed", "Test account", account.getName());
    assertEquals("Financial institution processed", institution, account.getHeldAt());
    assertTrue("User correctly assumed", account.belongsTo(UserDetails.findCurrentUser()));
  }

  @Test
  public void testGetOrCreatePayee() {
    Register register = new Register();
View Full Code Here

Examples of org.internna.ossmoney.model.Bill.belongsTo()

    @RequestMapping("/pay/{id}")
    public String pay(@PathVariable Long id, ModelMap modelMap) {
      UserDetails user = UserDetails.findCurrentUser();
      Bill bill = Bill.findBill(id);
      if (bill.belongsTo(user)) {
        modelMap.addAttribute("bill", bill);
        modelMap.addAttribute("origin", user.getBankAccounts(bill.getCurrency()));
        modelMap.addAttribute("currency", Currency.getInstance(bill.getCurrency()).getCurrencyCode());
      }
      return "bills/pay";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.