예제 #1
0
 public void code() throws IOException {
   HttpServletResponse response = ActionUtil.getResponse();
   HttpSession session = ActionUtil.getSession();
   response.setContentType("image/jpeg");
   response.setHeader("Pragma", "no-cache");
   response.setHeader("Cache-Control", "no-cache");
   response.setDateHeader("Expires", 0);
   VerifyCodeUtil verifyCode = new VerifyCodeUtil(100, 30, 5, 10);
   session.setAttribute("verifyCode", verifyCode.getCode());
   verifyCode.write(response.getOutputStream());
 }
예제 #2
0
 public String doAction(int actFlag) {
   Map<String, Object> queConfig = objectValidity(qcoId, "HiQueConfig", "hiquery", "qco");
   if (queConfig == null) {
     return txt(getResource("hiquery.getobject.fail", qcoId), null);
   }
   String info = "";
   Session ses = openSession();
   try {
     switch (actFlag) {
       case ActionConstant.HiQueryActionFlag.QUERY:
         String qcoConfig = ActionUtil.isNvl(queConfig.get("qcoConfig"));
         HttpServletRequest req = ActionUtil.getRequest();
         String configText = QueryUtil.hiConfigText(conn, req, qcoConfig);
         String forwardUrl = ConfigTextUtil.getNodeTextIfThen(configText, "QUERY.FORWARD").trim();
         if (!forwardUrl.equals("")) {
           return dispatch(null, forwardUrl);
         }
         queryService.queryExternalClass(req, req.getSession(), configText, "init");
         //		        ses = sesFactory.openSession();
         queryService.doFilter(ses, conn, this);
         queryService.doList(ses, conn, this);
         queryService.queryExternalClass(req, req.getSession(), configText, "process");
         //				ses.close();
         break;
       case ActionConstant.HiQueryActionFlag.FILTER:
         queryService.doFilter(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.LIST:
         queryService.doList(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.QUERYDATA:
         queryService.doListdata(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.LISTDATA:
         queryService.doListdata(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.SQL:
         ActionPrinter.printToPlain(getSql());
         break;
       case ActionConstant.HiQueryActionFlag.TREE:
         queryService.doTree(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.EXPORT:
         queryService.doExport(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.CHART:
         queryService.doChart(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.AMCHART:
         queryService.doAmChart(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.ECHART:
         queryService.doEChart(ses, conn, this);
         break;
       case ActionConstant.HiQueryActionFlag.STANDATA:
         info =
             queryService.doJsonData(ses, conn, this, ActionConstant.HiQueryActionFlag.STANDATA);
         break;
       case ActionConstant.HiQueryActionFlag.TRANDATA:
         info =
             queryService.doJsonData(ses, conn, this, ActionConstant.HiQueryActionFlag.TRANDATA);
         break;
       case ActionConstant.HiQueryActionFlag.DATA:
         info = queryService.doJsonData(ses, conn, this, ActionConstant.HiQueryActionFlag.DATA);
         break;
       case ActionConstant.HiQueryActionFlag.JSON:
         info = queryService.doJsonData(ses, conn, this, ActionConstant.HiQueryActionFlag.JSON);
         break;
       case ActionConstant.HiQueryActionFlag.PLATDATA:
         info =
             queryService.doJsonData(ses, conn, this, ActionConstant.HiQueryActionFlag.PLATDATA);
         break;
       default:
         break;
     }
   } catch (Exception e) {
     log.info(e.getMessage());
   } finally {
     closeSession(ses);
   }
   if (actFlag == ActionConstant.HiQueryActionFlag.QUERY
       || actFlag == ActionConstant.HiQueryActionFlag.FILTER
       || actFlag == ActionConstant.HiQueryActionFlag.LIST
       || actFlag == ActionConstant.HiQueryActionFlag.TREE
       || actFlag == ActionConstant.HiQueryActionFlag.CHART
       || actFlag == ActionConstant.HiQueryActionFlag.ECHART
       || actFlag == ActionConstant.HiQueryActionFlag.AMCHART) {
     return html();
   } else if (actFlag == ActionConstant.HiQueryActionFlag.STANDATA
       || actFlag == ActionConstant.HiQueryActionFlag.TRANDATA
       || actFlag == ActionConstant.HiQueryActionFlag.DATA
       || actFlag == ActionConstant.HiQueryActionFlag.JSON
       || actFlag == ActionConstant.HiQueryActionFlag.PLATDATA) {
     return json(info, null);
   } else if (actFlag == ActionConstant.HiQueryActionFlag.EXPORT) {
     return txt();
   } else {
     return txt();
   }
 }