Exemplo n.º 1
0
 private void fillAndRegisterStockBroker() {
   StockBroker stb = new StockBroker();
   stb.setName(nomeTxt.getText());
   stb.setEmail(emailTxt.getText());
   stb.setUsername(username.getText());
   stb.setPassword(passwd.getText());
   ContextHolder.setStockBrokerSelected(stb);
 }
Exemplo n.º 2
0
  public static void main(String arg[]) {

    TestTradeResult testTradeResult = new TestTradeResult();

    logger.info("Testing-------------------------------------------------");
    List<StockBroker> listAllStockBroker;
    try {
      listAllStockBroker = getEnvironmentFacade().listAllStockBroker();
    } catch (UIException e) {
      e.printStackTrace();
      return;
    }

    for (Iterator iteratorsb = listAllStockBroker.iterator(); iteratorsb.hasNext(); ) {
      StockBroker stockBroker = (StockBroker) iteratorsb.next();

      logger.info("Getting information about StockBroker :" + stockBroker.getName());

      List<Account> accountList = stockBroker.getAccountList();

      for (Iterator iterator = accountList.iterator(); iterator.hasNext(); ) {
        Account account = (Account) iterator.next();
        logger.info("Conta :" + account.getUser().getName());

        List<BrokerageNote> listAllBrokerageNote = null;

        try {
          listAllBrokerageNote =
              getOperationFacade().getBrokerageNoteService().findAllBrokerageNoteByAccount(account);
        } catch (CoreException e) {
          logger.error(e);
        }
        int size = listAllBrokerageNote != null ? listAllBrokerageNote.size() : 0;

        // logger.info("listAllBrokerageNote: " + size);
        TradeProcess tradeProcess = new TradeProcess();
        try {
          Map<String, Income> listIncome = tradeProcess.findMonthIncome(listAllBrokerageNote);

          Set<String> keySet = listIncome.keySet();
          for (Iterator iterator2 = keySet.iterator(); iterator2.hasNext(); ) {
            String keyDate = (String) iterator2.next();
            Income income = listIncome.get(keyDate);
            logger.info(income);
          }

        } catch (CoreException e) {
          logger.error(e);
        }
        tradeProcess.viewAmountMap();

        break;
      }
      break;
    }
    /*
     * logger.info("######################## REMOVENDO"); List<Account>
     * findAll = getEnvironmentFacade().getAccountService() .findAll();
     *
     * for (Account account : findAll) {
     * logger.info(account.getUser().getName());
     *
     * List<BrokerageNote> findAllBrokerageNoteByAccount; try {
     * findAllBrokerageNoteByAccount = getOperationFacade()
     * .getBrokerageNoteService() .findAllBrokerageNoteByAccount(account);
     *
     * int size = findAllBrokerageNoteByAccount != null ?
     * findAllBrokerageNoteByAccount .size() : 0; logger.info("Notes :" +
     * size);
     *
     * getEnvironmentFacade().getAccountService().removeAccount( account);
     * logger.info("Removed"); } catch (CoreException e) { logger.error(e);
     * } }
     */
  }