Ignore:
Timestamp:
2004-12-21T12:11:00+13:00 (19 years ago)
Author:
schweer
Message:

fixed BTS 12: restore subscriptions/predicates from database

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/profiles/PredicateFactory.java

    r8847 r8867  
    208208        return result;
    209209    }
     210
     211    /**
     212     * @param predicate
     213     */
     214    public static void deletePredicate(Predicate predicate) {
     215        String field = predicate.getField();
     216        String value = predicate.getValue();
     217       
     218        if (predicate instanceof IdEqualsPredicate) {
     219            Map map = (Map) idEqualsPredicates.get(field);
     220            if (map.containsKey(value)) {
     221                map.remove(value);
     222            }
     223        } else if (predicate instanceof QueryPredicate) {
     224            if (field.equals("document_title")) {
     225                documentTitleQueryPredicates.remove(value);
     226            } else if (field.equals("document_content")) {
     227                documentContentQueryPredicates.remove(value);
     228            } else {
     229                System.err.println("problem while removing: unknown field " + field);
     230            }
     231        } else if (predicate instanceof SubstringMatchPredicate) {
     232            if (field.equals("hostID")) {
     233                hostNameMatchPredicates.remove(value);
     234            } else if (field.equals("collectionID")) {
     235                collectionNameMatchPredicates.remove(value);
     236            } else {
     237                System.err.println("problem while removing: unknown field " + field);
     238            }
     239        } else {
     240            System.err.println("problem while removing: unknown class " + predicate.getClass().getName());
     241        }
     242    }
    210243   
    211244}
Note: See TracChangeset for help on using the changeset viewer.