示例#1
0
 private void getApvNumber(ArrayList<ArrayList<String>> list) throws java.sql.SQLException {
   PreparedStatement psType =
       c.createPreparedStatement(
           "select OD.type_description from "
               + "cmstrkdb.object_assembly OA, "
               + "cmstrkdb.object_description OD WHERE"
               + " OA.object=OD.object AND OA.type=OD.type AND "
               + "OA.version=OD.version AND OA.object='HYB' AND "
               + "OA.container_id=?");
   for (int i = 0; i < list.size(); i++) {
     ArrayList<String> v = list.get(i);
     ArrayList<ArrayList<String>> res = c.preparedSelectQuery(psType, v.get(0));
     if (res.size() > 0) {
       String type = (res.get(0)).get(0);
       type = type.substring(type.indexOf('.') + 1, type.length() - 1);
       v.add(type);
     } else {
       v.add("4");
       Error("Type of hybrid contained in module " + v.get(0) + " unknown!!");
     }
     if (DetIDGenerator.verbose) System.out.print(((i * 100) / list.size()) + " %\r");
   }
   psType.close();
 }
示例#2
0
  private void getDCU(ArrayList<ArrayList<String>> list) throws java.sql.SQLException {
    // 1 method for TOB dcus
    PreparedStatement tob =
        c.createPreparedStatement(
            "select MB.dcuhardid from "
                + "cmstrkdb.TOBTESTINGMODULEBASIC_1_MOD_ MB "
                + "where MB.status='reference' AND MB.object_id=?");

    // 4 different methods for TEC (trye the first, if fails try the second ...)
    PreparedStatement psTec1 =
        c.createPreparedStatement(
            "select MB.dcuid from cmstrkdb.modvalidation_2_mod_ MV, "
                + "cmstrkdb.modulbasic_2_mod_ MB "
                + "where MB.test_id=MV.modulbasic_2_mod_ AND "
                + "MV.status='reference' AND MV.object_id=?");
    PreparedStatement psTec2 =
        c.createPreparedStatement(
            "select distinct FP.dcu_id from "
                + "cmstrkdb.hybproducer_1_hyb_ HP, "
                + "cmstrkdb.object_assembly OA, "
                + "cmstrkdb.fhitproduction_1_hyb_ FP where "
                + "HP.fhitproduction_1_hyb_=FP.test_id AND "
                + "OA.object_id=HP.object_id AND OA.object='HYB'"
                + " AND OA.container_id=?");
    PreparedStatement psTec3 =
        c.createPreparedStatement(
            "select distinct FR.dcu_id from "
                + "cmstrkdb.hybmeasurements_2_hyb_ HM, "
                + "cmstrkdb.object_assembly OA, "
                + "cmstrkdb.fhitreception_1_hyb_ FR where "
                + "HM.fhitreception_1_hyb_=FR.test_id AND "
                + "OA.object_id=HM.object_id AND OA.object='HYB' "
                + "AND OA.container_id=?");
    PreparedStatement psTec4 =
        c.createPreparedStatement(
            "select distinct FP.dcu_id from "
                + "cmstrkdb.object_assembly OA, "
                + "cmstrkdb.fhitproduction_1_hyb_ FP where "
                + "OA.object_id=FP.object_id AND OA.object='HYB' "
                + "AND OA.container_id=?");

    for (int i = 0; i < list.size(); i++) {
      ArrayList<String> v = list.get(i);

      DetIdConverter det = new DetIdConverter(Integer.parseInt(v.get(1)));
      if (det.getSubDetector() == 6) { // TEC
        ArrayList<ArrayList<String>> res = c.preparedSelectQuery(psTec1, v.get(0));
        if (res.size() == 1 && (res.get(0)).get(0) != null && !(res.get(0)).get(0).equals("0")) {
          ArrayList<String> detail = res.get(0);
          v.set(0, detail.get(0));
        } else {
          res = c.preparedSelectQuery(psTec2, v.get(0));
          if (res.size() == 1 && (res.get(0)).get(0) != null && !(res.get(0)).get(0).equals("0")) {
            ArrayList<String> detail = res.get(0);
            v.set(0, detail.get(0));
          } else {
            res = c.preparedSelectQuery(psTec3, v.get(0));
            if (res.size() == 1
                && (res.get(0)).get(0) != null
                && !(res.get(0)).get(0).equals("0")) {
              ArrayList<String> detail = res.get(0);
              v.set(0, detail.get(0));
            } else {
              res = c.preparedSelectQuery(psTec4, v.get(0));
              if (res.size() == 1
                  && (res.get(0)).get(0) != null
                  && !(res.get(0)).get(0).equals("0")) {
                ArrayList<String> detail = res.get(0);
                v.set(0, detail.get(0));
              } else {
                Error("DCU_ID of module " + v.get(0) + " unknown!!");
              }
            }
          }
        }
      }
      if (det.getSubDetector() == 5) { // TOB
        ArrayList<ArrayList<String>> res = c.preparedSelectQuery(tob, v.get(0));
        if (res.size() == 1 && (res.get(0)).get(0) != null && !(res.get(0)).get(0).equals("0")) {
          ArrayList<String> detail = res.get(0);
          int dcuId = reverseDcuId(Integer.parseInt(detail.get(0)));
          v.set(0, dcuId + "");
        } else {
          Error("DCU_ID of module " + v.get(0) + " unknown!!");
          v.set(0, "0");
        }
      }
      if (DetIDGenerator.verbose) System.out.print(((i * 100) / list.size()) + " %\r");
    }
    tob.close();
    psTec1.close();
    psTec2.close();
    psTec3.close();
    psTec4.close();
  }
示例#3
0
  private void getFiberLength(ArrayList<ArrayList<String>> list) throws java.sql.SQLException {

    PreparedStatement modules =
        c.createPreparedStatement(
            "select OA2.object_id, OA2.number_in_container from cmstrkdb.object_assembly OA, cmstrkdb.object_assembly OA2 WHERE OA2.object='AOH' AND OA2.number_in_container=OA.number_in_container AND OA2.container_id=OA.container_id AND OA.object_id=?");
    PreparedStatement aoh =
        c.createPreparedStatement(
            "select G.fiber_length from cmstrkdb.aohgeneral_1_aoh_ G, cmstrkdb.aohcomp_1_aoh_ C where C.aohgeneral_1_aoh_=G.test_id AND C.object_id=?");
    PreparedStatement length =
        c.createPreparedStatement(
            "select distinct D.fanout_length from cmstrkdb.manufacture_1_optfanout_ M, cmstrkdb.diamond_1_optfanout_ D, cmstrkdb.object_assembly FANOUT, cmstrkdb.object_assembly AOH, cmstrkdb.object_assembly LASTRANS, cmstrkdb.link L WHERE M.diamond_1_optfanout_=D.test_id AND M.object_id=FANOUT.object_id AND L.object_id_b=FANOUT.object_id AND L.object_id_a=LASTRANS.object_id AND LASTRANS.container_id=AOH.object_id AND AOH.object_id=?");

    for (int i = 0; i < list.size(); i++) {
      try {
        ArrayList<String> v = list.get(i);

        String cDetID = new String(v.get(1));

        String[] det_id = cDetID.split("\\.");
        int tec = Integer.parseInt(det_id[2]);
        int disk = Integer.parseInt(det_id[3]);
        int front = Integer.parseInt(det_id[4]);
        int sector = Integer.parseInt(det_id[5]);
        // System.out.println(tec+" "+disk+" "+front+" "+sector);

        ArrayList<ArrayList<String>> res = c.preparedSelectQuery(modules, v.get(0));
        if (res.size() > 0) {
          String aoh_id = (res.get(0)).get(0);
          int aoh_position = Integer.parseInt((res.get(0)).get(1));

          ArrayList<ArrayList<String>> lengthRes = c.preparedSelectQuery(aoh, aoh_id);
          if (lengthRes.size() > 0) {
            int aoh_length = Integer.parseInt((lengthRes.get(0)).get(0));

            ArrayList<ArrayList<String>> lengthRes2 = c.preparedSelectQuery(length, aoh_id);
            if (lengthRes2.size() == 1) {
              float total_length = aoh_length + Integer.parseInt((lengthRes2.get(0)).get(0));
              v.add((total_length / 10) + ""); // The size should be in centimeters
            } else {
              v.add("1");
              if (lengthRes2.size() > 1)
                throw new Exception("Can not find unique length for the aoh " + aoh_id);
              else throw new Exception("Data are missing for this AOH : " + aoh_id);
            }
          } else {
            v.add("1");
            throw new Exception("Can not find the length of the aoh " + aoh_id);
          }
        } else {
          v.add("1");
          throw new Exception("Can not find the AOH corresponding to module " + v.get(0));
        }
        if (DetIDGenerator.verbose) System.out.print(((i * 100) / list.size()) + " %\r");

      } catch (java.sql.SQLException e) {
        throw e;
      } catch (Exception e) {
        Error(e.getMessage());
      }
    }
    // Close the statements
    modules.close();
    aoh.close();
    length.close();
  }