001: package org.columba.core.search.api;
002:
003: import java.util.List;
004:
005: import javax.swing.ImageIcon;
006:
007: import org.columba.api.gui.frame.IFrameMediator;
008: import org.columba.api.plugin.IExtensionInterface;
009: import org.columba.core.gui.search.api.ICriteriaRenderer;
010: import org.columba.core.gui.search.api.IResultPanel;
011:
012: /**
013: * Provider does the actual search and furthermore contains a description
014: * of the search criteria.
015: *
016: * @author frd
017: */
018: public interface ISearchProvider extends IExtensionInterface {
019:
020: /**
021: * Returns technical name. Should be unique.
022: * @return
023: */
024: public String getTechnicalName();
025:
026: /**
027: * Return provider human-readable name
028: * @return
029: */
030: public String getName();
031:
032: /**
033: * Return provider human-readable description
034: * @return
035: */
036: public String getDescription();
037:
038: /**
039: * Return provider icon
040: * @return
041: */
042: public ImageIcon getIcon();
043:
044: /**
045: * Retrieve search criteria for given search term.
046: *
047: * @param searchTerm
048: * @return
049: */
050: public List<ISearchCriteria> getAllCriteria(String searchTerm);
051:
052: /**
053: * Get result panel for given search criteria.
054: *
055: * @param searchCriteriaTechnicalName
056: * @return
057: */
058: public IResultPanel getResultPanel(
059: String searchCriteriaTechnicalName);
060:
061: /**
062: * Get result panel for a complex search across a couple of specific criteria.
063: *
064: * @return
065: */
066: public IResultPanel getComplexResultPanel();
067:
068: /**
069: * Get criteria renderer fo given search criteria technical name
070: *
071: * @param searchCriteriaTechnicalName
072: * @return
073: */
074: public ICriteriaRenderer getCriteriaRenderer(
075: String criteriaTechnicalName);
076:
077: /**
078: * Retrieve single search criteria for given search term.
079: *
080: * @param technicalName
081: * @param searchTerm
082: * @return
083: */
084: public ISearchCriteria getCriteria(String technicalName,
085: String searchTerm);
086:
087: public ISearchCriteria getDefaultCriteria(String searchTerm);
088:
089: /**
090: * Execute query and retrieve pageable search result for given search term and
091: * a single search criteria.
092: * <p>
093: * The query returns <code>resultCount</code> individual results, from
094: * a given <code>startIndex</code>. Paging should be supported, so its
095: * up to the underlying implementation to use an intelligent caching
096: * strategy or whatever necessary to make repetitive calls to this
097: * method fast.
098: *
099: * @param searchTerm search term
100: * @param searchCriteriaTechnicalName search criteria technical name
101: * @param searchInside search inside previous search results
102: * @param startIndex start index of search results
103: * @param resultCount total count of results
104: *
105: * @return
106: */
107: public List<ISearchResult> query(String searchTerm,
108: String searchCriteriaTechnicalName, boolean searchInside,
109: int startIndex, int resultCount);
110:
111: public List<ISearchResult> query(List<ISearchRequest> list,
112: boolean matchAll, boolean searchInside, int startIndex,
113: int resultCount);
114:
115: public void showAllResults(IFrameMediator mediator,
116: String searchTerm, String searchCriteriaTechnicalName);
117:
118: /**
119: * Check if search provider has executed a single criteria search.
120: *
121: * @return true, in case single criteria search was done. False, otherwise.
122: */
123: public boolean hasSingleCriteriaSearchResult();
124:
125: /**
126: * Return total number of search results. Method only returns valid result after calling
127: * <code>query</code> first.
128: *
129: * @return total number of search results. <code>-1</code>, in case <code>query</code> was not called, yet
130: */
131: public int getTotalResultCount();
132: }
|