if (!m_deleted.equals("")) {
if (m_deleted.equals("")) {
    protected String getListRecordsQuery(Date from, Date until,                                       String mdPrefixDissType,                                       String mdPrefixAboutDissType,                                       boolean withContent) {        boolean set = !m_setSpec.equals("");        boolean about = mdPrefixAboutDissType != null && !mdPrefixAboutDissType.equals("");        StringBuffer query = new StringBuffer();        query.append("select $itemID $recordDiss $date $deleted\n" +                     "  subquery(\n" +                     "    select $setSpec\n " +                     "    from <#ri>\n" +                     "    where\n");        if (set) {            query.append("      $item <" + m_oaiItemID + "> $itemID\n" +                         "      and $item <" + VIEW.DISSEMINATES.uri + "> $recordDiss\n" +                         "      and $recordDiss <" + VIEW.DISSEMINATION_TYPE.uri + "> <" + mdPrefixDissType + ">\n" +                         "      and " + m_itemSetSpecPath + "\n");        } else {            // we don't want to match anything            query.append("      $setSpec <test:noMatch> <test:noMatch>\n");        }        query.append(")\n");                query.append("  subquery(\n" +                     "    select $aboutDiss\n" +                     "    from <#ri>\n" +                     "    where\n");        if (about) {            query.append("      $item <" + m_oaiItemID + "> $itemID\n" +                         "      and $item <" + VIEW.DISSEMINATES.uri + "> $recordDiss\n" +                         "      and $recordDiss <" + VIEW.DISSEMINATION_TYPE.uri + "> <" + mdPrefixDissType + ">\n" +                         "      and $item <" + VIEW.DISSEMINATES.uri + "> $aboutDiss\n" +                         "      and $aboutDiss <" + VIEW.DISSEMINATION_TYPE.uri + "> <" + mdPrefixAboutDissType + ">");        } else {            // we don't want to match anything            query.append("      $aboutDiss <test:noMatch> <test:noMatch>");        }        query.append(")\n");        query.append("from <#ri>\n" +                      "where\n" +                      "  $item <" + m_oaiItemID + "> $itemID\n" +                      "  and $item <" + VIEW.DISSEMINATES.uri + "> $recordDiss\n" +                      "  and $recordDiss <" + VIEW.DISSEMINATION_TYPE.uri + "> <" + mdPrefixDissType + ">\n" +                      "  and $recordDiss <" + VIEW.LAST_MODIFIED_DATE.uri + "> $date\n");                // FedoraOAIDriver.PROP_DELETED is an optional, object-level (as opposed        // to dissemination-level) property. If present, use it in place of        // Fedora state.        if (!m_deleted.equals("")) {            query.append("  and $recordDiss <" + MODEL.STATE + "> $deleted\n ");        } else {            query.append("  and $item <" + m_deleted + "> $deleted\n ");        }                     // From and until dates are optional        // OAI from/until dates are inclusive boundaries.        // iTQL before/after are exclusive        if (from != null) {            // decrement date by 1 millisecond            from.setTime(from.getTime() - 1);                        query.append("  and $date <" + TUCANA.AFTER + "> '" +                          DateUtility.convertDateToString(from) +                          "' in <#xsd>\n ");        }        if (until != null) {            // increment date by 1 millisecond            until.setTime(until.getTime() + 1);            query.append("  and $date <" + TUCANA.BEFORE + "> '" +                          DateUtility.convertDateToString(until) +                          "' in <#xsd>\n ");        }                query.append("  order by $itemID asc");        return query.toString();    }