public final void tryMakeWhereEnum(final StringBuffer pSbWhere,
    final IRequestData pRequestData, final Class<?> pEntityClass,
      final String pFldNm,
        final Map<String, Object> pFilterMap,
          final Set<String> pFilterAppearance) throws Exception {
    String nmRnd = pRequestData.getParameter("nmRnd");
    String fltOrdPrefix;
    if (nmRnd.contains("pickerDub")) {
      fltOrdPrefix = "fltordPD";
    } else if (nmRnd.contains("picker")) {
      fltOrdPrefix = "fltordP";
    } else {
      fltOrdPrefix = "fltordM";
    }
    String fltforcedName = fltOrdPrefix + "forcedFor";
    String fltforced = pRequestData.getParameter(fltforcedName);
    if (fltforced != null) {
      pFilterMap.put(fltforcedName, fltforced);
    }
    String nmFldVal = fltOrdPrefix + pFldNm + "Val";
    String fltVal = pRequestData.getParameter(nmFldVal);
    String nmFldOpr = fltOrdPrefix + pFldNm + "Opr";
    String valFldOpr = pRequestData.getParameter(nmFldOpr);
    if (fltVal != null && fltVal.length() > 0 && valFldOpr != null
      && !valFldOpr.equals("disabled") && !valFldOpr.equals("")) {
      String val;
      String valAppear;
      Field fldEnum = this.fieldsRapiHolder.getFor(pEntityClass, pFldNm);
      Class classEnum = fldEnum.getType();
      if (valFldOpr.equals("in")) {
        StringBuffer sbVal = new StringBuffer("(");
        StringBuffer sbValAppear = new StringBuffer("(");
        boolean isFirst = true;
        for (String vl : fltVal.split(",")) {
          if (isFirst) {
            isFirst = false;
          } else {
            sbVal.append(", ");
            sbValAppear.append(", ");
          }
          Enum enVal = Enum.valueOf(classEnum, vl);
          sbVal.append(String.valueOf(enVal.ordinal()));
          sbValAppear.append(getSrvI18n().getMsg(vl));
        }
        val = sbVal.toString() + ")";
        valAppear = sbValAppear.toString() + ")";
      } else {
        Enum enVal = Enum.valueOf(classEnum, fltVal);
        val = String.valueOf(enVal.ordinal());
        valAppear = getSrvI18n().getMsg(fltVal);
      }
      pFilterMap.put(fltOrdPrefix + pFldNm + "ValAppearance", valAppear);
      pFilterMap.put(nmFldVal, fltVal);
      pFilterMap.put(nmFldOpr, valFldOpr);
      String cond = pEntityClass.getSimpleName().toUpperCase()
          + "." + pFldNm.toUpperCase() + " "
          + toSqlOperator(valFldOpr)
          + " " + val;
      if (pSbWhere.toString().length() == 0) {
        pSbWhere.append(cond);
      } else {
        pSbWhere.append(" and " + cond);
      }
      if (pFilterAppearance != null) {
        pFilterAppearance.add(getSrvI18n().getMsg(pFldNm) + " "
          + getSrvI18n().getMsg(valFldOpr) + " " + valAppear);
      }
    }
  }
public final void tryMakeWhereEnum ( final StringBuffer pSbWhere , final IRequestData pRequestData , final Class < ? > pEntityClass , final String pFldNm , final Map < String , Object > pFilterMap , final Set < String > pFilterAppearance ) throws Exception { String nmRnd = pRequestData . getParameter ( "nmRnd" ) ; String fltOrdPrefix ; if ( nmRnd . contains ( "pickerDub" ) ) { fltOrdPrefix = "fltordPD" ; } else if ( nmRnd . contains ( "picker" ) ) { fltOrdPrefix = "fltordP" ; } else { fltOrdPrefix = "fltordM" ; } String fltforcedName = fltOrdPrefix + "forcedFor" ; String fltforced = pRequestData . getParameter ( fltforcedName ) ; if ( fltforced != null ) { pFilterMap . put ( fltforcedName , fltforced ) ; } String nmFldVal = fltOrdPrefix + pFldNm + "Val" ; String fltVal = pRequestData . getParameter ( nmFldVal ) ; String nmFldOpr = fltOrdPrefix + pFldNm + "Opr" ; String valFldOpr = pRequestData . getParameter ( nmFldOpr ) ; if ( fltVal != null && fltVal . length ( ) > 0 && valFldOpr != null && ! valFldOpr . equals ( "disabled" ) && ! valFldOpr . equals ( "" ) ) { String val ; String valAppear ; Field fldEnum = this . fieldsRapiHolder . getFor ( pEntityClass , pFldNm ) ; Class classEnum = fldEnum . getType ( ) ; if ( valFldOpr . equals ( "in" ) ) { StringBuffer sbVal = new StringBuffer ( "(" ) ; StringBuffer sbValAppear = new StringBuffer ( "(" ) ; boolean isFirst = true ; for ( String vl : fltVal . split ( "," ) ) { if ( isFirst ) { isFirst = false ; } else { sbVal . append ( ", " ) ; sbValAppear . append ( ", " ) ; } Enum enVal = Enum . valueOf ( classEnum , vl ) ; sbVal . append ( String . valueOf ( enVal . ordinal ( ) ) ) ; sbValAppear . append ( getSrvI18n ( ) . getMsg ( vl ) ) ; } val = sbVal . toString ( ) + ")" ; valAppear = sbValAppear . toString ( ) + ")" ; } else { Enum enVal = Enum . valueOf ( classEnum , fltVal ) ; val = String . valueOf ( enVal . ordinal ( ) ) ; valAppear = getSrvI18n ( ) . getMsg ( fltVal ) ; } pFilterMap . put ( fltOrdPrefix + pFldNm + "ValAppearance" , valAppear ) ; pFilterMap . put ( nmFldVal , fltVal ) ; pFilterMap . put ( nmFldOpr , valFldOpr ) ; String cond = pEntityClass . getSimpleName ( ) . toUpperCase ( ) + "." + pFldNm . toUpperCase ( ) + " " + toSqlOperator ( valFldOpr ) + " " + val ; if ( pSbWhere . toString ( ) . length ( ) == 0 ) { pSbWhere . append ( cond ) ; } else { pSbWhere . append ( " and " + cond ) ; } if ( pFilterAppearance != null ) { pFilterAppearance . add ( getSrvI18n ( ) . getMsg ( pFldNm ) + " " + getSrvI18n ( ) . getMsg ( valFldOpr ) + " " + valAppear ) ; } } }
<p>Make SQL WHERE clause for enum if need.</p>
@param pSbWhere result clause
@param pRequestData - Request Data
@param pEntityClass - entity class
@param pFldNm - field name
@param pFilterMap - map to store current filter
@param pFilterAppearance - set to store current filter appearance
if null - not required
@throws Exception - an Exception