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);
     }
   }
 }
Example #2
0
  @Override
  public void logSet() throws LogException {
    // TODO Auto-generated method stub
    try {
      Properties prop = new Properties();
      InputStream is = MongonNext.class.getClassLoader().getResourceAsStream(logs);
      prop.load(is);
      is.close();

      // プロパティファイル最適化
      for (int i = 0; i < loggingPath.length; i++) {
        if (new File(loggingPath[i]).exists()) {
          prop.setProperty(
              "log4j.appender.SDFPLOG.File",
              loggingPath[i] + operatorLogName + "." + StringRelay.getTodayYMD());
        } else {
          continue;
        }
      }

      logger = Logger.getLogger(aplName);
      PropertyConfigurator.configure(prop);
    } catch (Exception e) {
      LogException le = new LogException(e);
      throw le;
    }
  }
Example #3
0
 @Override
 public void initSet() throws InitException {
   // TODO Auto-generated method stub
   try {
     Properties prop = new Properties();
     InputStream is = MongonNext.class.getClassLoader().getResourceAsStream(sentenses);
     prop.load(is);
     is.close();
     warn0001 = StringRelay.toSJIS(prop.getProperty(sysName + "." + aplName + ".warn0001"));
     warn0002 = StringRelay.toSJIS(prop.getProperty(sysName + "." + aplName + ".warn0002"));
     error0001 = StringRelay.toSJIS(prop.getProperty(sysName + "." + aplName + ".error0001"));
   } catch (Exception e) {
     InitException ie = new InitException(e);
     throw ie;
   }
 }
Example #4
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());
    }
  }