Changeset 2606


Ignore:
Timestamp:
02/22/13 10:10:48 (11 years ago)
Author:
yana
Message:

the selection of corpus bug partially handled: when there is nothing checked in the corpora tree (even if it's selected) there will be message about selecting a corpus instead of null pointer exception...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/sresult/SearchResultsController.java

    r2599 r2606  
    6969    public void executeSearch(Set<Treeitem> selectedItems, int maxRecords, String searchString, SRUVersion version) {
    7070
    71         // execute search only if a user selected at least one endpint/corpus
    72         if (selectedItems.isEmpty()) {
    73             Messagebox.show("Please select at least one corpus!", "CLARIN-D FCS Aggregator", 0, Messagebox.EXCLAMATION);
    74             return;
    75         }
    7671        // execute search only if a user entered a search query
    7772        if (searchString == null || searchString.isEmpty()) {
     
    10499                new Object[]{searchString, maxRecords});
    105100       
     101        boolean requestSent = false;
    106102        for (Treeitem selectedItem : selectedItems) {
    107103            Object nodeData = selectedItem.getAttribute(CorpusTreeNodeRenderer.ITEM_DATA);
    108             if (selectedItem.getParentItem().isSelected() || (nodeData instanceof Institution)) {
     104            if ( (nodeData instanceof Institution) ||
     105                    selectedItem.getParentItem().isSelected() ) {
    109106                // don't query institution, and don't query subcorpus separately
    110107                // if there whole parent corpus/endpoint will be queried
    111108            } else {
     109                requestSent = true;
    112110                SearchResult resultsItem = executeRequest(nodeData, searchString, maxRecords, version);
    113111                resultsUnprocessed.add(resultsItem);
    114112            }
     113        }
     114       
     115        // there were no requests if a user didn't select at least one endpint/corpus
     116        if (!requestSent) {
     117            logger.log(Level.INFO, "No corpus/endpoint selected");
     118            Messagebox.show("Please select at least one corpus or endpoint!", "CLARIN-D FCS Aggregator", 0, Messagebox.EXCLAMATION);
    115119        }
    116120    }
Note: See TracChangeset for help on using the changeset viewer.