org.nuiton.wikitty
Class PagedResult<T>

java.lang.Object
  extended by org.nuiton.wikitty.PagedResult<T>
Type Parameters:
T - paged result value type
All Implemented Interfaces:
Serializable

public class PagedResult<T>
extends Object
implements Serializable

Paged result containing result collection and facet topics.

Version:
$Revision: 206 $ Last update: $Date: 2010-07-28 11:27:34 +0200 (mer., 28 juil. 2010) $ by : $Author: bbrossaud $
Author:
poussin
See Also:
Serialized Form

Field Summary
protected  Map<String,List<FacetTopic>> facets
          facet asked or null if no facet
protected  int firstIndice
          indice element in global search result
protected  int numFound
          total number of result if we call the query for all possible result
protected  String queryString
          query really executed
protected  List<T> results
          list of result in the wanted interval
 
Constructor Summary
PagedResult(int firstIndice, int numFound, String queryString, Map<String,List<FacetTopic>> facets, List<T> results)
          we don't initialize securityToken
 
Method Summary
 PagedResult<Wikitty> cast(String securityToken, WikittyService ws)
          Convert all result to the wikitty type and return new PagedResult with this new result list.
 PagedResult<Wikitty> cast(String securityToken, WikittyService ws, WikittyTransaction transaction)
          Convert all result to the wikitty type and return new PagedResult with this new result list.
<E extends BusinessEntityWikitty>
PagedResult<E>
cast(WikittyProxy proxy, Class<E> clazz)
          Call cast(WikittyProxy, Class, boolean) with autoconvert = true
<E extends BusinessEntityWikitty>
PagedResult<E>
cast(WikittyProxy proxy, Class<E> clazz, boolean autoconvert)
          Convert all result to the wanted type and return new PagedResult with this new result list.
 T get(int i)
          Return element at index.
 List<T> getAll()
          Return unmodifiable list of all result.
 Collection<String> getFacetNames()
          Return name of all facet used in query.
 Map<String,List<FacetTopic>> getFacets()
          Get map represent facets.
 T getFirst()
          Return the first element in result Can throw an exception if no element available
 int getFirstIndice()
           
 int getNumFound()
           
 String getQueryString()
           
 List<FacetTopic> getTopic(String facetName)
          Return all topic for the specified facet.
 int size()
          Return the number of result in this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

firstIndice

protected int firstIndice
indice element in global search result


numFound

protected int numFound
total number of result if we call the query for all possible result


queryString

protected String queryString
query really executed


results

protected List<T> results
list of result in the wanted interval


facets

protected Map<String,List<FacetTopic>> facets
facet asked or null if no facet

Constructor Detail

PagedResult

public PagedResult(int firstIndice,
                   int numFound,
                   String queryString,
                   Map<String,List<FacetTopic>> facets,
                   List<T> results)
we don't initialize securityToken

Parameters:
firstIndice -
numFound -
queryString -
facets -
results -
Method Detail

cast

public <E extends BusinessEntityWikitty> PagedResult<E> cast(WikittyProxy proxy,
                                                             Class<E> clazz)
Call cast(WikittyProxy, Class, boolean) with autoconvert = true

Parameters:
proxy - used to retrieve securityToken and WikittyService
clazz - target PagedResult type
Returns:
new PagedResult, this result can have less elements that original for some reason (security, ...)

cast

public PagedResult<Wikitty> cast(String securityToken,
                                 WikittyService ws)
Convert all result to the wikitty type and return new PagedResult with this new result list.

Parameters:
securityToken - security token
ws - wikitty service
Returns:
new PagedResult, this result can have less elements that original for some reason (security, ...)

cast

public PagedResult<Wikitty> cast(String securityToken,
                                 WikittyService ws,
                                 WikittyTransaction transaction)
Convert all result to the wikitty type and return new PagedResult with this new result list.

Parameters:
securityToken - security token
ws - wikitty service
transaction - transaction
Returns:
new PagedResult, this result can have less elements that original for some reason (security, ...)

cast

public <E extends BusinessEntityWikitty> PagedResult<E> cast(WikittyProxy proxy,
                                                             Class<E> clazz,
                                                             boolean autoconvert)
Convert all result to the wanted type and return new PagedResult with this new result list. If some result don't have the right extension (clazz) this extension is automatically added if autoconvert is true. Else an exception is thrown when result without extension is found. When you used autoconvert = false, you have a potentially problem when you have modified a BusinessEntity to have new extension and all your wikitty object are not uptodate in database.

Type Parameters:
E - class to cast into
Parameters:
proxy - used to retrieve securityToken and WikittyService
autoconvert - if autoconvert is false and object don't all needed extension, object is not put in the result
Returns:
new PagedResult, this result can have less elements that original for some reason (security, ...)

getFirstIndice

public int getFirstIndice()

getNumFound

public int getNumFound()

getQueryString

public String getQueryString()

getFacetNames

public Collection<String> getFacetNames()
Return name of all facet used in query.

Returns:
result's facets names

getTopic

public List<FacetTopic> getTopic(String facetName)
Return all topic for the specified facet.

Parameters:
facetName - name of the wanted facet
Returns:
facet's topics

getFacets

public Map<String,List<FacetTopic>> getFacets()
Get map represent facets.

Returns:
all facets

getFirst

public T getFirst()
Return the first element in result Can throw an exception if no element available

Returns:
first element

get

public T get(int i)
Return element at index.

Parameters:
i - index
Returns:
element at index

getAll

public List<T> getAll()
Return unmodifiable list of all result.

Returns:
all results

size

public int size()
Return the number of result in this object.

Returns:
result number


Copyright © 2009-2010 CodeLutin. All Rights Reserved.