org.directwebremoting.io
Class StoreRegion

java.lang.Object
  extended by org.directwebremoting.io.StoreRegion

public final class StoreRegion
extends java.lang.Object

A zone of data within a StoreProvider. Useful for either requesting a block of data, or for declaring a subscription. The StoreProvider will first apply the query and the sort criteria and then restrict the data according to the getStart() and getCount(). The latter 2 denote the viewed region. TODO: Support setter injection, remove the setters, make fields final

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
StoreRegion()
          Create a StoreRegion that uses the default values of start=0, count=-1 (i.e.
StoreRegion(int start, int count, java.util.List<SortCriterion> sort, java.util.Map<java.lang.String,java.lang.String> query, QueryOptions queryOptions)
          Create a StoreRegion with non default values
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getCount()
          Accessor for the length of the region of interest to the viewer.
 java.util.Map<java.lang.String,java.lang.String> getQuery()
          Accessor for the filter criteria to be used before the range is extracted.
 QueryOptions getQueryOptions()
          Partially supported by DWR (ignoreCase attribute only).
 java.util.List<SortCriterion> getSort()
          Accessor for the sort criteria to be used before the range is extracted.
 int getStart()
          Accessor for the start of the range of interest.
 int hashCode()
           
 void setQuery(java.util.Map<java.lang.String,java.lang.String> query)
          Deprecated. For DWR internal use only. Use constructor injection
 void setQueryOptions(QueryOptions queryOptions)
          Deprecated. For DWR internal use only. Use constructor injection
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StoreRegion

public StoreRegion()
Create a StoreRegion that uses the default values of start=0, count=-1 (i.e. everything), sort=null (i.e. the default store sorting) and filter=null (i.e. no filtering)


StoreRegion

public StoreRegion(int start,
                   int count,
                   java.util.List<SortCriterion> sort,
                   java.util.Map<java.lang.String,java.lang.String> query,
                   QueryOptions queryOptions)
Create a StoreRegion with non default values

Parameters:
start - The start of the range of interest
count - The length of the region of interest to the viewer
sort - The sort criteria to be used before the range is extracted
query - The filter criteria to be used before the range is extracted
Method Detail

getStart

public int getStart()
Accessor for the start of the range of interest. The initial index is always 0. This refers to the post filter/sort ordering

Returns:
The start of the range of interest

getCount

public int getCount()
Accessor for the length of the region of interest to the viewer. If the subscriber wishes to subscribe to 'the rest of the data', they should use count = -1. Thus using start = 0, count = -1 is the entire data set. If start + count > size of data set, then less data will be sent than was requested. If at a later date the store grows such that it is bigger than the requested data set, the extra items will be included.

Returns:
The length of the region of interest to the viewer

getSort

public java.util.List<SortCriterion> getSort()
Accessor for the sort criteria to be used before the range is extracted. Using null as a sort criteria means 'no sorting'. Sort criteria can be expensive to server resources, so using no sorting could be much faster. StoreProviders must define a default sort order

Returns:
The sort criteria to be used before the range is extracted

getQuery

public java.util.Map<java.lang.String,java.lang.String> getQuery()
Accessor for the filter criteria to be used before the range is extracted. This functions much like the sort criteria, except, clearly this is filtering and not sorting.

Returns:
Filter criteria to be used before the range is extracted.

setQuery

@Deprecated
public void setQuery(java.util.Map<java.lang.String,java.lang.String> query)
Deprecated. For DWR internal use only. Use constructor injection


getQueryOptions

public QueryOptions getQueryOptions()
Partially supported by DWR (ignoreCase attribute only).

Returns:
Filter criteria to be used before the range is extracted.

setQueryOptions

@Deprecated
public void setQueryOptions(QueryOptions queryOptions)
Deprecated. For DWR internal use only. Use constructor injection


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

Copyright 2008