public void establishAccount(ServiceAcctInfo acct) { String[] args = {Integer.toString(acct.ID)}; Cursor cur = db.query("acct", AC_COLS, "service_id=?", args, null, null, null); try { if (cur.moveToNext()) return; } finally { cur.close(); } Account newAcct = new Account(); newAcct.serviceId = acct.ID; newAcct.name = acct.desc; addAccount(newAcct); }
public Account getAccountFromCursor(Cursor cur) { Account acct = new Account(); acct.ID = cur.getInt(0); acct.serviceId = cur.getInt(1); acct.name = cur.getString(2); String iAge = cur.getString(3); acct.lastUpdate = (iAge != null) ? new Date(Long.parseLong(iAge)) : null; acct.curBalAmt = cur.getDouble(4); iAge = cur.getString(5); acct.curBalDate = (iAge != null) ? new Date(Long.parseLong(iAge)) : null; acct.availBalAmt = cur.getDouble(6); iAge = cur.getString(7); acct.availBalDate = (iAge != null) ? new Date(Long.parseLong(iAge)) : null; iAge = cur.getString(8); acct.lastTrans = (iAge != null) ? new Date(Long.parseLong(iAge)) : null; return acct; }
public Account copy() { Account dst = new Account(); copyValues(dst); if (identifier != null) { dst.identifier = new ArrayList<Identifier>(); for (Identifier i : identifier) dst.identifier.add(i.copy()); } ; dst.name = name == null ? null : name.copy(); dst.type = type == null ? null : type.copy(); dst.status = status == null ? null : status.copy(); dst.activePeriod = activePeriod == null ? null : activePeriod.copy(); dst.currency = currency == null ? null : currency.copy(); dst.balance = balance == null ? null : balance.copy(); dst.coveragePeriod = coveragePeriod == null ? null : coveragePeriod.copy(); dst.subject = subject == null ? null : subject.copy(); dst.owner = owner == null ? null : owner.copy(); dst.description = description == null ? null : description.copy(); return dst; }
public Account createAccount(BigDecimal balance) { Account account = new Account(); account.balance = balance; account.name = generateString(new Random(), "Test name", 10); return account; }