Package org.radargun.stages.tpcc.domain

Examples of org.radargun.stages.tpcc.domain.District


      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;
View Full Code Here


            log.info("Index:" + slaveIndex + "; Init:" + init_id_district + "; Num:" + num_of_districts);
         }
         for (int id_district = init_id_district; id_district <= (init_id_district - 1 + num_of_districts); id_district++) {
            log.info(" DISTRICT " + id_district);

            District newDistrict = new District(id_wharehouse,
                                                id_district,
                                                TpccTools.aleaChainec(6, 10),
                                                TpccTools.aleaChainec(10, 20),
                                                TpccTools.aleaChainec(10, 20),
                                                TpccTools.aleaChainec(10, 20),
                                                TpccTools.aleaChainel(2, 2),
                                                TpccTools.aleaChainen(4, 4) + TpccTools.CHAINE_5_1,
                                                TpccTools.aleaFloat(Float.valueOf("0.0000").floatValue(), Float.valueOf("0.2000").floatValue(), 4),
                                                TpccTools.WAREHOUSE_YTD,
                                                3001);

            boolean successful = false;
            while (!successful) {
               try {
                  newDistrict.store(basicCache);
                  successful = true;
               } catch (Throwable e) {
                  log.warn("Storing new district failed", e);
               }
            }
View Full Code Here

      found = w.load(basicCache);
      if (!found) throw new ElementNotFoundException("W_ID=" + w_id + " not found!");


      District d = new District();
      // see clause 2.4.2.2 (dot 4)


      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!");


      o_id = d.getD_next_o_id();


      NewOrder no = new NewOrder(o_id, d_id, w_id);

      no.store(basicCache);

      d.setD_next_o_id(d.getD_next_o_id() + 1);

      d.store(basicCache);


      Order o = new Order(o_id, d_id, w_id, c_id, new Date(), -1, o_ol_cnt, o_all_local);

      o.store(basicCache);
View Full Code Here

TOP

Related Classes of org.radargun.stages.tpcc.domain.District

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.