static org.apache.geronimo.samples.daytrader.beans.AccountProfileDataBean convertAccountProfileDataBean(AccountProfileDataBean wsBean) { org.apache.geronimo.samples.daytrader.beans.AccountProfileDataBean bean = new org.apache.geronimo.samples.daytrader.beans.AccountProfileDataBean(); bean.setUserID(wsBean.getUserID()); bean.setPassword(wsBean.getPassword()); bean.setFullName(wsBean.getFullName()); bean.setAddress(wsBean.getAddress()); bean.setEmail(wsBean.getEmail()); bean.setCreditCard(wsBean.getCreditCard()); return bean; }
public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) { if (Log.doTrace()) Log.trace("TradeSLSBBean:updateAccountProfileData", profileData); /* * // Retreive the pevious account profile in order to get account * data... hook it into new object AccountProfileDataBean temp = * entityManager.find(AccountProfileDataBean.class, * profileData.getUserID()); // In order for the object to merge * correctly, the account has to be hooked into the temp object... // - * may need to reverse this and obtain the full object first * * profileData.setAccount(temp.getAccount()); * * //TODO this might not be correct temp = * entityManager.merge(profileData); //System.out.println(temp); */ AccountProfileDataBean temp = entityManager.find(AccountProfileDataBean.class, profileData.getUserID()); temp.setAddress(profileData.getAddress()); temp.setPassword(profileData.getPassword()); temp.setFullName(profileData.getFullName()); temp.setCreditCard(profileData.getCreditCard()); temp.setEmail(profileData.getEmail()); entityManager.merge(temp); return temp; }
public String toString() { return "\n\tAccount Profile Data for userID:" + getUserID() + "\n\t\t passwd:" + getPassword() + "\n\t\t fullName:" + getFullName() + "\n\t\t address:" + getAddress() + "\n\t\t email:" + getEmail() + "\n\t\t creditCard:" + getCreditCard() ; }
public AccountProfileDataBean(String userID, String password, String fullName, String address, String email, String creditCard) { setUserID(userID); setPassword(password); setFullName(fullName); setAddress(address); setEmail(email); setCreditCard(creditCard); }
public AccountDataBean getAccountData(String userID) { if (Log.doTrace()) Log.trace("TradeSLSBBean:getAccountData", userID); AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID); /* * Inflate the lazy data memebers */ AccountDataBean account = profile.getAccount(); account.getProfile(); // Added to populate transient field for account account.setProfileID(profile.getUserID()); return account; }
public AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditcard, BigDecimal openBalance) { AccountDataBean account = null; AccountProfileDataBean profile = null; if (Log.doTrace()) Log.trace("TradeSLSBBean:register", userID, password, fullname, address, email, creditcard, openBalance); // Check to see if a profile with the desired userID already exists profile = entityManager.find(AccountProfileDataBean.class, userID); if (profile != null) { Log.error("Failed to register new Account - AccountProfile with userID(" + userID + ") already exists"); return null; } else { profile = new AccountProfileDataBean(userID, password, fullname, address, email, creditcard); account = new AccountDataBean(0, 0, null, new Timestamp(System.currentTimeMillis()), openBalance, openBalance, userID); profile.setAccount(account); account.setProfile(profile); entityManager.persist(profile); entityManager.persist(account); } return account; }
/** * @see TradeServices#updateAccountProfile(AccountProfileDataBean) */ public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) throws Exception { AccountProfileDataBean accountProfileData = null; Connection conn = null; try { if (Log.doTrace()) Log.trace("TradeDirect:updateAccountProfileData - inSession(" + this.inSession + ")", profileData .getUserID()); conn = getConn(); updateAccountProfile(conn, profileData); accountProfileData = getAccountProfileData(conn, profileData.getUserID()); commit(conn); } catch (Exception e) { Log.error("TradeDirect:getAccountProfileData -- error getting profile data", e); rollBack(conn, e); } finally { releaseConn(conn); } return accountProfileData; }
private AccountProfileDataBean getAccountProfileDataFromResultSet(ResultSet rs) throws Exception { AccountProfileDataBean accountProfileData = null; if (!rs.next()) Log.error("TradeJDBCDirect:getAccountProfileDataFromResultSet -- cannot find accountprofile data"); else accountProfileData = new AccountProfileDataBean(rs.getString("userID"), rs.getString("passwd"), rs.getString("fullName"), rs .getString("address"), rs.getString("email"), rs.getString("creditCard")); return accountProfileData; }
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 String toHTML() { return "<BR>Account Profile Data for userID: <B>" + getUserID() + "</B>" + "<LI> passwd:" + getPassword() + "</LI>" + "<LI> fullName:" + getFullName() + "</LI>" + "<LI> address:" + getAddress() + "</LI>" + "<LI> email:" + getEmail() + "</LI>" + "<LI> creditCard:" + getCreditCard() + "</LI>" ; }
public AccountDataBean getAccountData(String userID) { if (Log.doTrace()) Log.trace("TradeJPADirect:getAccountData", userID); EntityManager entityManager = emf.createEntityManager(); AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID); /* * Inflate the lazy data memebers */ AccountDataBean account = profile.getAccount(); account.getProfile(); // Added to populate transient field for account account.setProfileID(profile.getUserID()); entityManager.close(); entityManager = null; return account; }
public AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditcard, BigDecimal openBalance) { AccountDataBean account = null; AccountProfileDataBean profile = null; if (Log.doTrace()) Log.trace("TradeSLSBBean:register", userID, password, fullname, address, email, creditcard, openBalance); // Check to see if a profile with the desired userID already exists profile = entityManager.find(AccountProfileDataBean.class, userID); if (profile != null) { Log.error("Failed to register new Account - AccountProfile with userID(" + userID + ") already exists"); return null; } else { profile = new AccountProfileDataBean(userID, password, fullname, address, email, creditcard); account = new AccountDataBean(0, 0, null, new Timestamp(System.currentTimeMillis()), openBalance, openBalance, userID); profile.setAccount(account); account.setProfile(profile); entityManager.persist(profile); entityManager.persist(account); } return account; }
/** * @see TradeServices#updateAccountProfile(AccountProfileDataBean) */ public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) throws Exception { AccountProfileDataBean accountProfileData = null; Connection conn = null; try { if (Log.doTrace()) Log.trace("TradeJDBCDirect:updateAccountProfileData - inSession(" + this.inSession + ")", profileData .getUserID()); conn = getConn(); updateAccountProfile(conn, profileData); accountProfileData = getAccountProfileData(conn, profileData.getUserID()); commit(conn); } catch (Exception e) { Log.error("TradeJDBCDirect:getAccountProfileData -- error getting profile data", e); rollBack(conn, e); } finally { releaseConn(conn); } return accountProfileData; }
private AccountProfileDataBean getAccountProfileDataFromResultSet(ResultSet rs) throws Exception { AccountProfileDataBean accountProfileData = null; if (!rs.next()) Log.error("TradeJDBCDirect:getAccountProfileDataFromResultSet -- cannot find accountprofile data"); else accountProfileData = new AccountProfileDataBean(rs.getString("userID"), rs.getString("passwd"), rs.getString("fullName"), rs .getString("address"), rs.getString("email"), rs.getString("creditCard")); return accountProfileData; }
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 AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) { if (Log.doTrace()) Log.trace("TradeSLSBBean:updateAccountProfileData", profileData); /* * // Retreive the pevious account profile in order to get account * data... hook it into new object AccountProfileDataBean temp = * entityManager.find(AccountProfileDataBean.class, * profileData.getUserID()); // In order for the object to merge * correctly, the account has to be hooked into the temp object... // - * may need to reverse this and obtain the full object first * * profileData.setAccount(temp.getAccount()); * * //TODO this might not be correct temp = * entityManager.merge(profileData); //System.out.println(temp); */ AccountProfileDataBean temp = entityManager.find(AccountProfileDataBean.class, profileData.getUserID()); temp.setAddress(profileData.getAddress()); temp.setPassword(profileData.getPassword()); temp.setFullName(profileData.getFullName()); temp.setCreditCard(profileData.getCreditCard()); temp.setEmail(profileData.getEmail()); entityManager.merge(temp); return temp; }
public String toString() { return "\n\tAccount Profile Data for userID:" + getUserID() + "\n\t\t passwd:" + getPassword() + "\n\t\t fullName:" + getFullName() + "\n\t\t address:" + getAddress() + "\n\t\t email:" + getEmail() + "\n\t\t creditCard:" + getCreditCard() ; }
public AccountProfileDataBean(String userID, String password, String fullName, String address, String email, String creditCard) { setUserID(userID); setPassword(password); setFullName(fullName); setAddress(address); setEmail(email); setCreditCard(creditCard); }
public AccountDataBean getAccountData(String userID) { if (Log.doTrace()) Log.trace("TradeJPADirect:getAccountData", userID); AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID); /* * Inflate the lazy data memebers */ AccountDataBean account = profile.getAccount(); account.getProfile(); // Added to populate transient field for account account.setProfileID(profile.getUserID()); return account; }
profile = new AccountProfileDataBean(userID, password, fullname, address, email, creditcard); account = new AccountDataBean(0, 0, null, new Timestamp(System.currentTimeMillis()), openBalance, openBalance, userID); profile.setAccount(account); account.setProfile(profile);