Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /* 
    * Copyright (C) 2010---2013 星星(wuweixing)<349446658@qq.com>
    * 
    * This file is part of Wabacus 
    * 
    * Wabacus is free software: you can redistribute it and/or modify
    * it under the terms of the GNU Lesser General Public License as published by
    * the Free Software Foundation, either version 3 of the License, or
    * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public License
   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
   */
  package com.wabacus.config.component.application.report;
  
  import java.util.List;
  import java.util.Map;
  
  
  
  public class ConditionBean extends AbsConfigBean implements IInputBoxOwnerBean
  {
      private static Log log=LogFactory.getLog(ConditionBean.class);
      
      public final static String SELECTTYPE_INNERLOGIC="innerlogic";
      
      public final static String SELECTORTYPE_COLUMNS="columns";
      
      public final static String SELECTORTYPE_VALUES="values";
  
      public final static String LABELPOSITION_INNER="inner";
      
      public final static String LABELPOSITION_LEFT="left";
      
      public final static String LABELPOSITION_RIGHT="right";
      
      private IDataType datatypeObj;
  
      private AbsInputBox inputbox;
  
      private String name="";
  
      private String label;
      
      private Map<String,StringmDynLableParts;
  
  
      private String defaultvalue=null;
      
      private boolean keepkeywords;
      
      private String logic=" and ";
  
      private String tip="";
  
      private boolean hidden;//是否在前台显示
  
      
      private boolean constant;
  
      private boolean br;
  
      private int left=3;
      
      private int right=0;
  
      //    private String relatetab="";//当在同一页面横向以tab形式显示多个报表时,如果某个条件输入框的值要在点击其它tab切换到其它报表时
  
      
      
      
      private String splitlike="0";
      
      private String source;
 
     
     private int iterator;//当前查询条件重复显示的个数,只有有多个<value/>或<columns/>时才有意义。
     
     private String innerlogic;//加载时暂存用户在<condition/>中配置的innerlogic属性,当不需提供逻辑关系的选择,且不需在前面显示逻辑关系的label时,可以直接在<condition/>的innerlogic属性中配置
     
     private ConditionSelectorBean cinnerlogicbean;//存放逻辑关系选择信息,如果要提供多个逻辑关系进行选择,或者需要在输入框前面显示逻辑关系label,则可以通过配置<innerlogic/>子标签进行配置
     
     
     
     private List<StringlstChildDisplayOrder;//当前查询条件如果要显示这几个子元素时,它们的显示顺序,由它们配置在<condition/>中的次序决定
     
     private List<String[]> lstBelongto;
     
     
     public ConditionBean(AbsConfigBean parent)
     {
         super(parent);
     }
 
     public String getDefaultvalue()
     {
         return this.;
     }
 
     public void setDefaultvalue(String defaultvalue)
     {
         this.=defaultvalue;
     }
     
     public void setName(String name)
     {
         this.=name;
     }
 
     public void setServerValidateBean(ServerValidateBean svbean)
     {
         this.=svbean;
     }
 
     public void setLabel(String label)
     {
         Object[] objArr=WabacusAssistant.getInstance().parseStringWithDynPart(label);
         this.=(String)objArr[0];
         this.=(Map<String,String>)objArr[1];
     }
 
     public String getLabel()
     {
         return this.;
     }
     
     public Map<StringStringgetMDynLableParts()
     {
         return this.;
     }
     
     public String getLabel(ReportRequest rrequest)
     {
         return WabacusAssistant.getInstance().getStringValueWithDynPart(rrequest,this.,this.,"");
     }
     
     public String getTip()
     {
         return ;
     }
 
     public void setTip(String tip)
     {
         this.=tip;
     }
 
     public String getName()
     {
         return this.;
     }
 
     public String getLabelposition()
     {
         return ;
     }
 
     public void setLabelposition(String labelposition)
     {
         this.=labelposition;
     }
 
     public String getLogic()
     {
         return this.;
     }
 
     public IDataType getDatatypeObj()
     {
         return ;
     }
 
     public void setDatatypeObj(IDataType datatypeObj)
     {
         this.=datatypeObj;
     }
 
     public boolean isHidden()
     {
         return ;
     }
 
     public void setHidden(boolean hidden)
     {
         this.=hidden;
     }
 
     public boolean isKeepkeywords()
     {
         return ;
     }
 
     public void setKeepkeywords(boolean keepkeywords)
     {
         this.=keepkeywords;
     }
 
     public AbsInputBox getInputbox()
     {
         return ;
     }
 
     public void setInputbox(AbsInputBox inputbox)
     {
         this.=inputbox;
     }
 
     public boolean isBr()
     {
         return ;
     }
 
     public void setBr(boolean br)
     {
         this.=br;
     }
 
     public boolean isConstant()
     {
         return ;
     }
 
     public void setConstant(boolean constant)
     {
         this.=constant;
     }
 
     public String getSplitlike()
     {
         return ;
     }
 
     public void setSplitlike(String splitlike)
     {
         this.=splitlike;
     }
 
     public String getSource()
     {
         return ;
     }
 
     public void setSource(String source)
     {
         if(source!=null&&!source.trim().equals(""))
         {
             String reportpath="";
             if(this.getReportBean()!=nullreportpath=this.getReportBean().getPath();
             if(Tools.isDefineKey("request",source))
             {
                 if(Tools.getRealKeyByDefine("request",source).trim().equals(""))
                 {
                     throw new WabacusConfigLoadingException("加载报表"+reportpath+"的name为"+this.+"的条件失败,source配置值:"+source+"指定的从request取数据的key为空");
                 }
             }else if(Tools.isDefineKey("session",source))
             {
                 if(Tools.getRealKeyByDefine("session",source).trim().equals(""))
                 {
                     throw new WabacusConfigLoadingException("加载报表"+reportpath+"的name为"+this.+"的条件失败,source配置值:"+source+"指定的从session取数据的key为空");
                 }
             }else
             {
                 throw new WabacusConfigLoadingException("加载报表"+reportpath+"的name为"+this.+"的条件失败,source属性值"+source+"不是request{...}或session{...}格式");
             }
             this.=source;
             this.=true;
             this.=false;
         }else
         {
             this.=null;
         }
     }
 
     public String getInputBoxId()
     {
         return this.getReportBean().getGuid()+"_wxcondition_"+.trim();
     }
 
     public boolean isConditionWithInputbox()
     {
         if(this.isHidden()||this.isConstant()) return false;
         if(Tools.isDefineKey("request",this.)||Tools.isDefineKey("session",this.)) return false;
         return true;
     }
     
     public boolean isConditionValueFromUrl()
     {
         if(this.isConstant()) return false;
         if(Tools.isDefineKey("request",this.)||Tools.isDefineKey("session",this.)) return false;
         return true;
     }
     
     public int getLeft()
     {
         return ;
     }
 
     public void setLeft(int left)
     {
         this.=left;
     }
 
     public int getRight()
     {
         return ;
     }
 
     public void setRight(int right)
     {
         this.=right;
     }
 
     {
         return ;
     }
 
     public void setConditionExpression(ConditionExpressionBean conditionExpression)
     {
         this.=conditionExpression;
     }
 
     public int getIterator()
     {
         return ;
     }
 
     public void setIterator(int iterator)
     {
         this.=iterator;
     }
 
     public String getInnerlogic()
     {
         return ;
     }
 
     public void setInnerlogic(String innerlogic)
     {
         if(innerlogic==null||innerlogic.trim().equals(""))
         {
             this.=null;
         }else
         {
             if(!innerlogic.toLowerCase().trim().equals("and")&&!innerlogic.toLowerCase().trim().equals("or"))
             {
                 throw new WabacusConfigLoadingException("加载报表"+this.getReportBean().getPath()+"的查询条件"+this.getName()+"失败,配置的innerlogic必须为and或or");
             }
             this.=innerlogic.trim();
         }
     }
 
     {
         return ;
     }
 
     public void setCinnerlogicbean(ConditionSelectorBean cinnerlogicbean)
     {
         this.=cinnerlogicbean;
     }
     
     {
         return ;
     }
 
     public void setCcolumnsbean(ConditionSelectorBean ccolumnsbean)
     {
         this.=ccolumnsbean;
     }
     
     {
         return ;
     }
 
     public void setCvaluesbean(ConditionSelectorBean cvaluesbean)
     {
         this.=cvaluesbean;
     }
 
     public List<StringgetLstChildDisplayOrder()
     {
         return ;
     }
 
     public void setLstChildDisplayOrder(List<StringlstChildDisplayOrder)
     {
         this.=lstChildDisplayOrder;
     }
 
     public void setBelongto(String belongto)
     {
         if(belongto!=null)
         {
             belongto=belongto.trim();
             if(belongto.equals("")||belongto.equals("*.*"))
             {
                 this.=null;
             }else
             {
                 this.=new ArrayList<String[]>();
                 List<StringlstTmp=Tools.parseStringToList(belongto,";",false);
                 String[] strArr;
                 for(String strTmp:lstTmp)
                 {
                     if(strTmp.trim().equals("")) continue;
                     int idx=strTmp.indexOf(".");
                     if(idx<=0)
                     {
                         throw new WabacusConfigLoadingException("加载报表"+this.getReportBean().getPath()+"的name为"+this.
                                 +"的查询条件失败,其配置的belongto没有用.符号分隔所属<dataset/>和<value/>的ID");
                     }
                     strArr=new String[] { strTmp.substring(0,idx).trim(), strTmp.substring(idx+1).trim() };
                     if(strArr[0].equals("*")) strArr[0]=null;
                     if(strArr[1].equals("*")) strArr[1]=null;
                     this..add(strArr);
                 }
             }
         }
     }
 
     public boolean isBelongTo(ReportDataSetValueBean svbean)
     {
         if(this.==null||this..size()==0) return true;
         String datasetid=((ReportDataSetBean)svbean.getParent()).getId();
         for(String[] belongtoArrTmp:this.)
         {
             if((belongtoArrTmp[0]==null||datasetid.equals(belongtoArrTmp[0]))&&(belongtoArrTmp[1]==null||svbean.getId().equals(belongtoArrTmp[1])))
                 return true;
         }
         return false;
     }
     
     public boolean isExistConditionExpression(boolean inherit)
     {
         if(this.!=null&&this..getValue()!=null&&!this..getValue().trim().equals(""))
             return true;
         if(!inheritreturn false;
         if(this.==null||this..isEmpty()) return false;
         ConditionValueSelectItemBean cvbTmp=(ConditionValueSelectItemBean)this..getLstSelectItemBeans().get(0);//如果有多个ConditionValueBean,只要判断一个就可以了
         if(cvbTmp.getConditionExpression()!=null&&cvbTmp.getConditionExpression().getValue()!=null
                 &&!cvbTmp.getConditionExpression().getValue().trim().equals(""))
         {
             return true;
         }
         if(cvbTmp.getLstColumnsBean()==null||cvbTmp.getLstColumnsBean().size()==0) return false;
         ConditionSelectItemBean ccbeanTmp=cvbTmp.getLstColumnsBean().get(0);
         if(ccbeanTmp.getConditionExpression()!=null&&ccbeanTmp.getConditionExpression().getValue()!=null
                 &&!ccbeanTmp.getConditionExpression().getValue().trim().equals(""))
         {
             return true;
         }
         return false;
     }
     
     {
         if(this..equals(ownerid)) return null;
         SqlBean sbean=(SqlBean)this.getParent();
         ConditionBean cbean=sbean.getConditionBeanByName(ownerid);
         if(cbean==nullreturn null;
         return cbean.getInputbox();
     }
 
     public void initConditionValueByInitUrlMethod(ReportRequest rrequest)
     {
         if(!this.isConditionValueFromUrl()) return;
         if(this.!=null)
         {
             rrequest.addParamToUrl(,"rrequest{"++"}",false);
         }else
         {
             String colselectedInputboxidTmp;
             String valueselectedInputboxidTmp;
             String innerlogicSelectedInputboxidTmp;
             if(this.>1)
             {
                 for(int i=0;i<;i++)
                 {
                     if(this.!=null&&!this..isEmpty())
                     {
                         colselectedInputboxidTmp=this..getSelectedInputboxId(i);
                         rrequest.addParamToUrl(colselectedInputboxidTmp,"rrequest{"+colselectedInputboxidTmp+"}",true);
                     }
                     if(this.!=null&&!this..isEmpty()&&this..getLstSelectItemBeans().size()>1)
                     {//如果配置了<innerlogic/>且配置了多个<logic/>子标签
                         innerlogicSelectedInputboxidTmp=this..getSelectedInputboxId(i);
                         rrequest.addParamToUrl(innerlogicSelectedInputboxidTmp,"rrequest{"+innerlogicSelectedInputboxidTmp+"}",true);
                     }
                     valueselectedInputboxidTmp=this..getSelectedInputboxId(i);
                     rrequest.addParamToUrl(valueselectedInputboxidTmp,"rrequest{"+valueselectedInputboxidTmp+"}",true);
                     rrequest.addParamToUrl(+"_"+i,"rrequest{"++"_"+i+"}",false);
                 }
             }else
             {
                 if(this.!=null&&!this..isEmpty())
                 {
                     colselectedInputboxidTmp=this..getSelectedInputboxId(-1);
                     rrequest.addParamToUrl(colselectedInputboxidTmp,"rrequest{"+colselectedInputboxidTmp+"}",true);
                 }
                 if(this.!=null&&!this..isEmpty())
                 {
                     valueselectedInputboxidTmp=this..getSelectedInputboxId(-1);
                     rrequest.addParamToUrl(valueselectedInputboxidTmp,"rrequest{"+valueselectedInputboxidTmp+"}",true);
                 }
                 rrequest.addParamToUrl(,"rrequest{"++"}",false);
             }
         }
     }
     
     public void initConditionValueByInitMethod(ReportRequest rrequest,Map<String,StringmConditionValues)
     {
         if(!this.isConditionValueFromUrl())
         {
             mConditionValues.put(this.,getConditionValue(rrequest,-1));
         }else if(this.!=null||this.<=1)
         {
             mConditionValues.put(this.,getConditionValue(rrequest,));
         }else
         {
             for(int i=0;i<;i++)
             {
                 mConditionValues.put(+"_"+i,getConditionValue(rrequest,+"_"+i));
             }
         }
     }
     
     private String getConditionValue(ReportRequest rrequest,String conditionname)
     {
         String conditionvalue=rrequest.getStringAttribute(conditionname,"");
         if((.equals(this.)&&conditionvalue.equals(this.getLabel(rrequest)))
                 ||conditionvalue.equals("(ALL_DATA)"))
         {
             
             conditionvalue="";
         }
         if(conditionvalue.equals("")&&this.!=null)
         {
             conditionvalue=ReportAssistant.getInstance().getColAndConditionDefaultValue(rrequest,this.);
         }
 
 
 
 
         rrequest.getAttributes().put(conditionname,conditionvalue);
         rrequest.addParamToUrl(conditionname,conditionvalue,true);
         return conditionvalue;
     }
     
     public void validateConditionValue(ReportRequest rrequest,Map<String,StringmConditionValues)
     {
         if(this.==nullreturn;
         if(!this.isConditionValueFromUrl()||this.!=null||this.<=1)
         {
             this..validate(rrequest,mConditionValues.get(this.),mConditionValues,new ArrayList<String>(),false);
         }else
         {
             for(int i=0;i<;i++)
             {
                 this..validate(rrequest,mConditionValues.get(this.+"_"+i),mConditionValues,new ArrayList<String>(),false);
             }
         }
     }
     
     public String getConditionValueForSP(ReportRequest rrequest)
     {
         if(this.isConstant()) return .getValue();
         StringBuffer conditionValueBuf=new StringBuffer();
         if(this.<2)
         {
             conditionValueBuf.append(getRuntimeConditionExpressionForSP(rrequest,-1));
             String conditionvalue=getDynamicConditionvalueForSql(rrequest,-1);
             if(conditionValueBuf.length()>0)
             {
                 conditionValueBuf.append("value=").append(conditionvalue);
             }else
             {
                 conditionValueBuf.append(conditionvalue);
             }
         }else
         {
             String conditionvalueTmp;
             for(int i=0;i<this.;i++)
             {//依次循环此查询条件每一套输入框
                 conditionvalueTmp=getDynamicConditionvalueForSql(rrequest,i);
                 if(conditionvalueTmp.equals("")) continue;
                 conditionValueBuf.append(getRuntimeConditionExpressionForSP(rrequest,i));
                 String innerlogicTmp=getInnerLogicValue(rrequest,i);
                 conditionValueBuf.append("innerlogic["+i+"]="+innerlogicTmp).append(";");
                 conditionValueBuf.append("value["+i+"]="+conditionvalueTmp).append(";");
             }
         }
         return conditionValueBuf.toString();
     }
     
     private String getRuntimeConditionExpressionForSP(ReportRequest rrequest,int index)
     {
         StringBuffer conditionValueBuf=new StringBuffer();
         if(this.!=null)
         {
             String valueid=rrequest.getStringAttribute(this..getSelectedInputboxId(index),"");
             ConditionSelectItemBean cvbean=this..getSelectItemBeanById(valueid);
             if(cvbean==null)
             {
                 if(valueid.equals(""))
                 {
                     throw new WabacusRuntimeException("没有为报表"+this.getReportBean().getPath()+"的查询条件"++"配置<value/>子标签");
                 }else
                 {
                     throw new WabacusRuntimeException("没有为报表"+this.getReportBean().getPath()+"的查询条件"++"配置id为"+valueid+"的<value/>子标签");
                 }
             }
             conditionValueBuf.append("expressionid");
             if(index>=0) conditionValueBuf.append("["+index+"]");
             conditionValueBuf.append("=").append(cvbean.getId()).append(";");
         }
         if(this.!=null)
         {
             String columnid=rrequest.getStringAttribute(this..getSelectedInputboxId(index),"");
             ConditionSelectItemBean ccbean=this..getSelectItemBeanById(columnid);
             if(ccbean==null)
             {
                 if(columnid.equals(""))
                 {
                     throw new WabacusRuntimeException("没有为报表"+this.getReportBean().getPath()+"的查询条件"++"配置<column/>子标签");
                 }else
                 {
                     throw new WabacusRuntimeException("没有为报表"+this.getReportBean().getPath()+"的查询条件"++"配置id为"+columnid+"的<column/>子标签");
                 }
             }
             conditionValueBuf.append("columnid");
             if(index>=0) conditionValueBuf.append("["+index+"]");
             conditionValueBuf.append("=").append(ccbean.getId()).append(";");
         }
         return conditionValueBuf.toString();
     }
     
     public String getConditionExpressionAndParams(ReportRequest rrequest,List<StringlstConditions,List<IDataTypelstConditionsTypes)
     {
         if(!this.isExistConditionExpression(true)) return null;//如果当前查询条件没有在<condition/>中的任意层级子标签中配置条件表达式,则说明它可能是直接通过#name#的形式在sql语句中指定条件,所以不在这里为它构造条件表达式
         if(this.isConstant()) return .getValue();
         if(this.<2)
         {
             String conditionvalue=getDynamicConditionvalueForSql(rrequest,-1);
             if(conditionvalue.equals("")) return "";
             ConditionExpressionBean cexpressionbean=getConditionRuntimeExpressionBean(rrequest,-1);
             return cexpressionbean.getRuntimeConditionExpressionValue(this,conditionvalue,lstConditions,lstConditionsTypes);
         }else
         {
             String conditionvalueTmp;
             StringBuffer andExpressionBuf=new StringBuffer();
             StringBuffer orExpressionBuf=new StringBuffer();
             List<StringlstAndConditions=null;
             List<IDataTypelstAndConditionsType=null;new ArrayList<IDataType>();
             List<StringlstOrConditions=null;new ArrayList<String>();
             List<IDataTypelstOrConditionsType=null;
             if(lstConditions!=null&&lstConditionsTypes!=null)
             {
                 lstAndConditions=new ArrayList<String>();
                 lstAndConditionsType=new ArrayList<IDataType>();
                 lstOrConditions=new ArrayList<String>();
                 lstOrConditionsType=new ArrayList<IDataType>();
             }
             for(int i=0;i<this.;i++)
             {
                 conditionvalueTmp=getDynamicConditionvalueForSql(rrequest,i);
                 if(conditionvalueTmp.equals("")) continue;
                 String innerlogicTmp=getInnerLogicValue(rrequest,i);
                 ConditionExpressionBean cexpressionbean=getConditionRuntimeExpressionBean(rrequest,i);
                 if(!innerlogicTmp.equalsIgnoreCase("or"))
                 {
                     andExpressionBuf.append(cexpressionbean.getRuntimeConditionExpressionValue(this,conditionvalueTmp,lstAndConditions,
                             lstAndConditionsType));
                     andExpressionBuf.append(" and ");
                 }else
                 {
                     orExpressionBuf.append(cexpressionbean.getRuntimeConditionExpressionValue(this,conditionvalueTmp,lstOrConditions,
                             lstOrConditionsType));
                     orExpressionBuf.append(" or ");
                 }
             }
             if(andExpressionBuf.toString().endsWith(" and "))
             {
                 andExpressionBuf.delete(andExpressionBuf.length()-" and ".length(),andExpressionBuf.length());
             }
             if(orExpressionBuf.toString().endsWith(" or "))
             {
                 orExpressionBuf.delete(orExpressionBuf.length()-" or ".length(),orExpressionBuf.length());
             }
             if(andExpressionBuf.length()==0&&orExpressionBuf.length()==0) return "";
             if(lstConditions!=null&&lstConditionsTypes!=null)
             {
                 
                 if(lstAndConditions.size()>0) lstConditions.addAll(lstAndConditions);
                 if(lstAndConditionsType.size()>0) lstConditionsTypes.addAll(lstAndConditionsType);
                 
                 if(lstOrConditions.size()>0) lstConditions.addAll(lstOrConditions);
                 if(lstOrConditionsType.size()>0) lstConditionsTypes.addAll(lstOrConditionsType);
             }
             String conditionexpression="";
             //先and
             if(!andExpressionBuf.toString().trim().equals(""))
             {
                 conditionexpression="("+andExpressionBuf.toString()+")";
             }
             
             if(!orExpressionBuf.toString().trim().equals(""))
             {
                 if(conditionexpression.equals(""))
                 {
                     conditionexpression="("+orExpressionBuf.toString()+")";
                 }else
                 {
                     conditionexpression=conditionexpression+" or ("+orExpressionBuf.toString()+")";
                 }
             }
             if(!conditionexpression.trim().equals("")) conditionexpression="("+conditionexpression+")";
             return conditionexpression;
         }
     }
 
     private String getInnerLogicValue(ReportRequest rrequest,int iteratorindex)
     {
         if((this.==null||this..trim().equals(""))&&(this.==null||this..isEmpty())) return "and";
         if(this.!=null&&!this..trim().equals("")) return this.;//配置了<condition/>的innerlogic属性
         if(this..getLstSelectItemBeans().size()==1) return this..getLstSelectItemBeans().get(0).getId();//在<innerlogic/>中只配置了一个<logic/>
         
         String innerlogicTmp=rrequest.getStringAttribute(this..getSelectedInputboxId(iteratorindex),"");
         if(innerlogicTmp.equals("")) return this..getLstSelectItemBeans().get(0).getId();
         return innerlogicTmp;
     }
     
     public String getDynamicConditionvalueForSql(ReportRequest rrequest,int iteratorindex)
     {
         String conditionvalue=getConditionValue(rrequest,iteratorindex);
         if(conditionvalue==null||conditionvalue.trim().equals("")) return "";
         if((this. instanceof VarcharType)&&!this..equals("0"))
         {
             conditionvalue=ReportAssistant.getInstance().formatCondition(conditionvalue.trim(),this.);
         }
         return conditionvalue;
     }
     
     public String getConditionValue(ReportRequest rrequest,int iteratorindex)
     {
         if(this.isConstant())
         {
             if(this.getConditionExpression()==nullreturn "";
             return this.getConditionExpression().getValue();
         }
         String conditionvalue;
         if(Tools.isDefineKey("request",this.)||Tools.isDefineKey("session",this.))
         {
             conditionvalue=WabacusAssistant.getInstance().getRequestContextStringValue(rrequest,this.,"");
             if(conditionvalue.equals("")&&this.!=null)
             {
                 conditionvalue=ReportAssistant.getInstance().getColAndConditionDefaultValue(rrequest,this.);
             }
         }else
         {
             if(this.isHidden())
             {
                 conditionvalue=rrequest.getStringAttribute(,"");
             }else
             {
                 String conditionname=;
                 if(iteratorindex>=0) conditionname=conditionname+"_"+iteratorindex;
                 conditionvalue=rrequest.getStringAttribute(conditionname,"");
             }
         }
         return conditionvalue;
     }
     
     {
         if(this.!=nullreturn ;
         String valueid=rrequest.getStringAttribute(this..getSelectedInputboxId(index),"");
         ConditionSelectItemBean cvbean=this..getSelectItemBeanById(valueid);
         if(cvbean==null)
         {
             if(valueid.equals(""))
             {
                 throw new WabacusRuntimeException("没有为报表"+this.getReportBean().getPath()+"的查询条件"++"配置<value/>子标签");
             }else
             {
                 throw new WabacusRuntimeException("没有为报表"+this.getReportBean().getPath()+"的查询条件"++"配置id为"+valueid+"的<value/>子标签");
             }
         }
         if(cvbean.getConditionExpression()!=nullreturn cvbean.getConditionExpression();//在<value/>中配置的是条件表达式
         //在<value/>中配置的是<column/>
         String columnid=rrequest.getStringAttribute(this..getSelectedInputboxId(index),"");
         ConditionSelectItemBean ccbean=((ConditionValueSelectItemBean)cvbean).getColumnBeanById(columnid);
         if(ccbean==null)
         {
             if(columnid.equals(""))
             {
                 throw new WabacusRuntimeException("没有为报表"+this.getReportBean().getPath()+"的查询条件"++"配置<column/>子标签");
             }else
             {
                 throw new WabacusRuntimeException("没有为报表"+this.getReportBean().getPath()+"的查询条件"++"配置id为"+columnid+"的<column/>子标签");
             }
         }
         return ccbean.getConditionExpression();
     }
     
     public String getDisplayString(ReportRequest rrequest,Object dataObj,String dynstyleproperty,boolean showinputbox,int iteratorindex)
     {
         if(!this.isConditionWithInputbox()) return "";
         ReportBean rbean=this.getReportBean();
         if(!rrequest.checkPermission(rbean.getId(),.,,.)) return "";
         if(this.<=1&&iteratorindex>=0)
         {
             throw new WabacusRuntimeException("报表"+rbean.getPath()+"的查询条件"+this.+"的iterator属性为"+this.
                     +",显示时不能指定iteratorindex为大于等于0的数,即只能为它显示一套输入框");
         }else if(this.>1&&(iteratorindex<0||iteratorindex>this.))
         {
             throw new WabacusRuntimeException("报表"+rbean.getPath()+"的查询条件"+this.+"的iterator属性为"+this.
                     +",即显示多套输入框,因此必须指定当前显示的下标iteratorindex,且不能超过iterator配置值:"+this.);
         }
         StringBuffer resultBuf=new StringBuffer();
         resultBuf.append("<font id=\"font_").append(rbean.getGuid()+"_conditions\"");
         resultBuf.append(" name=\"font_").append(rbean.getGuid()+"_conditions\"");
         resultBuf.append(" value_name=\"").append(this.).append("\"");
         if(showinputbox)
         {
             if(this.!=null&&!this..isEmpty()&&this..getLstSelectItemBeans().size()>1)
             {
                 resultBuf.append(" innerlogicid=\"").append(this..getSelectedInputboxId(iteratorindex)).append("\"");
                 resultBuf.append(" innerlogicinputboxtype=\"").append(.getInputbox()==null?"":.getInputbox()).append("\"");
             }
             if(iteratorindex>=0)
             {
                 resultBuf.append(" iteratorindex=\"").append(iteratorindex).append("\"");
             }
         }else
         {//用户自己显示输入框
             if(this.>1)
             {
                 throw new WabacusRuntimeException("显示报表"+this.getReportBean().getPath()+"的查询条件"+this.+"失败,此查询条件的iterator大于1,不能为它提供条件输入框");
             }
             String conditionvalue=rrequest.getStringAttribute(this.,"");
             conditionvalue=conditionvalue==null?"":conditionvalue.trim();
             resultBuf.append(" customized_inputbox=\"true\" value=\"").append(conditionvalue).append("\"");//加上value属性,这样取值时就不会从<font/>的输入框中取,而是直接从value属性中取
         }
         if(this.!=null&&!this..isEmpty()&&this..getLstSelectItemBeans().size()>1)
         {
             resultBuf.append(" columnid=\"").append(this..getSelectedInputboxId(iteratorindex)).append("\"");
             resultBuf.append(" columninputboxtype=\"").append(.getInputbox()==null?"":.getInputbox()).append("\"");
         }
         if(this.!=null&&!this..isEmpty()&&this..getLstSelectItemBeans().size()>1)
         {
             resultBuf.append(" valueid=\"").append(this..getSelectedInputboxId(iteratorindex)).append("\"");
             resultBuf.append(" valueinputboxtype=\"").append(.getInputbox()==null?"":.getInputbox()).append("\"");
         }
         resultBuf.append(">");
         resultBuf.append(showConditionAllTypeBoxes(rrequest,dataObj,showinputbox,dynstyleproperty,iteratorindex));
         resultBuf.append("</font>");//注意:这里不考虑showinputbox是true还是false,都显示</font>,因为查询条件输入框即使由开发人员自己定制,也不放在<font></font>中,这一点与编辑输入框不同
         return resultBuf.toString();
     }
     
     private String showConditionAllTypeBoxes(ReportRequest rrequest,Object dataObj,boolean showinputbox,String dynstyleproperty,int iteratorindex)
     {
         StringBuffer resultBuf=new StringBuffer();
         boolean isReadonlyPermission=rrequest.checkPermission(this.getReportBean().getId(),.,this.,.);
         for(String childtype:this.)
         {
             if(childtype.equals("values")&&this.!=null)
             {
                 resultBuf.append(this..showSelectedInputbox(rrequest,isReadonlyPermission,iteratorindex));
             }else if(childtype.equals("columns")&&this.!=null)
             {
                 resultBuf.append(this..showSelectedInputbox(rrequest,isReadonlyPermission,iteratorindex));
             }else if(childtype.equals("inputbox")&&showinputbox)
             {
                 resultBuf.append(showConditionInputbox(rrequest,dataObj,isReadonlyPermission,dynstyleproperty,iteratorindex));
             }else if(childtype.equals("innerlogic")&&this.!=null&&!this..isEmpty()&&showinputbox)
             {//只有由框架显示输入框,才有可能配置iterator>1,才会用到<innerlogic/>,所以这个时候才需显示这种输入框
                 if(this..getLstSelectItemBeans().size()==1)
                 {//如果通过<innerlogic/>只配置了一个<logic/>,则只显示它的label
                     String reallabel=.getLstSelectItemBeans().get(0).getLabel();
                     if(reallabel!=null&&!reallabel.trim().equals(""))
                     {
                         resultBuf.append(WabacusAssistant.getInstance().getSpacingDisplayString(.getLeft()));
                         reallabel=rrequest.getI18NStringValue(reallabel);
                         resultBuf.append(reallabel);
                         resultBuf.append(WabacusAssistant.getInstance().getSpacingDisplayString(.getRight()));//显示右边距
                     }
                 }else
                 {
                     resultBuf.append(this..showSelectedInputbox(rrequest,isReadonlyPermission,iteratorindex));
                 }
             }
         }
         return resultBuf.toString();
     }
     
     private String showConditionInputbox(ReportRequest rrequest,Object dataObj,boolean isReadonlyPermission,String dynstyleproperty,int iteratorindex)
     {
         StringBuffer resultBuf=new StringBuffer();
         String reallabel=getLabel(rrequest);
         String conditionname=this.;
         if(iteratorindex>=0)
         {
             conditionname=conditionname+"_"+iteratorindex;
         }
         String conditionvalue=rrequest.getStringAttribute(conditionname,"");
         conditionvalue=conditionvalue==null?"":conditionvalue.trim();
         if(reallabel!=null&&!reallabel.trim().equals(""))
         {
             if(this..equals(this.))
             {
                 resultBuf.append("<span class=\"cls-search-label\">"+reallabel+"</span> ");
             }else if(this..equals(this.)&&conditionvalue.equals(""))
             {
                 conditionvalue=reallabel;
             }
         }
         if(iteratorindex>=0) rrequest.getAttributes().put("DYN_INPUTBOX_ID",this.getInputBoxId()+"__"+iteratorindex);
         resultBuf.append(this..getDisplayStringValue(rrequest,conditionvalue,dynstyleproperty,isReadonlyPermission));
         if(reallabel!=null&&!reallabel.trim().equals("")&&this..equals(this.))
         {
             resultBuf.append("<span class=\"cls-search-label\">"+reallabel+"</span> ");
         }
         if(iteratorindex>=0) rrequest.getAttributes().remove("DYN_INPUTBOX_ID");
         return resultBuf.toString();
     }
     
     public void doPostLoad()
     {
         SqlBean sbean=(SqlBean)this.getParent();
         validateConfig(sbean);
         processInnerlogic();