Class FeaturePagingHelperImpl

java.lang.Object
org.gvsig.tools.dispose.impl.AbstractDisposable
org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper
org.gvsig.fmap.dal.feature.paging.impl.FeaturePagingHelperImpl
All Implemented Interfaces:
Iterable<org.gvsig.fmap.dal.feature.Feature>, org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper, org.gvsig.tools.dispose.Disposable, org.gvsig.tools.dynobject.DynObjectPagingHelper, org.gvsig.tools.paging.PagingCalculator, org.gvsig.tools.util.GetItem64<org.gvsig.fmap.dal.feature.Feature>, org.gvsig.tools.util.GetItemWithSize64<org.gvsig.fmap.dal.feature.Feature>, org.gvsig.tools.util.GetItemWithSizeAndIterator64<org.gvsig.fmap.dal.feature.Feature>, org.gvsig.tools.util.GetItemWithSizeIsEmptyAndIterator64<org.gvsig.fmap.dal.feature.Feature>, org.gvsig.tools.util.IsEmpty, org.gvsig.tools.util.Size64

public class FeaturePagingHelperImpl extends org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper implements org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
Helper class to access the values of a FeatureCollection by position. Handles pagination automatically to avoid filling the memory in case of big collections. TODO: evaluate if its more convenient to read values in the background when the returned value is near the end of the page, instead of loading a page on demand.
Author:
gvSIG Team
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gvsig.tools.paging.PagingCalculator

    org.gvsig.tools.paging.PagingCalculator.Sizeable
  • Field Summary

    Fields inherited from interface org.gvsig.tools.util.GetItemWithSizeAndIterator64

    EMPTY_GETITEMWITHSIZEANDITERATOR64

    Fields inherited from interface org.gvsig.tools.util.GetItemWithSizeIsEmptyAndIterator64

    EMPTY_GETITEMWITHSIZEISEMPTYANDITERATOR64

    Fields inherited from interface org.gvsig.tools.paging.PagingCalculator

    DEFAULT_PAGE_SIZE
  • Constructor Summary

    Constructors
    Constructor
    Description
    FeaturePagingHelperImpl(org.gvsig.fmap.dal.feature.FeatureStore featureStore)
    Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
    FeaturePagingHelperImpl(org.gvsig.fmap.dal.feature.FeatureStore featureStore, int pageSize)
    Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
    FeaturePagingHelperImpl(org.gvsig.fmap.dal.feature.FeatureStore featureStore, org.gvsig.fmap.dal.feature.FeatureQuery featureQuery)
    Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
    FeaturePagingHelperImpl(org.gvsig.fmap.dal.feature.FeatureStore featureStore, org.gvsig.fmap.dal.feature.FeatureQuery featureQuery, int pageSize)
    Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    void
    delete(org.gvsig.fmap.dal.feature.Feature feature)
     
    protected void
     
    org.gvsig.fmap.dal.feature.Feature
    get64(long position)
     
    org.gvsig.tools.dynobject.DynObject[]
     
    org.gvsig.fmap.dal.feature.Feature[]
     
    org.gvsig.tools.dynobject.DynObject
    getDynObjectAt(long index)
     
    org.gvsig.tools.dynobject.DynObjectSet
     
    org.gvsig.fmap.dal.feature.Feature
    getFeatureAt(long index)
     
    org.gvsig.fmap.dal.feature.FeatureQuery
     
    org.gvsig.fmap.dal.feature.FeatureSet
     
    org.gvsig.fmap.dal.feature.FeatureStore
     
    org.gvsig.fmap.dal.feature.FeatureType
     
    org.gvsig.fmap.dal.feature.FeatureSelection
     
    void
    insert(org.gvsig.fmap.dal.feature.EditableFeature feature)
     
    boolean
     
    boolean
     
    Iterator<org.gvsig.fmap.dal.feature.Feature>
     
    protected void
    Loads all the Features of the current page.
    void
     
    void
     
    void
    setSelection(org.gvsig.fmap.dal.feature.FeatureSelection selection)
     
    void
    setSelectionUp(boolean selectionUp)
     
    long
     
     
    void
    update(org.gvsig.fmap.dal.feature.EditableFeature feature)
     

    Methods inherited from class org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper

    getCalculator, getCurrentPage, getCurrentPageSize, getInitialIndex, getMaxPageSize, getNumPages, getTotalSize, setCalculator, setCurrentPage, setDefaultCalculator, setDynObjectSet, setMaxPageSize

    Methods inherited from class org.gvsig.tools.dispose.impl.AbstractDisposable

    dispose, dispose

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.gvsig.tools.dispose.Disposable

    dispose

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.gvsig.tools.paging.PagingCalculator

    getCurrentPage, getCurrentPageSize, getInitialIndex, getMaxPageSize, getNumPages, getTotalSize, setCurrentPage, setMaxPageSize
  • Constructor Details

    • FeaturePagingHelperImpl

      public FeaturePagingHelperImpl(org.gvsig.fmap.dal.feature.FeatureStore featureStore) throws org.gvsig.tools.exception.BaseException
      Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
      Parameters:
      featureStore - to extract data from
      Throws:
      org.gvsig.fmap.dal.exception.DataException - if there is an error initializing the helper
      org.gvsig.tools.exception.BaseException
    • FeaturePagingHelperImpl

      public FeaturePagingHelperImpl(org.gvsig.fmap.dal.feature.FeatureStore featureStore, int pageSize) throws org.gvsig.tools.exception.BaseException
      Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
      Parameters:
      featureStore - to extract data from
      pageSize - the number of elements per page data
      Throws:
      org.gvsig.fmap.dal.exception.DataException - if there is an error initializing the helper
      org.gvsig.tools.exception.BaseException
    • FeaturePagingHelperImpl

      public FeaturePagingHelperImpl(org.gvsig.fmap.dal.feature.FeatureStore featureStore, org.gvsig.fmap.dal.feature.FeatureQuery featureQuery) throws org.gvsig.tools.exception.BaseException
      Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
      Parameters:
      featureStore - to extract data from
      featureQuery -
      Throws:
      org.gvsig.fmap.dal.exception.DataException - if there is an error initializing the helper
      org.gvsig.tools.exception.BaseException
    • FeaturePagingHelperImpl

      public FeaturePagingHelperImpl(org.gvsig.fmap.dal.feature.FeatureStore featureStore, org.gvsig.fmap.dal.feature.FeatureQuery featureQuery, int pageSize) throws org.gvsig.tools.exception.BaseException
      Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
      Parameters:
      featureStore -
      featureQuery -
      pageSize - the number of elements per page data
      Throws:
      org.gvsig.fmap.dal.exception.DataException - if there is an error initializing the helper
      org.gvsig.tools.exception.BaseException
  • Method Details

    • isSelectionUp

      public boolean isSelectionUp()
      Specified by:
      isSelectionUp in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
      Returns:
      the selectionUp status
    • getSelection

      public org.gvsig.fmap.dal.feature.FeatureSelection getSelection()
      Specified by:
      getSelection in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • setSelection

      public void setSelection(org.gvsig.fmap.dal.feature.FeatureSelection selection)
      Specified by:
      setSelection in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • setSelectionUp

      public void setSelectionUp(boolean selectionUp)
      Specified by:
      setSelectionUp in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • getFeatureAt

      public org.gvsig.fmap.dal.feature.Feature getFeatureAt(long index) throws org.gvsig.tools.exception.BaseException
      Specified by:
      getFeatureAt in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • getCurrentPageFeatures

      public org.gvsig.fmap.dal.feature.Feature[] getCurrentPageFeatures()
      Specified by:
      getCurrentPageFeatures in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • getFeatureSet

      public org.gvsig.fmap.dal.feature.FeatureSet getFeatureSet()
      Specified by:
      getFeatureSet in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • getDynObjectSet

      public org.gvsig.tools.dynobject.DynObjectSet getDynObjectSet()
      Specified by:
      getDynObjectSet in interface org.gvsig.tools.dynobject.DynObjectPagingHelper
      Overrides:
      getDynObjectSet in class org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper
    • reloadCurrentPage

      public void reloadCurrentPage() throws org.gvsig.tools.exception.BaseException
      Specified by:
      reloadCurrentPage in interface org.gvsig.tools.dynobject.DynObjectPagingHelper
      Overrides:
      reloadCurrentPage in class org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • reload

      public void reload() throws org.gvsig.tools.exception.BaseException
      Specified by:
      reload in interface org.gvsig.tools.dynobject.DynObjectPagingHelper
      Overrides:
      reload in class org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • getFeatureStore

      public org.gvsig.fmap.dal.feature.FeatureStore getFeatureStore()
      Specified by:
      getFeatureStore in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • getFeatureQuery

      public org.gvsig.fmap.dal.feature.FeatureQuery getFeatureQuery()
      Specified by:
      getFeatureQuery in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • loadCurrentPageData

      protected void loadCurrentPageData() throws org.gvsig.tools.exception.BaseException
      Loads all the Features of the current page.
      Overrides:
      loadCurrentPageData in class org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • delete

      public void delete(org.gvsig.fmap.dal.feature.Feature feature) throws org.gvsig.tools.exception.BaseException
      Specified by:
      delete in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • insert

      public void insert(org.gvsig.fmap.dal.feature.EditableFeature feature) throws org.gvsig.tools.exception.BaseException
      Specified by:
      insert in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
      Specified by:
      isEmpty in interface org.gvsig.tools.util.IsEmpty
    • update

      public void update(org.gvsig.fmap.dal.feature.EditableFeature feature) throws org.gvsig.tools.exception.BaseException
      Specified by:
      update in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • getFeatureType

      public org.gvsig.fmap.dal.feature.FeatureType getFeatureType()
      Specified by:
      getFeatureType in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • doDispose

      protected void doDispose() throws org.gvsig.tools.exception.BaseException
      Overrides:
      doDispose in class org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • getCurrentPageDynObjects

      public org.gvsig.tools.dynobject.DynObject[] getCurrentPageDynObjects()
      Specified by:
      getCurrentPageDynObjects in interface org.gvsig.tools.dynobject.DynObjectPagingHelper
      Overrides:
      getCurrentPageDynObjects in class org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper
    • getDynObjectAt

      public org.gvsig.tools.dynobject.DynObject getDynObjectAt(long index) throws org.gvsig.tools.exception.BaseException
      Specified by:
      getDynObjectAt in interface org.gvsig.tools.dynobject.DynObjectPagingHelper
      Overrides:
      getDynObjectAt in class org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper
      Throws:
      org.gvsig.tools.exception.BaseException
    • asList

      public List asList()
      Specified by:
      asList in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • asListOfDynObjects

      public List asListOfDynObjects()
      Specified by:
      asListOfDynObjects in interface org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper
    • size64

      public long size64()
      Specified by:
      size64 in interface org.gvsig.tools.util.Size64
    • get64

      public org.gvsig.fmap.dal.feature.Feature get64(long position)
      Specified by:
      get64 in interface org.gvsig.tools.util.GetItem64<org.gvsig.fmap.dal.feature.Feature>
    • iterator

      public Iterator<org.gvsig.fmap.dal.feature.Feature> iterator()
      Specified by:
      iterator in interface Iterable<org.gvsig.fmap.dal.feature.Feature>
    • toString

      public String toString()
      Overrides:
      toString in class Object