com.trg.search
Interface ISearch

All Known Subinterfaces:
IMutableSearch
All Known Implementing Classes:
FlexSearchWrapper, Search

public interface ISearch

The base search DTO (data transfer object). A Search object is passed into a DAO or Search Processor to define the parameters for a search. There are six types of parameters that can be set.

ISearch is intended to be an immutable interface and only provides getters for each of the properties. The IMutableSearch interface extends ISearch by adding setters for all the properties.

Author:
dwolverton
See Also:
Filter, Field, Sort, IMutableSearch

Field Summary
static int RESULT_ARRAY
          Value for result mode.
static int RESULT_AUTO
          Value for result mode.
static int RESULT_LIST
          Value for result mode.
static int RESULT_MAP
          Value for result mode.
static int RESULT_SINGLE
          Value for result mode.
 
Method Summary
 java.util.List<java.lang.String> getFetches()
           
 java.util.List<Field> getFields()
           
 java.util.List<Filter> getFilters()
           
 int getFirstResult()
          Zero based index of first result record to return.
 int getMaxResults()
          The maximum number of records to return.
 int getPage()
          Zero based index of the page of records to return.
 int getResultMode()
          Result mode tells the search what form to use for the results.
 java.lang.Class<?> getSearchClass()
           
 java.util.List<Sort> getSorts()
           
 boolean isDisjunction()
           
 boolean isDistinct()
           
 

Field Detail

RESULT_AUTO

static final int RESULT_AUTO
Value for result mode. This is the default value. With RESULT_AUTO the result mode is automatically determined according to the following rules:

See Also:
getResultMode(), Constant Field Values

RESULT_ARRAY

static final int RESULT_ARRAY
Value for result mode. RESULT_ARRAY returns each result as an Object array (Object[]) with the entries corresponding to the fields added to the search. Here's an example:
 Search s = new Search(Person.class);
 s.setResultMode(Search.RESULT_ARRAY);
 s.addField("firstName");
 s.addField("lastName");
 for (Object[] array : dao.search(s)) {
        System.out.println(array[0] + " " + array[1]);
 }
 

See Also:
getResultMode(), Constant Field Values

RESULT_LIST

static final int RESULT_LIST
Value for result mode. RESULT_LIST returns each result as a list of Objects (List<Object> ). Here's an example:
 Search s = new Search(Person.class);
 s.setResultMode(Search.RESULT_LIST);
 s.addField("firstName");
 s.addField("lastName");
 for (List<Object> list : dao.search(s)) {
        System.out.println(list.get(0) + " " + list.get(1));
 }
 

See Also:
getResultMode(), Constant Field Values

RESULT_MAP

static final int RESULT_MAP
Value for result mode. RESULT_MAP returns each row as a map with properties' names or keys for keys to the corresponding values. Here's an example:
 Search s = new Search(Person.class);
 s.setResultMode(Search.RESULT_MAP;
 s.addField("firstName");
 s.addField("lastName", "ln");
 for (Map<String, Object> map : dao.search(s)) {
        System.out.println(map.get("firstName") + " " + map.get("ln"));
 }
 

See Also:
getResultMode(), Constant Field Values

RESULT_SINGLE

static final int RESULT_SINGLE
Value for result mode. RESULT_SINGLE - Exactly one field or no fields must be specified to use this result mode. The result list contains just the value of that property for each element. Here's an example:
 Search s = new Search(Person.class);
 s.setResultMode(Search.RESULT_SINGLE);
 s.addField("firstName");
 for (Object name : dao.search(s)) {
        System.out.println(name);
 }
 

See Also:
getResultMode(), Constant Field Values
Method Detail

getFirstResult

int getFirstResult()
Zero based index of first result record to return.

<= 0 for unspecified value.


getMaxResults

int getMaxResults()
The maximum number of records to return. Also used as page size when calculating the first record to return based on page.

<= 0 for unspecified value.


getPage

int getPage()
Zero based index of the page of records to return. The size of a page is determined by maxResults. If both page and maxResults are specified (i.e. > 0), the first result returned is calculated by page * maxResults.

firstResult has precedence over page. So if firstResult is specified (i.e. > 0), page is ignored.

<= 0 for unspecified value.


getSearchClass

java.lang.Class<?> getSearchClass()

getFilters

java.util.List<Filter> getFilters()

isDisjunction

boolean isDisjunction()

getSorts

java.util.List<Sort> getSorts()

getFields

java.util.List<Field> getFields()

isDistinct

boolean isDistinct()

getFetches

java.util.List<java.lang.String> getFetches()

getResultMode

int getResultMode()
Result mode tells the search what form to use for the results. Options include RESULT_AUTO, RESULT_ARRAY, RESULT_LIST , RESULT_MAP and RESULT_SINGLE .

See Also:
RESULT_AUTO, RESULT_ARRAY, RESULT_LIST, RESULT_MAP, RESULT_SINGLE


Copyright © 2008-2010 eBM WebSourcing. All Rights Reserved.