Ejemplo n.º 1
0
 public String getFilterConditionExpression(
     ReportRequest rrequest, ReportBean rbean, ReportDataSetValueBean datasetbean) {
   AbsListReportFilterBean filterBean = rrequest.getCdb(rbean.getId()).getFilteredBean();
   if (filterBean == null) return null;
   ColBean cbTmp = (ColBean) filterBean.getOwner();
   if (!cbTmp.isMatchDataSet(datasetbean)) return null;
   String filterval = rrequest.getStringAttribute(filterBean.getId(), "");
   if (filterval.equals("")) return null;
   if (cbTmp.getDatatypeObj() == null
       || cbTmp.getDatatypeObj() instanceof VarcharType
       || cbTmp.getDatatypeObj() instanceof AbsDateTimeType) {
     filterval = Tools.replaceAll(filterval, ";;", "','");
     if (!filterval.startsWith("'")) filterval = "'" + filterval;
     if (filterval.endsWith("','")) filterval = filterval.substring(0, filterval.length() - 3);
     if (!filterval.endsWith("'")) filterval = filterval + "'";
     if (filterval.equals("'")) filterval = "";
   } else {
     filterval = Tools.replaceAll(filterval, ";;", ",");
     if (filterval.endsWith(",")) filterval = filterval.substring(0, filterval.length() - 1);
   }
   String where = null;
   String column = null;
   if (filterBean.getFilterColumnExpression() != null
       && !filterBean.getFilterColumnExpression().trim().equals("")) {
     column = filterBean.getFilterColumnExpression();
   } else {
     column = cbTmp.getColumn();
   }
   if (!filterval.trim().equals("")) {
     where = " where " + column + " in (" + filterval + ") ";
   }
   return where;
 }
Ejemplo n.º 2
0
  public String createColumnFilter(ReportRequest rrequest, AbsListReportColBean alrcbean) {
    ReportBean rbean = alrcbean.getOwner().getReportBean();
    StringBuffer resultBuf = new StringBuffer();
    AbsListReportFilterBean filterbean = alrcbean.getFilterBean();
    StringBuffer paramsBuf = new StringBuffer();
    paramsBuf.append("{reportguid:\"").append(rbean.getGuid()).append("\"");
    paramsBuf
        .append(",property:\"")
        .append(((ColBean) alrcbean.getOwner()).getProperty())
        .append("\"");
    paramsBuf.append(",webroot:\"").append(Config.webroot).append("\"");
    paramsBuf.append(",skin:\"").append(rrequest.getPageskin()).append("\"");
    CacheDataBean cdb = rrequest.getCdb(rbean.getId());

    String imgurl = "/webresources/skin/" + rrequest.getPageskin() + "/images/";
    paramsBuf.append(",urlParamName:\"");
    if (filterbean.isConditionRelate()) {
      paramsBuf.append(filterbean.getConditionname()).append("\"");
      paramsBuf.append(",multiply:\"false\"");
      String filtervalue = rrequest.getStringAttribute(filterbean.getConditionname(), "");
      if (!filtervalue.equals("")) {
        imgurl = imgurl + "filter2.jpg";
      } else {
        imgurl = imgurl + "filter1.jpg";
      }
    } else {
      paramsBuf.append(filterbean.getId()).append("\"");
      paramsBuf.append(",multiply:\"true\"");
      String filtervalue = rrequest.getStringAttribute(filterbean.getId(), "");
      if (cdb.getFilteredBean() == null
          || filtervalue.trim().equals("")
          || !filterbean.equals(cdb.getFilteredBean())) {
        imgurl = imgurl + "filter1.jpg";
      } else {
        imgurl = imgurl + "filter2.jpg";
      }
    }
    imgurl = Tools.replaceAll(Config.webroot + imgurl, "//", "/"); // 过滤图片路径

    paramsBuf.append(",filterwidth:").append(filterbean.getFilterwidth());
    paramsBuf.append(",filtermaxheight:").append(filterbean.getFiltermaxheight());
    paramsBuf.append("}");
    resultBuf
        .append("<SPAN class=\"filter_span\"><input type=\"button\" id=\"")
        .append(rbean.getGuid() + alrcbean.hashCode())
        .append("\"");
    resultBuf.append(
        " onmouseout=\"try{drag_enabled=true;}catch(e){}\" onmouseover=\"try{drag_enabled=false;this.style.cursor='pointer';}catch(e){}\"");
    resultBuf
        .append(
            " style=\"width:16px;height:17px;background-color:transparent;border:0; background-image: url(")
        .append(imgurl + ");\"");
    resultBuf
        .append(" onclick=\"try{getFilterDataList(this,'")
        .append(Tools.jsParamEncode(paramsBuf.toString()))
        .append("');return false;}catch(e){logErrorsAsJsFileLoad(e);}\"");
    resultBuf.append("/></SPAN>");
    return resultBuf.toString();
  }
Ejemplo n.º 3
0
 public void doPostLoad() {
   DisplayBean dbean = (DisplayBean) this.getOwner();
   String[] strs =
       ListReportAssistant.getInstance().calColPosition(null, this, dbean.getLstCols(), null);
   this.defaultFirstColid = strs[0];
   this.defaultLastColId = strs[1];
   this.setDefaultColumnCount(Integer.parseInt(strs[2]));
   AbsListReportColBean alrcbean;
   AbsListReportBean alrbean =
       (AbsListReportBean)
           dbean.getReportBean().getExtendConfigDataForReportType(AbsListReportType.KEY);
   boolean isFirstCol = true;
   for (ColBean cbean : dbean.getLstCols()) {
     if (cbean.getDisplaytype().equals(Consts.COL_DISPLAYTYPE_HIDDEN)) continue;
     String borderstyle = cbean.getBorderStylePropertyOnColBean();
     if (borderstyle != null && !borderstyle.trim().equals("")) {
       cbean.setValuestyleproperty(
           Tools.mergeHtmlTagPropertyString(
               cbean.getValuestyleproperty(null, true), "style=\"" + borderstyle + "\"", 1),
           true);
     }
     if (!isFirstCol
         && this.getRowGroupColsNum() > 0
         && this.getRowgrouptype() == 2
         && alrbean.getScrollType() == AbsListReportBean.SCROLLTYPE_VERTICAL) {
       if (Tools.getPropertyValueByName("width", cbean.getValuestyleproperty(null, true), true)
               != null
           || Tools.getPropertyValueByName("width", cbean.getLabelstyleproperty(null, true), true)
               != null) {
         throw new WabacusConfigLoadingException(
             "加载报表"
                 + cbean.getReportBean().getPath()
                 + "失败,此报表是配置了scrollheight的树形报表,因此除第一列之外,其它列均不能配置width属性");
       }
     }
     isFirstCol = false;
     alrcbean =
         (AbsListReportColBean) cbean.getExtendConfigDataForReportType(AbsListReportType.KEY);
     if (alrcbean == null) continue;
     if (alrcbean.isRequireClickOrderby()) {
       if (cbean.getDatasetValueId() != null && !cbean.getDatasetValueId().trim().equals("")) {
         if (dbean.getReportBean().getSbean().isExistDependentDataset(cbean.getDatasetValueId())) {
           throw new WabacusConfigLoadingException(
               "加载报表"
                   + cbean.getReportBean().getPath()
                   + "的列"
                   + cbean.getLabel(null)
                   + "失败,当前列是从子数据集中取数据,不能为它配置列排序功能");
         }
       }
     }
     if (alrcbean.getFilterBean() != null) {
       alrcbean.getFilterBean().doPostLoad();
     }
   }
 }
Ejemplo n.º 4
0
 private void parseStandardSqlParamBean(EditableReportParamBean paramBean, String reportTypeKey) {
   if (Tools.isDefineKey("@", paramBean.getParamname())) {
     if (this
         .isAutoReportdata()) { // 自动获取某列的数据进行保存操作(这个判断主要是针对配置更新脚本的<button/>,因为它的@{param}数据有可能是客户端传的,而不是从报表中获取的)
       String configproperty = Tools.getRealKeyByDefine("@", paramBean.getParamname());
       String realproperty = configproperty;
       if (realproperty.endsWith("__old"))
         realproperty = realproperty.substring(0, realproperty.length() - "__old".length());
       ColBean cbeanUpdateDest =
           this.owner.getReportBean().getDbean().getColBeanByColProperty(realproperty);
       if (cbeanUpdateDest == null) {
         throw new WabacusConfigLoadingException(
             "解析报表的更新语句失败,没有找到column/property属性为" + realproperty + "的列");
       }
       if (cbeanUpdateDest.isNonValueCol()
           || cbeanUpdateDest.isSequenceCol()
           || cbeanUpdateDest.isControlCol()) {
         throw new WabacusConfigLoadingException(
             "加载报表"
                 + this.owner.getReportBean().getPath()
                 + "失败,列"
                 + cbeanUpdateDest.getColumn()
                 + "不是从数据库获取数据的列,不能取其数据");
       }
       EditableReportColBean ercbeanDest =
           (EditableReportColBean) cbeanUpdateDest.getExtendConfigDataForReportType(reportTypeKey);
       if (ercbeanDest == null) {
         ercbeanDest = new EditableReportColBean(cbeanUpdateDest);
         cbeanUpdateDest.setExtendConfigDataForReportType(reportTypeKey, ercbeanDest);
       } else {
         paramBean.setDefaultvalue(ercbeanDest.getDefaultvalue());
       }
       paramBean.setOwner(cbeanUpdateDest);
       ColBean cbeanUpdateSrc = cbeanUpdateDest;
       if (Consts.COL_DISPLAYTYPE_HIDDEN.equals(cbeanUpdateDest.getDisplaytype())) {
         ColBean cbSrcTmp = cbeanUpdateDest.getUpdateColBeanSrc(false);
         if (cbSrcTmp != null) cbeanUpdateSrc = cbSrcTmp;
       }
       setParamBeanInfoOfColBean(cbeanUpdateSrc, paramBean, configproperty, reportTypeKey);
     } else {
       ((EditableReportSQLButtonDataBean) this).setHasReportDataParams(true);
     }
   } else if (Tools.isDefineKey("#", paramBean.getParamname())) {
     String paramname = Tools.getRealKeyByDefine("#", paramBean.getParamname());
     paramBean.setParamname(paramname);
     paramBean.setOwner(this.getExternalValueBeanByName(paramname, true));
   }
 }
Ejemplo n.º 5
0
 public String addColFilterConditionToSql(
     ReportRequest rrequest, ReportBean rbean, ReportDataSetValueBean datasetbean, String sql) {
   String where = getFilterConditionExpression(rrequest, rbean, datasetbean);
   if (where == null) where = "";
   sql = Tools.replaceAll(sql, Consts_Private.PLACEHODER_FILTERCONDITION, where);
   return sql;
 }
Ejemplo n.º 6
0
 public void addDynCsses(List<String> lstCsses) {
   if (lstCsses == null || lstCsses.size() == 0) return;
   if (this.lstDynCsses == null) this.lstDynCsses = new UniqueArrayList<String>();
   for (String cssTmp : lstCsses) {
     if (cssTmp == null || cssTmp.trim().equals("")) continue;
     this.lstDynCsses.add(
         Tools.replaceAll(cssTmp, Consts_Private.SKIN_PLACEHOLDER, rrequest.getPageskin()));
   }
 }
Ejemplo n.º 7
0
 public List<ReportBean> initDisplayOnPage() {
   this.lstCsses = ComponentAssistant.getInstance().initDisplayCss(rrequest);
   this.lstJavascripts = new UniqueArrayList<JavascriptFileBean>();
   this.lstJavascripts.addAll(pagebean.getLstSystemJavascriptFiles());
   String js = rrequest.getStringAttribute("JS", "");
   if (!js.equals("")) {
     js = Tools.htmlEncode(js);
     List<String> lstJsTmp = Tools.parseStringToList(js, ",", false);
     for (String jsTmp : lstJsTmp) {
       if (jsTmp == null || jsTmp.trim().equals("")) continue;
       if (!jsTmp.trim().startsWith(Config.webroot)
           && !jsTmp.trim().toLowerCase().startsWith("http://")) {
         jsTmp = Tools.replaceAll(Config.webroot + "/" + jsTmp, "//", "/");
       }
       this.lstJavascripts.add(new JavascriptFileBean(jsTmp, 0));
     }
   } else if (pagebean.getLstMyJavascriptFiles() != null) {
     this.lstJavascripts.addAll(pagebean.getLstMyJavascriptFiles());
   }
   return super.initDisplayOnPage();
 }
Ejemplo n.º 8
0
  static {

    //            systemheadjs="/webresources/script/wabacus_systemhead.js";

    //        {

    //
    // systemheadjs="/webresources/script/"+encode.toLowerCase()+"/wabacus_systemhead.js";

    systemheadjs = Config.webroot + "/webresources/script/wabacus_systemhead.js";
    systemheadjs = Tools.replaceAll(systemheadjs, "//", "/");
  }
Ejemplo n.º 9
0
 public void setBlobValue(int iindex, byte[] value, PreparedStatement pstmt) throws SQLException {
   if (value == null) {
     pstmt.setBinaryStream(iindex, null, 0);
   } else {
     try {
       ByteArrayInputStream in = Tools.getInputStreamFromBytesArray(value);
       pstmt.setBinaryStream(iindex, in, in.available());
       in.close();
     } catch (IOException e) {
       throw new WabacusRuntimeException("将字节流写入数据库失败", e);
     }
   }
 }
Ejemplo n.º 10
0
 public String constructSplitPageSql(AbsConvertSQLevel convertSqlObj, String dynorderby) {
   String sql = convertSqlObj.getConvertedSql();
   dynorderby = convertSqlObj.mixDynorderbyAndConfigOrderbyCols(dynorderby);
   sql = Tools.replaceAll(sql, SQLReportDataSetValueProvider.orderbyPlaceHolder, "");
   sql =
       "select * from (select rownumber() over(order by "
           + dynorderby
           + ") as ROWID,jd_temp_tbl1.* from("
           + sql
           + ") as jd_temp_tbl1) as jd_temp_tbl2 where ROWID > "
           + SQLReportDataSetValueProvider.startRowNumPlaceHolder
           + " AND ROWID<= "
           + SQLReportDataSetValueProvider.endRowNumPlaceHolder;
   return sql;
 }
Ejemplo n.º 11
0
 public void doPostLoad() {
   super.doPostLoad();
   String jspick =
       Tools.replaceAll(
           Config.webroot + "/webresources/component/datepicker/js/calendar.js", "//", "/");
   owner.getReportBean().getPageBean().addMyJavascriptFile(jspick, 0);
   jspick =
       Tools.replaceAll(
           Config.webroot + "/webresources/component/datepicker/js/calendar-setup.js", "//", "/");
   owner.getReportBean().getPageBean().addMyJavascriptFile(jspick, 0);
   jspick = Config.webroot + "/webresources/component/datepicker/js/";
   if (this.language == null
       || this.language.trim().equals("")
       || this.language.trim().equals(Consts_Private.LANGUAGE_ZH)) {
     jspick = jspick + "calendar-zh.js";
   } else {
     jspick = jspick + "calendar-en.js";
   }
   jspick = Tools.replaceAll(jspick, "//", "/");
   owner.getReportBean().getPageBean().addMyJavascriptFile(jspick, 0);
   String csspick = Config.webroot + "/webresources/component/datepicker/css/calendar.css";
   csspick = Tools.replaceAll(csspick, "//", "/");
   owner.getReportBean().getPageBean().addMyCss(csspick);
 }
Ejemplo n.º 12
0
 public byte[] getBlobValue(ResultSet rs, int iindex) throws SQLException {
   InputStream in = null;
   try {
     in = rs.getBinaryStream(iindex);
     if (in == null) return null;
     return Tools.getBytesArrayFromInputStream(in);
   } finally {
     if (in != null) {
       try {
         in.close();
       } catch (IOException e) {
         e.printStackTrace();
       }
     }
   }
 }
Ejemplo n.º 13
0
 public String constructSplitPageSql(AbsConvertSQLevel convertSqlObj) {
   String sql = convertSqlObj.getConvertedSql();
   String orderby = "";
   if (sql.indexOf(SQLReportDataSetValueProvider.orderbyPlaceHolder) > 0) {
     sql = Tools.replaceAll(sql, SQLReportDataSetValueProvider.orderbyPlaceHolder, "");
     orderby = "order by " + convertSqlObj.getOrderby();
   }
   sql =
       "SELECT * FROM(SELECT jd_temp_tbl1.*, rownumber() OVER("
           + orderby
           + ") as ROWID FROM("
           + sql
           + ") as jd_temp_tbl1) as jd_temp_tbl2 WHERE jd_temp_tbl2.ROWID<="
           + SQLReportDataSetValueProvider.endRowNumPlaceHolder
           + " and jd_temp_tbl2.ROWID>"
           + SQLReportDataSetValueProvider.startRowNumPlaceHolder;
   return sql;
 }
Ejemplo n.º 14
0
 public byte[] getBlobValue(ResultSet rs, int iindex) throws SQLException {
   Blob blob = (Blob) rs.getBlob(iindex);
   if (blob == null) return null;
   BufferedInputStream bin = null;
   try {
     bin = new BufferedInputStream(blob.getInputStream());
     return Tools.getBytesArrayFromInputStream(bin);
   } catch (Exception e) {
     log.error("读取二进制字段失败", e);
     return null;
   } finally {
     if (bin != null) {
       try {
         bin.close();
       } catch (IOException e) {
         e.printStackTrace();
       }
     }
   }
 }
Ejemplo n.º 15
0
 public String getColLabelWithOrderBy(ColBean cbean, ReportRequest rrequest, String dynlabel) {
   String ordercolumn = cbean.getColumn();
   String label = rrequest.getI18NStringValue(dynlabel);
   label = label == null ? "" : label.trim();
   if (rrequest.getShowtype() != Consts.DISPLAY_ON_PAGE) return label;
   if (ordercolumn == null || ordercolumn.trim().equals("")) return label;
   String[] orderbys =
       (String[]) rrequest.getAttribute(cbean.getReportBean().getId(), "ORDERBYARRAY");
   String arrow = "";
   String order = "asc";
   if (orderbys != null && orderbys.length == 2) {
     if (orderbys[0].equalsIgnoreCase(ordercolumn)) {
       arrow =
           " <img src='"
               + Config.webroot
               + "/webresources/skin/"
               + rrequest.getPageskin()
               + "/images/";
       if (orderbys[1] == null || orderbys[1].equalsIgnoreCase("desc")) {
         arrow = arrow + "desc.gif'>";
         order = "asc";
       } else {
         arrow = arrow + "asc.gif'>";
         order = "desc";
       }
     }
   }
   arrow = Tools.replaceAll(arrow, "//", "/");
   StringBuffer resultBuf = new StringBuffer();
   resultBuf.append("<span onmouseover=\"this.style.cursor='pointer';\" onclick=\"");
   resultBuf
       .append("try{clickorderby(this,'")
       .append(ordercolumn)
       .append("||")
       .append(order)
       .append("');}catch(e){logErrorsAsJsFileLoad(e);}\">");
   resultBuf.append(label).append(arrow);
   resultBuf.append("</span>");
   return resultBuf.toString();
 }
Ejemplo n.º 16
0
 public void loadExtendConfig(XmlElementBean eleJspHtml, AbsContainerConfigBean parentConfigBean) {
   super.loadExtendConfig(eleJspHtml, parentConfigBean);
   this.url = eleJspHtml.getContent();
   if (this.url == null || this.url.trim().equals("")) {
     throw new WabacusConfigLoadingException(
         "加载" + this.getPath() + "的<jsp/>标签失败,没有在标签内容中指定jsp文件访问URL");
   }
   this.url = this.url.trim();
   String iframe = eleJspHtml.attributeValue("iframe");
   this.isInIFrame = iframe != null && iframe.toLowerCase().trim().equals("true");
   if (this.isInIFrame) {
     if (this.belongto != null && !this.belongto.trim().equals("")) {
       throw new WabacusConfigLoadingException(
           "加载" + this.getPath() + "的<jsp/>标签失败,当其iframe属性为true时,不能配置其belongto属性");
     }
     if (!this.url.startsWith(Config.webroot) && !this.url.toLowerCase().startsWith("http://")) {
       this.url = Config.webroot + "/" + this.url;
       this.url = Tools.replaceAll(this.url, "//", "/");
     }
     this.iframestyleproperty = eleJspHtml.attributeValue("iframestyleproperty");
   }
 }
Ejemplo n.º 17
0
 private void processDependParams(ReportBean rbeanSlave, ReportBean rbeanMaster) {
   Map<String, Map<String, String>> mDependParams = rbeanMaster.getMDependChilds();
   if (mDependParams == null) {
     mDependParams = new HashMap<String, Map<String, String>>();
     rbeanMaster.setMDependChilds(mDependParams);
   }
   if (rbeanSlave.getDependparams() == null || rbeanSlave.getDependparams().trim().equals("")) {
     throw new WabacusConfigLoadingException(
         "加载页面"
             + this.getPath()
             + "失败,其下的报表"
             + rbeanSlave.getId()
             + "依赖其它报表,但不存在依赖的动态参数,无法完成依赖操作");
   }
   List<String> lstParams = Tools.parseStringToList(rbeanSlave.getDependparams(), ";", false);
   List<String> lstTemp;
   Map<String, String> mParams = new HashMap<String, String>();
   mDependParams.put(rbeanSlave.getId(), mParams);
   if (rbeanMaster.isDetailReportType())
     rbeanSlave.setMDependsDetailReportParams(
         mParams); // 如果主报表是细览报表,则存放其所用到的参数,以便加载此从报表数据时可以知道要取哪些参数
   for (String param : lstParams) {
     lstTemp = Tools.parseStringToList(param, "=", false);
     String paramname = lstTemp.get(0).trim();
     String paramvalue = "";
     if (lstTemp.size() == 2) {
       paramvalue = lstTemp.get(1).trim();
     } else if (lstTemp.size() > 2) {
       throw new WabacusConfigLoadingException(
           "加载页面"
               + this.getPath()
               + "失败,其下报表"
               + rbeanSlave.getId()
               + "配置的dependsparams:"
               + rbeanSlave.getDependparams()
               + "不合法,出现多个=号");
     }
     if (paramname.equals("")) { // 每个从报表的动态参数必须定义成@{<col/>的property}格式
       throw new WabacusConfigLoadingException(
           "加载页面"
               + this.getPath()
               + "失败,其下报表"
               + rbeanSlave.getId()
               + "配置的dependsparams:"
               + rbeanSlave.getDependparams()
               + "不合法,参数名不能为空");
     }
     ConditionBean conbeanTmp = rbeanSlave.getSbean().getConditionBeanByName(paramname);
     if (conbeanTmp != null) {
       if (!conbeanTmp.isConditionValueFromUrl()) {
         throw new WabacusConfigLoadingException(
             "加载从报表"
                 + rbeanSlave.getPath()
                 + "失败,在dependsparams中配置的"
                 + paramname
                 + "对应的查询条件<condition/>不是从URL中获取条件数据");
       }
     }
     mParams.put(paramname, paramvalue);
     if (Tools.isDefineKey("@", paramvalue)) {
       paramvalue = Tools.getRealKeyByDefine("@", paramvalue); // 父报表的某个<col/>的property
       ColBean cb = rbeanMaster.getDbean().getColBeanByColProperty(paramvalue);
       if (cb == null) {
         throw new WabacusConfigLoadingException(
             "加载页面"
                 + this.getPath()
                 + "失败,其下报表"
                 + rbeanSlave.getId()
                 + "配置的dependsparams:"
                 + rbeanSlave.getDependparams()
                 + "中动态参数"
                 + paramvalue
                 + "在被依赖的父报表中不存在property为此值的<col/>");
       }
       if (rbeanMaster.isListReportType()) {
         AbsListReportColBean alrcean =
             (AbsListReportColBean) cb.getExtendConfigDataForReportType(AbsListReportType.KEY);
         if (alrcean == null) {
           alrcean = new AbsListReportColBean(cb);
           cb.setExtendConfigDataForReportType(AbsListReportType.KEY, alrcean);
         }
         alrcean.setSlaveReportParamName(paramname); // 将此ColBean标识为参与刷新从报表的参数,并记下对应的参数名
         rbeanSlave.addParamNameFromURL(paramname);
         cb.setDisplayNameValueProperty(true);
       }
     }
   }
 }
Ejemplo n.º 18
0
 private void validRelateReports() {
   List<ReportBean> lstValidedMasterReport = new ArrayList<ReportBean>();
   List<String> lstDetailReportidDependingListReports = new ArrayList<String>();
   for (ReportBean rbeanSlave : this.mRelateReports.keySet()) {
     if (rbeanSlave == null || !rbeanSlave.isSlaveReport()) continue;
     ReportBean rbeanMaster = this.mRelateReports.get(rbeanSlave);
     if (!lstValidedMasterReport.contains(rbeanMaster)) {
       Map<String, Map<String, String>> mDependChildsTmp = rbeanMaster.getMDependChilds();
       Map<String, String> mDynParamsValueAndName = new HashMap<String, String>();
       for (Entry<String, Map<String, String>> entryTmp :
           mDependChildsTmp.entrySet()) { // 循环所有依赖此主报表的从报表
         Map<String, String> mParams = entryTmp.getValue();
         if (mParams.size() == 0) {
           throw new WabacusConfigLoadingException(
               "加载页面"
                   + this.getPath()
                   + "失败,依赖主报表"
                   + rbeanMaster.getPath()
                   + "的从报表"
                   + entryTmp.getKey()
                   + "没有配置dependsparams参数");
         }
         boolean existDynParams = false;
         for (Entry<String, String> entryParams : mParams.entrySet()) {
           if (Tools.isDefineKey("@", entryParams.getValue())) {
             existDynParams = true;
             if (mDynParamsValueAndName.containsKey(entryParams.getValue())
                 && !entryParams
                     .getKey()
                     .equals(mDynParamsValueAndName.get(entryParams.getValue()))) {
               throw new WabacusConfigLoadingException(
                   "加载页面"
                       + this.getPath()
                       + "失败,依赖主报表"
                       + rbeanMaster.getPath()
                       + "的从报表存在多个参数名从本主报表的列"
                       + entryParams.getValue()
                       + "中取参数值,必须保持相同的参数名");
             }
             mDynParamsValueAndName.put(entryParams.getValue(), entryParams.getKey());
           }
         }
         if (!existDynParams) {
           throw new WabacusConfigLoadingException(
               "加载页面"
                   + this.getPath()
                   + "失败,依赖主报表"
                   + rbeanMaster.getPath()
                   + "的从报表"
                   + entryTmp.getKey()
                   + "在dependsparams中没有配置动态参数");
         }
       }
       lstValidedMasterReport.add(rbeanMaster);
     }
     if (rbeanMaster.isListReportType() && rbeanSlave.isDetailReportType()) {
       lstDetailReportidDependingListReports.add(rbeanSlave.getId());
     }
     while (rbeanMaster != null) {
       if (rbeanMaster.getId().equals(rbeanSlave.getId())) { // 存在循环依赖
         throw new WabacusConfigLoadingException("加载页面" + this.getPath() + "失败,其下报表存在循环依赖");
       }
       rbeanMaster = this.mRelateReports.get(rbeanMaster);
     }
   }
   for (ReportBean rbeanSlave : this.mRelateReports.keySet()) {
     if (rbeanSlave == null || !rbeanSlave.isSlaveReport()) continue;
     ReportBean rbeanMaster = this.mRelateReports.get(rbeanSlave);
     if (lstDetailReportidDependingListReports.contains(rbeanMaster.getId())) {
       throw new WabacusConfigLoadingException(
           "加载页面"
               + this.getPath()
               + "失败,细览报表"
               + rbeanMaster.getPath()
               + "依赖于数据自动列表报表,因此不能再被其它报表依赖");
     }
   }
 }
Ejemplo n.º 19
0
 protected Object doGetResultSet(
     SPDataSetValueBean spBean, Object typeObj, StringBuffer systemParamsBuf) {
   log.debug(systemParamsBuf.toString());
   String procedure = spBean.getProcedure();
   if (rbean.getInterceptor() != null) {
     Object obj = rbean.getInterceptor().beforeLoadData(rrequest, rbean, typeObj, procedure);
     if (!(obj instanceof String)) {
       return obj;
     }
     procedure = (String) obj;
   }
   if (Config.show_sql) log.info("Execute sql: " + procedure);
   CallableStatement cstmt = null;
   try {
     cstmt =
         rrequest
             .getConnection(spBean.getOwnerSpProvider().getDatasource())
             .prepareCall(procedure);
     AbsDatabaseType dbtype = rrequest.getDbType(spBean.getOwnerSpProvider().getDatasource());
     VarcharType varcharObj =
         (VarcharType) Config.getInstance().getDataTypeByClass(VarcharType.class);
     int idx = 1;
     if (spBean.getLstStoreProcedureParams() != null
         && spBean.getLstStoreProcedureParams().size() > 0) {
       for (String paramTmp : spBean.getLstStoreProcedureParams()) {
         if (WabacusAssistant.getInstance()
             .isGetRequestContextValue(paramTmp)) { // 从request/session中取值
           varcharObj.setPreparedStatementValue(
               idx,
               WabacusAssistant.getInstance().getRequestContextStringValue(rrequest, paramTmp, ""),
               cstmt,
               dbtype);
         } else if (Tools.isDefineKey("condition", paramTmp)) {
           setConditionValue(
               rrequest,
               spBean,
               cstmt,
               dbtype,
               idx,
               Tools.getRealKeyByDefine("condition", paramTmp),
               varcharObj);
         } else {
           varcharObj.setPreparedStatementValue(idx, paramTmp, cstmt, dbtype);
         }
         idx++;
       }
     }
     if (spBean.getOwnerSpProvider().isUseSystemParams()) {
       if (systemParamsBuf == null) systemParamsBuf = new StringBuffer();
       cstmt.setString(idx++, systemParamsBuf.toString()); // 如果是查询报表数据,将系统参数传入
     }
     if (dbtype instanceof Oracle) {
       cstmt.registerOutParameter(idx, OracleTypes.CURSOR);
     }
     rrequest.addUsedStatement(cstmt);
     cstmt.executeQuery();
     ResultSet rs = null;
     if (dbtype instanceof Oracle) {
       rs = (ResultSet) cstmt.getObject(idx);
     } else {
       rs = cstmt.getResultSet();
     }
     return rs;
   } catch (SQLException e) {
     throw new WabacusRuntimeException(
         "从数据库取报表" + rbean.getPath() + "数据时执行SQL:" + procedure + "失败", e);
   }
 }
Ejemplo n.º 20
0
 protected void processStylePropertyAfterMerged() {
   super.processStylePropertyAfterMerged();
   this.styleproperty =
       Tools.mergeHtmlTagPropertyString(
           this.styleproperty, "onclick=\"showDatepickerBox2(this)\"", 1);
 }