Ejemplo n.º 1
0
 public static void main(String[] args) {
   try {
     System.out.println("TRY");
     hashtableList = new ArrayList<Hashtable<String, String>>();
     hashtable = new Hashtable<String, String>();
     allreadyRespondDao = new AllreadyRespondDao();
     allreadyRespondList =
         allreadyRespondDao.findByTextAndDeleted("Status:67453747441307648", "0");
     System.out.println("リストの長さは、" + allreadyRespondList.size());
     for (AllreadyRespond ar : allreadyRespondList) {
       Hashtable<String, String> ht = new Hashtable<String, String>();
       ht.put("ID", Integer.toString(ar.getId()));
       ht.put("USER", ar.getUser());
       hashtableList.add(ht);
     }
     xml = new XML(hashtableList, hashtable, null, "", "OK", "YYYYMMDD");
   } catch (Exception e) {
     System.out.println("CATCH");
     e.printStackTrace();
     xml = new XML(hashtableList, hashtable, e, e.getClass().getName(), "OK", "YYYYMMDD");
   } finally {
     try {
       System.out.println(xml.XMLGeneral());
     } catch (Exception we) {
       StringRelay.showException(we);
     }
   }
 }
Ejemplo n.º 2
0
  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws IOException, ServletException {
    // 表示設定
    res.setContentType(contentType);
    PrintWriter out = res.getWriter();

    // パラメータ初期化
    date = "";
    num = 0;

    // 変数初期化
    hashTable = new Hashtable<String, String>();
    hashTable.put("", "");
    hashTableList = new ArrayList<Hashtable<String, String>>();
    mongonMstList = new ArrayList<MongonMst>();

    // log4j設定&文言設定
    try {
      logSet();
      initSet();
    } catch (Exception e) {
      xml =
          new XML(hashTableList, hashTable, e.getClass().getName(), "NG", StringRelay.getNowDate());
      out.println(xml.XMLGen());
      return;
    }

    try {
      if (req.getParameter("date") != null) {
        date = req.getParameter("date").trim();
        try {
          StringRelay.checkDateFormat(date, "yyyyMMdd");
          if (req.getParameter("num") != null) {
            num = Integer.parseInt(req.getParameter("num"));
            if (num <= 0) throw new KeyIsNotSpecifiedException();
          } else {
            num = defaultPostNum;
          }
        } catch (Exception e) {
          putMessage("WARN", warn0002, new String[] {date, Integer.toString(num)});
          throw e;
        }

        // 文言検索
        mongonMstDao = new MongonMstDao();
        mongonMstList = mongonMstDao.findByLastYmdAndDeleted(date, "0", num);

        // 結果設定
        for (MongonMst mongonMst : mongonMstList) {
          Hashtable<String, String> ht = new Hashtable<String, String>();
          ht.put("USER", mongonMst.getMongonmstcmpstid1().getUser());
          ht.put("SEQ", Integer.toString(mongonMst.getMongonmstcmpstid1().getSeq()));
          ht.put("MONGON", mongonMst.getMongon());
          hashTableList.add(ht);
        }

        // XML出力(正常終了)
        xml = new XML(hashTableList, hashTable, "", "OK", StringRelay.getNowDate());
        out.println(xml.XMLGen());
      } else {
        putMessage("WARN", warn0001, new String[] {});
        throw new KeyIsNullException();
      }
    } catch (Exception e) {
      BatchProcCtrlException(e.getClass().getName());
      putMessage("ERROR", StringRelay.showException(e), new String[] {});

      // XML出力(異常終了)
      xml =
          new XML(hashTableList, hashTable, e.getClass().getName(), "NG", StringRelay.getNowDate());
      out.println(xml.XMLGen());
    }
  }