boolean found = w.load(basicCache);
if (!found) throw new ElementNotFoundException("W_ID=" + w_id + " not found!");
w.setW_ytd(h_amount);
w.store(basicCache);
District d = new District();
d.setD_id(d_id);
d.setD_w_id(w_id);
found = d.load(basicCache);
if (!found) throw new ElementNotFoundException("D_ID=" + d_id + " D_W_ID=" + w_id + " not found!");
d.setD_ytd(h_amount);
d.store(basicCache);
Customer c = null;
if (c_by_name) {
new_c_last = c_last;
List cList = null;
cList = CustomerDAC.loadByCLast(basicCache, c_w_id, c_d_id, new_c_last);
if (cList == null || cList.isEmpty())
throw new ElementNotFoundException("C_LAST=" + c_last + " C_D_ID=" + c_d_id + " C_W_ID=" + c_w_id + " not found!");
Collections.sort(cList);
namecnt = cList.size();
if (namecnt % 2 == 1) namecnt++;
Iterator<Customer> itr = cList.iterator();
for (int i = 1; i <= namecnt / 2; i++) {
c = itr.next();
}
} else {
c = new Customer();
c.setC_id(c_id);
c.setC_d_id(c_d_id);
c.setC_w_id(c_w_id);
found = c.load(basicCache);
if (!found)
throw new ElementNotFoundException("C_ID=" + c_id + " C_D_ID=" + c_d_id + " C_W_ID=" + c_w_id + " not found!");
}
c.setC_balance(c.getC_balance() + h_amount);
if (c.getC_credit().equals("BC")) {
c_data = c.getC_data();
c_new_data = c.getC_id() + " " + c_d_id + " " + c_w_id + " " + d_id + " " + w_id + " " + h_amount + " |";
if (c_data.length() > c_new_data.length()) {
c_new_data += c_data.substring(0, c_data.length() - c_new_data.length());
} else {
c_new_data += c_data;
}
if (c_new_data.length() > 500) c_new_data = c_new_data.substring(0, 500);
c.setC_data(c_new_data);
c.store(basicCache);
} else {
c.store(basicCache);
}
w_name = w.getW_name();
d_name = d.getD_name();
if (w_name.length() > 10) w_name = w_name.substring(0, 10);
if (d_name.length() > 10) d_name = d_name.substring(0, 10);
h_data = w_name + " " + d_name;