private void creditAccountBalance(Connection conn, AccountDataBean accountData, BigDecimal credit) throws Exception { PreparedStatement stmt = getStatement(conn, creditAccountBalanceSQL); stmt.setBigDecimal(1, credit); stmt.setInt(2, accountData.getAccountID().intValue()); int count = stmt.executeUpdate(); stmt.close(); }
private void creditAccountBalance(Connection conn, AccountDataBean accountData, BigDecimal credit) throws Exception { PreparedStatement stmt = getStatement(conn, creditAccountBalanceSQL); stmt.setBigDecimal(1, credit); stmt.setInt(2, accountData.getAccountID().intValue()); int count = stmt.executeUpdate(); stmt.close(); }
private void creditAccountBalance(Connection conn, AccountDataBean accountData, BigDecimal credit) throws Exception { PreparedStatement stmt = getStatement(conn, creditAccountBalanceSQL); stmt.setBigDecimal(1, credit); stmt.setInt(2, accountData.getAccountID().intValue()); int count = stmt.executeUpdate(); stmt.close(); }
private void creditAccountBalance(Connection conn, AccountDataBean accountData, BigDecimal credit) throws Exception { PreparedStatement stmt = getStatement(conn, creditAccountBalanceSQL); stmt.setBigDecimal(1, credit); stmt.setInt(2, accountData.getAccountID().intValue()); int count = stmt.executeUpdate(); stmt.close(); }
private OrderDataBean createOrder(Connection conn, AccountDataBean accountData, QuoteDataBean quoteData, HoldingDataBean holdingData, String orderType, double quantity) throws Exception { OrderDataBean orderData = null; Timestamp currentDate = new Timestamp(System.currentTimeMillis()); PreparedStatement stmt = getStatement(conn, createOrderSQL); Integer orderID = KeySequenceDirect.getNextID(conn, "order", inSession, getInGlobalTxn()); stmt.setInt(1, orderID.intValue()); stmt.setString(2, orderType); stmt.setString(3, "open"); stmt.setTimestamp(4, currentDate); stmt.setDouble(5, quantity); stmt.setBigDecimal(6, quoteData.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND)); stmt.setBigDecimal(7, TradeConfig.getOrderFee(orderType)); stmt.setInt(8, accountData.getAccountID().intValue()); if (holdingData == null) stmt.setNull(9, java.sql.Types.INTEGER); else stmt.setInt(9, holdingData.getHoldingID().intValue()); stmt.setString(10, quoteData.getSymbol()); int rowCount = stmt.executeUpdate(); stmt.close(); return getOrderData(conn, orderID.intValue()); }
private OrderDataBean createOrder(Connection conn, AccountDataBean accountData, QuoteDataBean quoteData, HoldingDataBean holdingData, String orderType, double quantity) throws Exception { OrderDataBean orderData = null; Timestamp currentDate = new Timestamp(System.currentTimeMillis()); PreparedStatement stmt = getStatement(conn, createOrderSQL); Integer orderID = KeySequenceDirect.getNextID(conn, "order", inSession, getInGlobalTxn()); stmt.setInt(1, orderID.intValue()); stmt.setString(2, orderType); stmt.setString(3, "open"); stmt.setTimestamp(4, currentDate); stmt.setDouble(5, quantity); stmt.setBigDecimal(6, quoteData.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND)); stmt.setBigDecimal(7, TradeConfig.getOrderFee(orderType)); stmt.setInt(8, accountData.getAccountID().intValue()); if (holdingData == null) stmt.setNull(9, java.sql.Types.INTEGER); else stmt.setInt(9, holdingData.getHoldingID().intValue()); stmt.setString(10, quoteData.getSymbol()); int rowCount = stmt.executeUpdate(); stmt.close(); return getOrderData(conn, orderID.intValue()); }
private OrderDataBean createOrder(Connection conn, AccountDataBean accountData, QuoteDataBean quoteData, HoldingDataBean holdingData, String orderType, double quantity) throws Exception { OrderDataBean orderData = null; Timestamp currentDate = new Timestamp(System.currentTimeMillis()); PreparedStatement stmt = getStatement(conn, createOrderSQL); Integer orderID = KeySequenceDirect.getNextID(conn, "order", inSession, getInGlobalTxn()); stmt.setInt(1, orderID.intValue()); stmt.setString(2, orderType); stmt.setString(3, "open"); stmt.setTimestamp(4, currentDate); stmt.setDouble(5, quantity); stmt.setBigDecimal(6, quoteData.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND)); stmt.setBigDecimal(7, TradeConfig.getOrderFee(orderType)); stmt.setInt(8, accountData.getAccountID().intValue()); if (holdingData == null) stmt.setNull(9, java.sql.Types.INTEGER); else stmt.setInt(9, holdingData.getHoldingID().intValue()); stmt.setString(10, quoteData.getSymbol()); int rowCount = stmt.executeUpdate(); stmt.close(); return getOrderData(conn, orderID.intValue()); }
private OrderDataBean createOrder(Connection conn, AccountDataBean accountData, QuoteDataBean quoteData, HoldingDataBean holdingData, String orderType, double quantity) throws Exception { OrderDataBean orderData = null; Timestamp currentDate = new Timestamp(System.currentTimeMillis()); PreparedStatement stmt = getStatement(conn, createOrderSQL); Integer orderID = KeySequenceDirect.getNextID(conn, "order", inSession, getInGlobalTxn()); stmt.setInt(1, orderID.intValue()); stmt.setString(2, orderType); stmt.setString(3, "open"); stmt.setTimestamp(4, currentDate); stmt.setDouble(5, quantity); stmt.setBigDecimal(6, quoteData.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND)); stmt.setBigDecimal(7, TradeConfig.getOrderFee(orderType)); stmt.setInt(8, accountData.getAccountID().intValue()); if (holdingData == null) stmt.setNull(9, java.sql.Types.INTEGER); else stmt.setInt(9, holdingData.getHoldingID().intValue()); stmt.setString(10, quoteData.getSymbol()); int rowCount = stmt.executeUpdate(); stmt.close(); return getOrderData(conn, orderID.intValue()); }
public void login(String password) { AccountProfileDataBean profile = getProfile(); if ((profile == null) || (profile.getPassword().equals(password) == false)) { String error = "AccountBean:Login failure for account: " + getAccountID() + ((profile == null) ? "null AccountProfile" : "\n\tIncorrect password-->" + profile.getUserID() + ":" + profile.getPassword()); throw new RuntimeException(error); } setLastLogin(new Timestamp(System.currentTimeMillis())); setLoginCount(getLoginCount() + 1); }
public void login(String password) { AccountProfileDataBean profile = getProfile(); if ((profile == null) || (profile.getPassword().equals(password) == false)) { String error = "AccountBean:Login failure for account: " + getAccountID() + ((profile == null) ? "null AccountProfile" : "\n\tIncorrect password-->" + profile.getUserID() + ":" + profile.getPassword()); throw new RuntimeException(error); } setLastLogin(new Timestamp(System.currentTimeMillis())); setLoginCount(getLoginCount() + 1); }
private OrderDataBean createOrder(AccountDataBean account, QuoteDataBean quote, HoldingDataBean holding, String orderType, double quantity, EntityManager entityManager) { OrderDataBean order; if (Log.doTrace()) Log.trace("TradeJPADirect:createOrder(orderID=" + " account=" + ((account == null) ? null : account.getAccountID()) + " quote=" + ((quote == null) ? null : quote.getSymbol()) + " orderType=" + orderType + " quantity=" + quantity); try { order = new OrderDataBean(orderType, "open", new Timestamp(System.currentTimeMillis()), null, quantity, quote.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND), TradeConfig.getOrderFee(orderType), account, quote, holding); entityManager.persist(order); } catch (Exception e) { entityManager.getTransaction().rollback(); Log.error("TradeJPADirect:createOrder -- failed to create Order", e); throw new RuntimeException("TradeJPADirect:createOrder -- failed to create Order", e); } return order; }
private OrderDataBean createOrder(AccountDataBean account, QuoteDataBean quote, HoldingDataBean holding, String orderType, double quantity) { OrderDataBean order; if (Log.doTrace()) Log.trace("TradeSLSBBean:createOrder(orderID=" + " account=" + ((account == null) ? null : account.getAccountID()) + " quote=" + ((quote == null) ? null : quote.getSymbol()) + " orderType=" + orderType + " quantity=" + quantity); try { order = new OrderDataBean(orderType, "open", new Timestamp(System.currentTimeMillis()), null, quantity, quote.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND), TradeConfig.getOrderFee(orderType), account, quote, holding); entityManager.persist(order); } catch (Exception e) { Log.error("TradeSLSBBean:createOrder -- failed to create Order", e); throw new EJBException("TradeSLSBBean:createOrder -- failed to create Order", e); } return order; }
private OrderDataBean createOrder(AccountDataBean account, QuoteDataBean quote, HoldingDataBean holding, String orderType, double quantity) { OrderDataBean order; if (Log.doTrace()) Log.trace("TradeSLSBBean:createOrder(orderID=" + " account=" + ((account == null) ? null : account.getAccountID()) + " quote=" + ((quote == null) ? null : quote.getSymbol()) + " orderType=" + orderType + " quantity=" + quantity); try { order = new OrderDataBean(orderType, "open", new Timestamp(System.currentTimeMillis()), null, quantity, quote.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND), TradeConfig.getOrderFee(orderType), account, quote, holding); entityManager.persist(order); } catch (Exception e) { Log.error("TradeSLSBBean:createOrder -- failed to create Order", e); throw new EJBException("TradeSLSBBean:createOrder -- failed to create Order", e); } return order; }
private OrderDataBean createOrder(AccountDataBean account, QuoteDataBean quote, HoldingDataBean holding, String orderType, double quantity, EntityManager entityManager) { OrderDataBean order; if (Log.doTrace()) Log.trace("TradeJPADirect:createOrder(orderID=" + " account=" + ((account == null) ? null : account.getAccountID()) + " quote=" + ((quote == null) ? null : quote.getSymbol()) + " orderType=" + orderType + " quantity=" + quantity); try { order = new OrderDataBean(orderType, "open", new Timestamp(System.currentTimeMillis()), null, quantity, quote.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND), TradeConfig.getOrderFee(orderType), account, quote, holding); entityManager.persist(order); } catch (Exception e) { Log.error("TradeJPADirect:createOrder -- failed to create Order", e); throw new RuntimeException("TradeJPADirect:createOrder -- failed to create Order", e); } return order; }
public String toHTML() { return "<BR>Account Data for account: <B>" + getAccountID() + "</B>" + "<LI> loginCount:" + getLoginCount() + "</LI>" + "<LI> logoutCount:" + getLogoutCount() + "</LI>" + "<LI> lastLogin:" + getLastLogin() + "</LI>" + "<LI> creationDate:" + getCreationDate() + "</LI>" + "<LI> balance:" + getBalance() + "</LI>" + "<LI> openBalance:" + getOpenBalance() + "</LI>" + "<LI> profileID:" + getProfileID() + "</LI>" ; }
public String toString() { return "\n\tAccount Data for account: " + getAccountID() + "\n\t\t loginCount:" + getLoginCount() + "\n\t\t logoutCount:" + getLogoutCount() + "\n\t\t lastLogin:" + getLastLogin() + "\n\t\t creationDate:" + getCreationDate() + "\n\t\t balance:" + getBalance() + "\n\t\t openBalance:" + getOpenBalance() + "\n\t\t profileID:" + getProfileID() ; }
public String toHTML() { return "<BR>Account Data for account: <B>" + getAccountID() + "</B>" + "<LI> loginCount:" + getLoginCount() + "</LI>" + "<LI> logoutCount:" + getLogoutCount() + "</LI>" + "<LI> lastLogin:" + getLastLogin() + "</LI>" + "<LI> creationDate:" + getCreationDate() + "</LI>" + "<LI> balance:" + getBalance() + "</LI>" + "<LI> openBalance:" + getOpenBalance() + "</LI>" + "<LI> profileID:" + getProfileID() + "</LI>" ; }
public String toString() { return "\n\tAccount Data for account: " + getAccountID() + "\n\t\t loginCount:" + getLoginCount() + "\n\t\t logoutCount:" + getLogoutCount() + "\n\t\t lastLogin:" + getLastLogin() + "\n\t\t creationDate:" + getCreationDate() + "\n\t\t balance:" + getBalance() + "\n\t\t openBalance:" + getOpenBalance() + "\n\t\t profileID:" + getProfileID() ; }
static AccountDataBean convertAccountDataBean(org.apache.geronimo.samples.daytrader.beans.AccountDataBean bean) { AccountDataBean wsBean = new AccountDataBean(); wsBean.setAccountID(bean.getAccountID()); wsBean.setLoginCount(bean.getLoginCount()); wsBean.setLogoutCount(bean.getLogoutCount()); wsBean.setLastLogin(toCalendar(bean.getLastLogin())); wsBean.setCreationDate(toCalendar(bean.getCreationDate())); wsBean.setBalance(bean.getBalance()); wsBean.setOpenBalance(bean.getOpenBalance()); wsBean.setProfileID(bean.getProfileID()); return wsBean; }
static AccountDataBean convertAccountDataBean(org.apache.geronimo.samples.daytrader.beans.AccountDataBean bean) { AccountDataBean wsBean = new AccountDataBean(); wsBean.setAccountID(bean.getAccountID()); wsBean.setLoginCount(bean.getLoginCount()); wsBean.setLogoutCount(bean.getLogoutCount()); wsBean.setLastLogin(toCalendar(bean.getLastLogin())); wsBean.setCreationDate(toCalendar(bean.getCreationDate())); wsBean.setBalance(bean.getBalance()); wsBean.setOpenBalance(bean.getOpenBalance()); wsBean.setProfileID(bean.getProfileID()); return wsBean; }