Examples of Investment


Examples of com.cin.entity.Investment

  public void setStockDividends(int stockDividends) {
    this.stockDividends = stockDividends;
  }
 
  public Investment toEJB(int ssn){
    Investment ejb = new Investment();
    ejb.setCapitalgains(capitalGains);
    ejb.setCapitallosses(capitalLosses);
    ejb.setSsn(ssn);
    ejb.setStockdividends(stockDividends);
    return ejb;
  }
View Full Code Here

Examples of com.cin.entity.Investment

      update(ejb);
    }
  }

  public void updateUserInvestment(UserDTO user){
    Investment ejb = manager.find(Investment.class, user.getSsn());
    if( ejb == null ){
      ejb = user.getInvestmentDetails().toEJB(user.getSsn());
      persist(ejb);
    } else {
      ejb.setCapitalgains(user.getInvestmentDetails().getCapitalGains());
      ejb.setCapitallosses(user.getInvestmentDetails().getCapitalLosses());
      ejb.setStockdividends(user.getInvestmentDetails().getStockDividends());
      update(ejb);
    }
  }
View Full Code Here

Examples of org.internna.ossmoney.model.Investment

    }

    @RequestMapping(value = "/create", method = RequestMethod.POST)
    public String create(String type, String name, String symbol, String locale, ModelMap modelMap) {
      String[] parts = locale.split("_");
        Investment investment = new Investment();
        investment.setName(name);
        investment.setSymbol(symbol);
        investment.setProductType(type);
        investment.setOwner(UserDetails.findCurrentUser());
        investment.setLocale(new Locale(parts[0], parts[1], ""));
        investment.persist();
        return "redirect:/financial/accounts";
    }
View Full Code Here

Examples of org.internna.ossmoney.model.Investment

          accountTransaction.setAmount(new BigDecimal(transaction.getQuantity() * transaction.getPrice().getPrice()));
        } else {
          loaded.setPrice(null);
          accountTransaction.setAmount(transaction.getAccountTransaction().getAmount());
        }
        Investment investment = Investment.findInvestment(transaction.getInvestment().getId());
        loaded.setInvestment(investment);
        loaded.getAccountTransaction().setPayee(investment)
        accountTransaction.setOperationDate(transaction.getAccountTransaction().getOperationDate());
        accountTransaction.setReferenceNumber(transaction.getAccountTransaction().getReferenceNumber());
        accountTransaction.setSubcategory(Subcategory.findBySubcategory(transaction.getAccountTransaction().getSubcategory().getCategory(), user));
View Full Code Here

Examples of org.internna.ossmoney.model.Investment

    @RequestMapping("/prices/{id}")
    public String getPrices(@PathVariable Long id, ModelMap modelMap) {
      UserDetails user = UserDetails.findCurrentUser();
      String currency = "EUR";
      Investment investment = Investment.findInvestment(id);
      Set<InvestmentPrice> prices = new TreeSet<InvestmentPrice>();
      Set<InvestmentPrice> datedPrices = new TreeSet<InvestmentPrice>();
      if (investment.belongsTo(user)) {
        if (investment.getLocale() != null) {
          Locale locale = investment.getLocale();
          Currency investmentCurrency = Currency.getInstance(locale);
          currency = investmentCurrency.getCurrencyCode();
        }
        modelMap.addAttribute("investment", investment.getName());
        prices.addAll(InvestmentPrice.findInvestmentPricesByInvestment(investment));
        datedPrices.addAll(prices);
        fill(datedPrices);
      }
      modelMap.addAttribute("id", id);
View Full Code Here

Examples of org.internna.ossmoney.model.Investment

    }

    @RequestMapping(value = "/prices", method = RequestMethod.POST)
    public String setPrice(Long investmentId, Long priceId, Date operationDate, Double amount, ModelMap modelMap) {
      UserDetails user = UserDetails.findCurrentUser();
      Investment investment = Investment.findInvestment(investmentId);
      InvestmentPrice price = InvestmentPrice.findInvestmentPrice(priceId);
      if (price == null) {
        price = new InvestmentPrice();
        investment.addPrice(price);
      }
      if ((investment != null) && investment.belongsTo(user) && price.belongsTo(investment)) {
        price.setPrice(amount);
        price.setUpdateTime(operationDate);
        if (price.getId() != null) {
          price.merge();
        } else {
View Full Code Here

Examples of org.internna.ossmoney.model.Investment

public class InvestmentService implements org.internna.ossmoney.services.InvestmentService {

  @Override public void addInvestment(UserDetails user, Account account, InvestmentTransaction transaction, double commision) {
    String subcat = transaction.getAccountTransaction().getSubcategory().getCategory();
    Subcategory subcategory = Subcategory.findBySubcategory(subcat, user);
    Investment investment = Investment.findInvestment(transaction.getInvestment().getId());
    investment.addInvestment(transaction);
    BigDecimal amount = transaction.getAccountTransaction().getAmount();
    if ((amount == null) || BigDecimal.ZERO.equals(amount)) {
      amount = new BigDecimal(transaction.getQuantity() * transaction.getPrice().getPrice());
    } else {
      transaction.setQuantity(0D);
View Full Code Here

Examples of org.internna.ossmoney.model.Investment

    register.setQuantity(100.0);
    register.setInvestment("investment");
    register.setOperation(Operation.BUY);
    qifImporterService.process(register, account);
    assertEquals("Investment transaction saved", number + 2, account.getTransactions().size());
    Investment investment = Investment.findByName("investment", account.getOwner());
    assertNotNull("Investment created", investment);
    assertEquals("One transaction", new Integer(1), new Integer(investment.getInvestments().size()));
    assertEquals("Correct price", new Double(98.34), investment.getInvestments().iterator().next().getPrice().getPrice());
  }
View Full Code Here

Examples of org.internna.ossmoney.model.Investment

    SecurityUtils.authenticate(authenticationManager, "jose", "jose");
  }

  @Test
  public void testAddInvestment() {
    Investment investment = new Investment();
    Account account = Account.findAccount(1L);
    investment.setSymbol("INV");
    investment.setName("investment");
    investment.setProductType("type");
    investment.setOwner(account.getOwner());
    investment.persist();
    InvestmentTransaction transaction = new InvestmentTransaction();
    transaction.setQuantity(5D);
    transaction.setInvestment(new Investment());
    transaction.getInvestment().setId(investment.getId());
    transaction.setPrice(new InvestmentPrice());
    transaction.getPrice().setPrice(2D);
    transaction.setAccountTransaction(new AccountTransaction());
    transaction.getAccountTransaction().setAccount(new Account());
    transaction.getAccountTransaction().getAccount().setId(1L);
    transaction.getAccountTransaction().setAmount(BigDecimal.TEN);
    transaction.getAccountTransaction().setOperationDate(DateUtils.getMidnight(new Date()));
    transaction.getAccountTransaction().setSubcategory(new Subcategory());
    transaction.getAccountTransaction().getSubcategory().setCategory("category.investment.buy");
    double balance = account.calculateBalance().doubleValue();
    investmentService.addInvestment(account.getOwner(), account, transaction, 11D);
    assertNotNull("Transaction persisted", transaction.getId());
    assertNotNull("Investment price persisted", transaction.getPrice().getId());
    assertNotNull("Account transaction persisted", transaction.getAccountTransaction().getId());
    assertEquals("One price available for the investment", new Double(2D), investment.getCurrentPrice());
    assertEquals("Balance was updated accordingly", new Double(balance - 21D), new Double(account.calculateBalance().doubleValue()));
  }
View Full Code Here

Examples of org.internna.ossmoney.model.Investment

        transaction.setReconciled(register.getReconciled());
        transaction.setPayee(getOrCreatePayee(register, account));
        transaction.setSubcategory(getOrCreateSubcategory(account.getOwner(), register));
      } else if (register.isInvestment()) {
        transaction.setReconciled(Boolean.FALSE);
        Investment investment = getOrCreateInvestment(register, account);
        transaction.setPayee(investment);
        InvestmentTransaction investmentTransaction = new InvestmentTransaction();
        investment.addInvestment(investmentTransaction);
        investmentTransaction.setAccountTransaction(transaction);
        if (register.getPrice() != null) {
          investmentTransaction.setPrice(new InvestmentPrice());
          investmentTransaction.getPrice().setInvestment(investment);
          investmentTransaction.getPrice().setPrice(register.getPrice());
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.