示例#1
0
 private void getAllRelateConditionReportBeans(
     AbsContainerConfigBean containerBean,
     Set<String> sRelateConditionNames,
     Map<String, List<ReportBean>> mRelateConReportBeans) {
   IComponentConfigBean childBeanTmp;
   for (Entry<String, IComponentConfigBean> entryTmp : containerBean.getMChildren().entrySet()) {
     childBeanTmp = entryTmp.getValue();
     if (childBeanTmp instanceof ReportBean) {
       for (String relateconname : sRelateConditionNames) {
         ReportBean rbeanTmp = (ReportBean) entryTmp.getValue();
         if (rbeanTmp.getSbean() == null || rbeanTmp.getSbean().getLstConditions() == null)
           continue;
         if (rbeanTmp.isSlaveReportDependsonListReport()) continue; // 从报表不存在查询条件关联的情况
         List<ConditionBean> lstConditions = rbeanTmp.getSbean().getLstConditions();
         for (ConditionBean cbean : lstConditions) {
           if (cbean == null || !cbean.isConditionValueFromUrl()) continue;
           if (relateconname.equals(cbean.getName())) {
             List<ReportBean> lst = mRelateConReportBeans.get(relateconname);
             if (lst == null) {
               lst = new ArrayList<ReportBean>();
               mRelateConReportBeans.put(relateconname, lst);
             }
             lst.add(rbeanTmp);
           }
         }
       }
     } else if (childBeanTmp instanceof AbsContainerConfigBean) {
       getAllRelateConditionReportBeans(
           (AbsContainerConfigBean) childBeanTmp, sRelateConditionNames, mRelateConReportBeans);
     }
   }
 }
示例#2
0
 protected void setConditionValue(
     ReportRequest rrequest,
     SPDataSetValueBean spBean,
     CallableStatement cstmt,
     AbsDatabaseType dbtype,
     int index,
     String conname,
     VarcharType varcharObj)
     throws SQLException {
   ConditionBean cbean = spBean.getOwnerSpProvider().getConditionBeanByName(conname);
   IDataType dataTypeObj = cbean.getDatatypeObj() == null ? varcharObj : cbean.getDatatypeObj();
   dataTypeObj.setPreparedStatementValue(
       index, cbean.getConditionValueForSP(rrequest), cstmt, dbtype);
 }
示例#3
0
 private void getAllRelateConditions(
     AbsContainerConfigBean containerBean,
     List<String> lstAllConditionNames,
     Set<String> sRelateConditionNames) {
   List<String> lstConNames;
   for (Entry<String, IComponentConfigBean> entryTmp : containerBean.getMChildren().entrySet()) {
     if (entryTmp.getValue() instanceof ReportBean) {
       ReportBean rbeanTmp = (ReportBean) entryTmp.getValue();
       if (rbeanTmp.getSbean() == null || rbeanTmp.getSbean().getLstConditions() == null) continue;
       List<ConditionBean> lstConditions = rbeanTmp.getSbean().getLstConditions();
       lstConNames = new ArrayList<String>();
       for (ConditionBean cbean : lstConditions) {
         if (cbean == null) continue;
         if (lstConNames.contains(cbean.getName())) {
           throw new WabacusConfigLoadingException(
               "报表"
                   + rbeanTmp.getPath()
                   + "中存在多个name属性为"
                   + cbean.getName()
                   + "的查询条件,同一个报表下的所有<condition/>的name属性必须唯一");
         }
         lstConNames.add(cbean.getName());
         if (!cbean.isConditionValueFromUrl()) continue;
         if (lstAllConditionNames.contains(cbean.getName())) {
           sRelateConditionNames.add(cbean.getName());
         } else {
           lstAllConditionNames.add(cbean.getName());
         }
       }
     } else if (entryTmp.getValue() instanceof AbsContainerConfigBean) {
       getAllRelateConditions(
           (AbsContainerConfigBean) entryTmp.getValue(),
           lstAllConditionNames,
           sRelateConditionNames);
     }
   }
 }
示例#4
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);
       }
     }
   }
 }