protected CmsPair<String, List<I_CmsPreparedStatementParameter>> prepareVisitConditions(
        CmsVisitEntryFilter filter) {

        List<I_CmsPreparedStatementParameter> params = new ArrayList<I_CmsPreparedStatementParameter>();
        StringBuffer conditions = new StringBuffer();

        // user id filter
        if (filter.getUserId() != null) {
            if (conditions.length() == 0) {
                conditions.append(BEGIN_CONDITION);
            } else {
                conditions.append(BEGIN_INCLUDE_CONDITION);
            }
            conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_USER_ID"));
            params.add(new CmsPreparedStatementStringParameter(filter.getUserId().toString()));
            conditions.append(END_CONDITION);
        }

        // resource id filter
        if (filter.getStructureId() != null) {
            if (conditions.length() == 0) {
                conditions.append(BEGIN_CONDITION);
            } else {
                conditions.append(BEGIN_INCLUDE_CONDITION);
            }
            conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_STRUCTURE_ID"));
            params.add(new CmsPreparedStatementStringParameter(filter.getStructureId().toString()));
            conditions.append(END_CONDITION);
        }

        // date from filter
        if (filter.getDateFrom() != CmsResource.DATE_RELEASED_DEFAULT) {
            if (conditions.length() == 0) {
                conditions.append(BEGIN_CONDITION);
            } else {
                conditions.append(BEGIN_INCLUDE_CONDITION);
            }
            conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_DATE_FROM"));
            params.add(new CmsPreparedStatementLongParameter(filter.getDateFrom()));
            conditions.append(END_CONDITION);
        }

        // date to filter
        if (filter.getDateTo() != CmsResource.DATE_RELEASED_DEFAULT) {
            if (conditions.length() == 0) {
                conditions.append(BEGIN_CONDITION);
            } else {
                conditions.append(BEGIN_INCLUDE_CONDITION);
            }
            conditions.append(m_sqlManager.readQuery("C_VISIT_FILTER_DATE_TO"));
            params.add(new CmsPreparedStatementLongParameter(filter.getDateTo()));
            conditions.append(END_CONDITION);
        }
        return CmsPair.create(conditions.toString(), params);
    }
protected CmsPair < String , List < I_CmsPreparedStatementParameter > > prepareVisitConditions ( CmsVisitEntryFilter filter ) { List < I_CmsPreparedStatementParameter > params = new ArrayList < I_CmsPreparedStatementParameter > ( ) ; StringBuffer conditions = new StringBuffer ( ) ; if ( filter . getUserId ( ) != null ) { if ( conditions . length ( ) == 0 ) { conditions . append ( BEGIN_CONDITION ) ; } else { conditions . append ( BEGIN_INCLUDE_CONDITION ) ; } conditions . append ( m_sqlManager . readQuery ( "C_VISIT_FILTER_USER_ID" ) ) ; params . add ( new CmsPreparedStatementStringParameter ( filter . getUserId ( ) . toString ( ) ) ) ; conditions . append ( END_CONDITION ) ; } if ( filter . getStructureId ( ) != null ) { if ( conditions . length ( ) == 0 ) { conditions . append ( BEGIN_CONDITION ) ; } else { conditions . append ( BEGIN_INCLUDE_CONDITION ) ; } conditions . append ( m_sqlManager . readQuery ( "C_VISIT_FILTER_STRUCTURE_ID" ) ) ; params . add ( new CmsPreparedStatementStringParameter ( filter . getStructureId ( ) . toString ( ) ) ) ; conditions . append ( END_CONDITION ) ; } if ( filter . getDateFrom ( ) != CmsResource . DATE_RELEASED_DEFAULT ) { if ( conditions . length ( ) == 0 ) { conditions . append ( BEGIN_CONDITION ) ; } else { conditions . append ( BEGIN_INCLUDE_CONDITION ) ; } conditions . append ( m_sqlManager . readQuery ( "C_VISIT_FILTER_DATE_FROM" ) ) ; params . add ( new CmsPreparedStatementLongParameter ( filter . getDateFrom ( ) ) ) ; conditions . append ( END_CONDITION ) ; } if ( filter . getDateTo ( ) != CmsResource . DATE_RELEASED_DEFAULT ) { if ( conditions . length ( ) == 0 ) { conditions . append ( BEGIN_CONDITION ) ; } else { conditions . append ( BEGIN_INCLUDE_CONDITION ) ; } conditions . append ( m_sqlManager . readQuery ( "C_VISIT_FILTER_DATE_TO" ) ) ; params . add ( new CmsPreparedStatementLongParameter ( filter . getDateTo ( ) ) ) ; conditions . append ( END_CONDITION ) ; } return CmsPair . create ( conditions . toString ( ) , params ) ; }
Build the whole WHERE SQL statement part for the given visit entry filter.<p>

@param filter the filter

@return a pair containing both the SQL and the parameters for it