Package org.internna.ossmoney.model.security

Examples of org.internna.ossmoney.model.security.UserDetails


    }

    @RequestMapping("/view-transaction/{id}")
    public String viewTransaction(@PathVariable Long id, ModelMap modelMap) {
      String jsp = "accounts/view-transaction";
      UserDetails user = fillTransactionModel(modelMap);
      AccountTransaction accountTransaction = AccountTransaction.findAccountTransaction(id);
      if ((accountTransaction != null) &&  (accountTransaction.isInvestmentTransaction())) {
        jsp = "redirect:/financial/investments/view/" + accountTransaction.getInvestment().getId();
      } else if ((accountTransaction != null) && (accountTransaction.getAccount().belongsTo(user))) {
        modelMap.addAttribute("transaction", accountTransaction);
View Full Code Here


      return jsp;
    }

    @RequestMapping(value = "/edit-transaction", method = RequestMethod.POST)
    public String editTransaction(AccountTransaction transaction, ModelMap modelMap) {
      UserDetails user = UserDetails.findCurrentUser();
      AccountTransaction loaded = AccountTransaction.findAccountTransaction(transaction.getId());
      if (loaded.getAccount().belongsTo(user)) {
        cache.invalidate(user);
        loaded.setMemo(transaction.getMemo());
        loaded.setAmount(transaction.getAmount());
View Full Code Here

        return "redirect:/financial/accounts";
    }

    @RequestMapping("/backup")
    public @ResponseBody byte[] backup(HttpServletResponse response) throws IOException {
      UserDetails user = UserDetails.findCurrentUser();
      byte[] data = service.backup(user);
      response.setHeader("Content-Disposition", "attachment; filename=\"ossmoney-" + user.getUsername() + ".backup.zip\"");
      return data;
    }
View Full Code Here

        return "administration/createSubcategory";
    }

    @RequestMapping(value = "/createSubcategory", method = RequestMethod.POST)
    public String subcategory(Long id, String name, ModelMap modelMap) {
      UserDetails user = UserDetails.findCurrentUser();
      Category category = Category.findCategory(id);
      if (category != null) {
        Subcategory.createInstance(name, category, user);
      }
        return subcategory(modelMap);
View Full Code Here

    public String provider(final WebRequest request) {
    Connection<?> connection = ProviderSignInUtils.getConnection(request);
    if (connection != null) {
      UserProfile profile = connection.fetchUserProfile();
      String userId = profile.getUsername();
      UserDetails user = UserDetails.findUserDetailsByUsername(userId);
      if (user == null) {
        userService.register(userId, String.valueOf(new Random().nextInt()), profile.getName(), profile.getEmail());
      }
      assumeAuthentication(userId);
    }
View Full Code Here

  public void testGetOrCreateSubcategory() {
    Register register = new Register();
    register.setAmount(20D);
    register.setCategory("newcat");
    register.setSubcategory("newsub");
    UserDetails user = UserDetails.findCurrentUser();
    qifImporterService.getOrCreateSubcategory(user, register);
    assertNotNull("Category added", Category.findByCategory("newcat"));
    assertTrue("Subcategory created", qifImporterService.getOrCreateSubcategory(user, register).getId() > 0);
  }
View Full Code Here

    public void testTransferMoney() {
        Account origin = Account.findAccount(1L);
        Account target = Account.findAccount(2L);
        assertEquals("Six initial transactions", 6, origin.getTransactions().size());
        assertEquals("Two initial transactions", 2, target.getTransactions().size());
        UserDetails user = new UserDetails();
        accountService.transferMoney(user, origin, target, null, BigDecimal.ZERO, BigDecimal.ZERO, 0, null);
        assertEquals("Six initial transactions", 6, origin.getTransactions().size());
        assertEquals("Two initial transactions", 2, target.getTransactions().size());
        user = origin.getOwner();
        accountService.transferMoney(user, origin, target, new Date(), BigDecimal.ONE, BigDecimal.ZERO, 1, null);
View Full Code Here

    @Test
    public void testIsValidTransaction() {
        Account account = new Account();
        account.setClosed(Boolean.FALSE);
        UserDetails user = new UserDetails();
        user.setUsername("someuser");
        Calendar calendar = Calendar.getInstance();
        Date now = calendar.getTime();
        calendar.add(Calendar.YEAR, -1);
        account.setOpened(calendar.getTime());
        assertFalse("Null user", accountService.isValidTransaction(null, account, now, BigDecimal.ZERO));
View Full Code Here

        assertTrue("Transaction ok", accountService.isValidTransaction(user, account, now, BigDecimal.ONE));
    }

    @Test
    public void testPayBill() {
      UserDetails user = UserDetails.findCurrentUser();
      Bill bill = new Bill();
      bill.setOwner(user);
      bill.setAmount(100D);
      bill.setCurrency(Locale.US);
      bill.setLastTrigger(new Date());
View Full Code Here

    assertEquals("Transactions parsed", "!Type:Bank\nD20/08'2010\nT53.00\nCX\nPOpening Balance\nL[Cuenta corriente]\n^\nD03/11'2010\nT-100.00\nPJose\nLcategory.financial:Bank charges\n^\nD25/11'2010\nT-26.00\nPJose\nLcategory.financial:Bank charges\n^\nD30/11'2010\nT785.00\nPJose\nLcategory.salary:category.wages\n^\nD10/01'2011\nT-53.00\nPJose\nLcategory.household:category.furnishing\n^\nD20/01'2011\nT-93.00\nPJose\nLcategory.household:category.dues\n^\nD14/06'2011\nT-215.00\nPJose\nLcategory.financial:Bank charges\n^\n", qifs.getKey());
  }

  @Test
  public void testBackup() throws IOException {
    UserDetails user = UserDetails.findUserDetails(1L);
    byte[] backup = service.backup(user);
    ZipInputStream is = new ZipInputStream(new ByteArrayInputStream(backup));
    List<ZipEntry> entries = new ArrayList<ZipEntry>();
    ZipEntry entry = null;
    while (null != (entry = is.getNextEntry()) ) {
View Full Code Here

TOP

Related Classes of org.internna.ossmoney.model.security.UserDetails

Copyright © 2018 www.massapicom. 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.