Package org.cruk.clarity.api.search
Class Search<E extends Locatable>
java.lang.Object
org.cruk.clarity.api.search.Search<E>
- Type Parameters:
E- The type of object the search is for.
- All Implemented Interfaces:
Serializable
A class holding both the parameters of a search and the links returned
from that search.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the results of the search.Get the name of the file that will store the result of this search.static StringgetSearchFileName(SearchTerms<?> terms) Get the name of the file that will store the result of the given search.Get the parameters of this search.booleanMerge the results of another search into this search's results.voidsetResults(List<LimsLink<E>> results) Set the results of the search.toString()Get a human readable representation of this object.
-
Field Details
-
SEARCH_FILE_PATTERN
The default name for search files. The parameter should be filled with the hexadecimal value of the search term's hash code.
-
-
Constructor Details
-
Search
Constructor that takes the parameters from a call to the API'sfindmethod.- Parameters:
searchTerms- The search parameters.entityClass- The type of object being searched for.
-
Search
Constructor that accepts an already createdSearchTermsobject.- Parameters:
searchTerms- The search terms.- Throws:
IllegalArgumentException- ifsearchTermsis null.
-
-
Method Details
-
getSearchTerms
Get the parameters of this search.- Returns:
- The search terms.
-
getResults
Get the results of the search.- Returns:
- A list of links to the entities searched for.
-
setResults
Set the results of the search.- Parameters:
results- The links that are the result of the search.
-
merge
Merge the results of another search into this search's results.- Parameters:
otherSearch- The search to merge in. Must be a search for the same type of entities as this search.- Returns:
- true if any results have been added to this search's results from the other search, false if not (i.e. if this search's results have not changed).
- Throws:
IllegalArgumentException- ifotherSearchis a search for a different type of entity.
-
toString
Get a human readable representation of this object. Shows the search terms and, if results are set, the number of links in the results. -
getSearchFileName
Get the name of the file that will store the result of this search.- Returns:
- The name of the file the search will be stored in.
-
getSearchFileName
Get the name of the file that will store the result of the given search. Convenience method here meaning all calls for record and playback will be consistent.- Parameters:
terms- The search terms.- Returns:
- The name of the file the search will be stored in.
-