Ignore:
Timestamp:
2004-11-23T15:08:24+13:00 (19 years ago)
Author:
schweer
Message:

restructured servlet to use velocity

Location:
trunk/greenstone3-extensions/gsdl-as
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/greenstone3-extensions/gsdl-as

    • Property svn:ignore
      •  

        old new  
        11build
        22dist
        3 lib
        43test-classes
  • trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/AlertingServiceServlet.java

    r8609 r8630  
    122122            Subscription sub = new Subscription(valueMap);
    123123            // TODO this should probably be somewhere else
    124             for (Iterator iter = sub.predicates().iterator(); iter.hasNext();) {
     124            for (Iterator iter = sub.getPredicates().iterator(); iter.hasNext();) {
    125125                Predicate predicate = (Predicate) iter.next();
    126126                if (predicate != null) {
     
    151151        }
    152152
    153         // TODO authentication (not everyone should be allowed to post
    154         // events...)
    155153        GreenstoneCommunicator gsComm = null;
    156154        try {
  • trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/ProfileStore.java

    r8609 r8630  
    164164       
    165165        return matchedPreds;
    166 //        Set result = new TreeSet();
    167 //        for (Iterator iter = PredicateFactory.getAllBooleanPredicates().iterator(); iter.hasNext();) {
    168 //            Predicate predicate = (Predicate) iter.next();
    169 //            if (predicate.isSatisfied(event)) {
    170 //                result.add(event);
    171 //            }
    172 //        }
    173 //        return result;
    174     }
    175 
    176     /**
    177      * @param value
    178      * @return
    179      */
    180     private Set getWordsInString(String value) {
    181         Set result = new TreeSet();
    182         String[] words = value.split("\\s");
    183         // TODO better word recognition
    184         for (int i = 0; i < words.length; i++) {
    185             String word = words[i];
    186             while (word.endsWith(".") || word.endsWith(",") || word.endsWith("?") || word.endsWith("!")) {
    187                 word = word.substring(0, word.length() - 2);
    188             }
    189             if (!result.contains(word)) {
    190                 result.add(word);
    191             }
    192         }
    193         return result;
    194     }
    195 
    196     /**
    197      * @param object
    198      * @return
    199      */
    200     private Set getWordsInDocument(String documentID) {
    201         Set result = new TreeSet();
    202         // TODO get document text, use getWordsInString
    203         // or better: do something clever using the indexes
    204         return result;
    205166    }
    206167
     
    270231
    271232    public String toString() {
    272         Set allSubscriptions = new TreeSet();
    273         allSubscriptions.addAll(noEqualsSubscriptions);
    274        
    275         for(Iterator iter = docIdEqualsSubscriptions.values().iterator(); iter.hasNext();) {
    276             Set values = (Set) iter.next();
    277             allSubscriptions.addAll(values);
    278         }
    279        
    280         for(Iterator iter = docCollectionIdEqualsSubscriptions.values().iterator(); iter.hasNext();) {
    281             Set values = (Set) iter.next();
    282             allSubscriptions.addAll(values);
    283         }
    284        
    285         for(Iterator iter = collectionIdEqualsSubscriptions.values().iterator(); iter.hasNext();) {
    286             Set values = (Set) iter.next();
    287             allSubscriptions.addAll(values);
    288         }
     233        Set allSubscriptions = getAllSubscriptions();
    289234       
    290235        StringBuffer buffer = new StringBuffer();
     
    298243        return buffer.toString();
    299244    }
     245
     246    /**
     247     * @return
     248     */
     249    public Set getAllSubscriptions() {
     250        Set allSubscriptions = new TreeSet();
     251        allSubscriptions.addAll(noEqualsSubscriptions);
     252       
     253        for(Iterator iter = docIdEqualsSubscriptions.values().iterator(); iter.hasNext();) {
     254            Set values = (Set) iter.next();
     255            allSubscriptions.addAll(values);
     256        }
     257       
     258        for(Iterator iter = docCollectionIdEqualsSubscriptions.values().iterator(); iter.hasNext();) {
     259            Set values = (Set) iter.next();
     260            allSubscriptions.addAll(values);
     261        }
     262       
     263        for(Iterator iter = collectionIdEqualsSubscriptions.values().iterator(); iter.hasNext();) {
     264            Set values = (Set) iter.next();
     265            allSubscriptions.addAll(values);
     266        }
     267        return Collections.unmodifiableSet(allSubscriptions);
     268    }
    300269   
    301270}
  • trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/profiles/Subscription.java

    r8609 r8630  
    5757    }
    5858   
    59     public Collection predicates() {
     59    public Collection getPredicates() {
    6060        return Collections.unmodifiableCollection(map.values());
    6161    }
Note: See TracChangeset for help on using the changeset viewer.