Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.gisgraphy.domain.repository
Class GenericGisDao<T extends GisFeature>

    java.lang.Object
      org.springframework.dao.support.DaoSupport
          org.springframework.orm.hibernate3.support.HibernateDaoSupport
              com.gisgraphy.domain.repository.GenericDao<T,Long>
                  com.gisgraphy.domain.repository.GenericGisDao<T>

Type Parameters:
  `T` - the type of the object the Gis Dao apply

All Implemented Interfaces:
  IDao<T,Long>, IGisDao<T>, org.springframework.beans.factory.InitializingBean

Direct Known Subclasses:
  AdmDao, AirportDao, AmuseParkDao, AqueducDao, ATMDao, BankDao, BarDao, BayDao, BeachDao, BridgeDao, BuildingDao, BusStationDao, CampDao, CanyonDao, CasinoDao, CastleDao, CemeteryDao, CirqueDao, CityDao, CitySubdivisionDao, CliffDao, CoastDao, ContinentDao, CountryDao, CourtHouseDao, CustomsPostDao, DamDao, DesertDao, FactoryDao, FallsDao, FarmDao, FieldDao, FishingAreaDao, FjordDao, ForestDao, GardenDao, GisFeatureDao, GolfDao, GorgeDao, GrassLandDao, GulfDao, HillDao, HospitalDao, HotelDao, HouseDao, IceDao, IslandDao, LakeDao, LibraryDao, LightHouseDao, MallDao, MarshDao, MetroStationDao, MilitaryDao, MillDao, MineDao, MoleDao, MonumentDao, MoundDao, MountainDao, MuseumDao, OasisDao, ObservatoryPointDao, OceanDao, OperaHouseDao, ParkDao, ParkingDao, PlantationDao, PolicePostDao, PoliticalEntityDao, PondDao, PortDao, PostOfficeDao, PrisonDao, PyramidDao, QuayDao, RailDao, RailRoadStationDao, RanchDao, RavinDao, ReefDao, ReligiousDao, ReserveDao, RestaurantDao, RoadDao, SchoolDao, SeaDao, SpringDao, StadiumDao, StraitDao, StreamDao, StreetDao, TheaterDao, TowerDao, TreeDao, TunnelDao, UnderSeaDao, VineyardDao, VolcanoDao, WaterBodyDao, ZooDao

    public class GenericGisDao<T extends GisFeature>

extends GenericDao<T,Long>
implements IGisDao<T>

Generic Dao for Gis Object (java-5 meaning) It suppose that the PK is of type long because its goal is to be used with class gisfeatures and class that extends GisFeature. if it is note the case. it is possible to create an other inteface
it adds some method to the GenericDao in order to acess GIS objects

Author:
  David Masclet
See Also:
  `GenericDao`

Field Summary
`static org.hibernate.type.Type` | `GEOMETRY_TYPE`
`static int` | `MAX_FULLTEXT_RESULTS`

Fields inherited from class com.gisgraphy.domain.repository.GenericDao
`persistentClass`

Fields inherited from class org.springframework.dao.support.DaoSupport
`logger`

Constructor Summary
`GenericGisDao(Class<T> persistentClass)` Constructor

Method Summary
`void` | `createGISTIndexForLocationColumn()` Create the database GIST index for the column 'location' for this entity
`int` | `deleteAll()` Delete all the object from the datastore
`void` | `deleteAll(List<T> list)` Delete all the specified object from the datastore
`T` | `getByFeatureId(Long featureId)` It is not the same as `IDao.get(java.io.Serializable)` which retrieve an object from his PK.
`List<T>` | `getDirties()` Returns inconsistant object (in most case object With featureid < 0)
`T` | `getEager(Long id)` Same as IDao#get(java.io.Serializable) but load the AlternateNames and The linked Adm
`List<com.gisgraphy.domain.valueobject.GisFeatureDistance>` | `getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point, double distance)` same as `IGisDao.getNearestAndDistanceFromGisFeature(GisFeature, double, int, int, boolean)` but without paginate
`List<com.gisgraphy.domain.valueobject.GisFeatureDistance>` | `getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point, double distance, int firstResult, int maxResults, boolean includeDistanceField)`
`protected List<com.gisgraphy.domain.valueobject.GisFeatureDistance>` | `getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point, Long pointId, double distance, int firstResult, int maxResults, boolean includeDistanceField, Class<? extends GisFeature> requiredClass)` base method for all findNearest*
`List<com.gisgraphy.domain.valueobject.GisFeatureDistance>` | `getNearestAndDistanceFromGisFeature(GisFeature gisFeature, double distance, boolean includeDistanceField)`
`List<com.gisgraphy.domain.valueobject.GisFeatureDistance>` | `getNearestAndDistanceFromGisFeature(GisFeature gisFeature, double distance, int firstResult, int maxResults, boolean includeDistanceField)`
`List<T>` | `listByFeatureIds(List<Long> ids)` return all the Object with the specified featureIds (not ids :id is the PK (aka datastore id), featureId is the domain value). return an emptylist if the list of ids is null or empty).
`List<T>` | `listByName(String name)` retrieve the Objects with the specified name (not the ASCII one)
`List<T>` | `listFromText(String name, boolean includeAlternateNames)` Do a full text search for the given name.
`protected List<T>` | `listFromText(String name, boolean includeAlternateNames, Class<T> clazz)` Do a full text search for the given name.
`void` | `remove(T gisFeature)` remove the object from the datastore
`T` | `save(T GisFeature)` Saves the passed object, and returns an attached entity.
`void` | `setEventManager(EventManager eventManager)`

Methods inherited from class com.gisgraphy.domain.repository.GenericDao
`count, exists, flushAndClear, get, getAll, getAllPaginate, getPersistenceClass, setFlushMode`

Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
`checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory`

Methods inherited from class org.springframework.dao.support.DaoSupport
`afterPropertiesSet, initDao`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.gisgraphy.domain.repository.IDao
`count, exists, flushAndClear, get, getAll, getAllPaginate, getPersistenceClass, setFlushMode`

Field Detail

### GEOMETRY_TYPE

    public static final org.hibernate.type.Type GEOMETRY_TYPE

### MAX_FULLTEXT_RESULTS

    public static final int MAX_FULLTEXT_RESULTS

See Also:
  Constant Field Values

Constructor Detail

### GenericGisDao

    public GenericGisDao(Class<T> persistentClass)

  Constructor

  Parameters:
    `persistentClass` - The specified Class for the GenericGisDao

Method Detail

### getNearestAndDistanceFromGisFeature

    public List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFromGisFeature(GisFeature gisFeature,
                                                                                                         double distance,
                                                                                                         int firstResult,
                                                                                                         int maxResults,
                                                                                                         boolean includeDistanceField)

  Specified by:
    `getNearestAndDistanceFromGisFeature` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `gisFeature` - The GisFeature from which we want to find GIS Object
    `distance` - distance The radius in meters
    `firstResult` - the firstResult index (for pagination), numbered from 1, if < 1 : it will not be taken into account
    `maxResults` - The Maximum number of results to retrieve (for pagination), if <= 0 : it will not be taken into acount
    `includeDistanceField` - Field whether or not we should process calculate the distance
  Returns:
    A List of GisFeatureDistance with the nearest elements or an emptylist (never return null), ordered by distance. note the specified gisFeature will not be included into results the results will be of the type of the currentDao
    tips : to search the nearest place use firstresult=1 and maxResults=1
  See Also:
    `GisFeatureDistance`

### getNearestAndDistanceFromGisFeature

    public List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFromGisFeature(GisFeature gisFeature,
                                                                                                         double distance,
                                                                                                         boolean includeDistanceField)

  Specified by:
    `getNearestAndDistanceFromGisFeature` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `gisFeature` - The GisFeature from which we want to find GIS Object
    `distance` - distance The radius in meters
    `includeDistanceField` - Field whether or not we should process calculate the distance
  Returns:
    A List of GisFeatureDistance with the nearest elements or an emptylist (never return null), ordered by distance. note the specified gisFeature will not be included into results the results will be of the type of the currentDao
  See Also:
    `GisFeatureDistance`

### getNearestAndDistanceFrom

    public List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point,
                                                                                               double distance)

  Description copied from interface: `IGisDao`
  same as `IGisDao.getNearestAndDistanceFromGisFeature(GisFeature, double, int, int, boolean)` but without paginate

  Specified by:
    `getNearestAndDistanceFrom` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `point` - The point from which we want to find GIS Object
    `distance` - distance The radius in meters
  Returns:
    A List of GisFeatureDistance with the nearest elements or an emptylist (never return null), ordered by distance. note the specified gisFeature will not be included into results the results will be of the type of the currentDao
  See Also:
    `GisFeatureDistance`

### getNearestAndDistanceFrom

    public List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point,
                                                                                               double distance,
                                                                                               int firstResult,
                                                                                               int maxResults,
                                                                                               boolean includeDistanceField)

  Specified by:
    `getNearestAndDistanceFrom` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `point` - The point from which we want to find GIS Object
    `distance` - distance The radius in meters
    `firstResult` - the firstResult index (for pagination), numbered from 1, if < 1 : it will not be taken into account
    `maxResults` - The Maximum number of results to retrieve (for pagination), if <= 0 : it will not be taken into acount
    `includeDistanceField` - Field whether or not we should process calculate the distance
  Returns:
    A List of GisFeatureDistance with the nearest elements or an emptylist (never return null), ordered by distance. note the specified gisFeature will not be included into results the results will be of the type of the currentDao
    tips: to search the nearest place use firstresult=1 and maxResults=1
  See Also:
    `GisFeatureDistance`

### getNearestAndDistanceFrom

    protected List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point,
                                                                                                  Long pointId,
                                                                                                  double distance,
                                                                                                  int firstResult,
                                                                                                  int maxResults,
                                                                                                  boolean includeDistanceField,
                                                                                                  Class<? extends GisFeature> requiredClass)

  base method for all findNearest*

  Parameters:
    `point` - The point from which we want to find GIS Object
    `distance` - distance The radius in meters
    `pointId` - the id of the point that we don't want to be include, it is used to not include the gisFeature from which we want to find the nearest
    `firstResult` - the firstResult index (for pagination), numbered from 1, if < 1 : it will not be taken into account
    `maxResults` - The Maximum number of results to retrieve (for pagination), if <= 0 : it will not be taken into acount
    `requiredClass` - the class of the object to be retireved
  Returns:
    A List of GisFeatureDistance with the nearest elements or an emptylist (never return null), ordered by distance.note the specified gisFeature will not be included into results
  See Also:
    `GisFeatureDistance`

### listByName

    public List<T> listByName(String name)

  Description copied from interface: `IGisDao`
  retrieve the Objects with the specified name (not the ASCII one)

  Specified by:
    `listByName` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `name` - the name of the objects to retrieve
  Returns:
    List of populated objects list (never return null, but an empty list)
  See Also:
    `IGisDao.listFromText(String, boolean)`

### getByFeatureId

    public T getByFeatureId(Long featureId)

  Description copied from interface: `IGisDao`
  It is not the same as `IDao.get(java.io.Serializable)` which retrieve an object from his PK.

  Specified by:
    `getByFeatureId` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `featureId` - the featureid of the GIS object to retrieve
  Returns:
    the Gis Object with the specified GisFeature id.

### getDirties

    public List<T> getDirties()

  Description copied from interface: `IGisDao`
  Returns inconsistant object (in most case object With featureid < 0)

  Specified by:
    `getDirties` in interface `IGisDao<T extends GisFeature>`
  Returns:
    List of populated objects (never return null, but an empty list)

### save

    public T save(T GisFeature)

  Description copied from interface: `IDao`
  Saves the passed object, and returns an attached entity. It is very very very important to use the returned entity, because of the way the underlying mechanism possibly works. For instance, when using Db4o, this is completly useless, but when using JPA and the merge method of the EntityManager, things are going to be buggy (Duplicate Key exceptions) if you don't use the returned object. Please consult EJB3 (or the concrete persistence framework doc) Spec for more information about the way the merge method works.

  Specified by:
    `save` in interface `IDao<T extends GisFeature,Long>`
  Overrides:
    `save` in class `GenericDao<T extends GisFeature,Long>`
  Parameters:
    `GisFeature` - The object to save
  Returns:
    The saved instance

### remove

    public void remove(T gisFeature)

  Description copied from interface: `IDao`
  remove the object from the datastore

  Specified by:
    `remove` in interface `IDao<T extends GisFeature,Long>`
  Overrides:
    `remove` in class `GenericDao<T extends GisFeature,Long>`
  Parameters:
    `gisFeature` - The object to remove

### listByFeatureIds

    public List<T> listByFeatureIds(List<Long> ids)

  Description copied from interface: `IGisDao`
  return all the Object with the specified featureIds (not ids :id is the PK (aka datastore id), featureId is the domain value). return an emptylist if the list of ids is null or empty). The features will be of the type of the Dao.

  Specified by:
    `listByFeatureIds` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `ids` - the list of the ids of the object to retrieve
  Returns:
    List of populated objects list (never return null, but an empty list)

### listFromText

    public List<T> listFromText(String name,
                                boolean includeAlternateNames)

  Description copied from interface: `IGisDao`
  Do a full text search for the given name. The search will be case, iso-latin, comma-separated insensitive
  search for 'saint-André', 'saint-Andre', 'SaInT-andré', 'st-andré', etc will return the same results Polymorphism is not supported, e.g : if you use gisfeatureDao the results will only be of that type and no feature of type City that extends gisFeature...etc will be returned.

  Specified by:
    `listFromText` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `name` - the name or zipcode of the GisFeature to search
    `includeAlternateNames` - wether we search in the alternatenames too
  Returns:
    a list of gisFeatures of type of the class for the given text. the max list size is `MAX_FULLTEXT_RESULTS`;
  See Also:
    `IGisFeatureDao.listAllFeaturesFromText(String, boolean)`

### listFromText

    protected List<T> listFromText(String name,
                                   boolean includeAlternateNames,
                                   Class<T> clazz)

  Do a full text search for the given name. The search will be case, iso-latin, comma-separated insensitive
  search for 'saint-André', 'saint-Andre', 'SaInT-andré', 'st-andré', etc will return the same results. note : search for zipcode too Polymorphism is not supported, e.g : if clazz=GisFeature : the results will only be of that type and no other feature type (e.g : City that extends gisFeature...etc) will be returned. The results will be sort by relevance.

  Parameters:
    `name` - The name to search for
    `includeAlternateNames` - Wether we search in the alternatenames too
    `clazz` - specify the features we want to search for, if null : no restriction is apply
  Returns:
    a list of gisFeatures of type of the class for the given text. the max list size is `MAX_FULLTEXT_RESULTS`;
  See Also:
    `IGisFeatureDao.listAllFeaturesFromText(String, boolean)`

### deleteAll

    public void deleteAll(List<T> list)

  Description copied from interface: `IDao`
  Delete all the specified object from the datastore

  Specified by:
    `deleteAll` in interface `IDao<T extends GisFeature,Long>`
  Overrides:
    `deleteAll` in class `GenericDao<T extends GisFeature,Long>`
  Parameters:
    `list` - the list of element to delete

### deleteAll

    public int deleteAll()

  Description copied from interface: `IDao`
  Delete all the object from the datastore

  Specified by:
    `deleteAll` in interface `IDao<T extends GisFeature,Long>`
  Overrides:
    `deleteAll` in class `GenericDao<T extends GisFeature,Long>`
  Returns:
    the number of deleted objects

### getEager

    public T getEager(Long id)

  Description copied from interface: `IGisDao`
  Same as IDao#get(java.io.Serializable) but load the AlternateNames and The linked Adm

  Specified by:
    `getEager` in interface `IGisDao<T extends GisFeature>`
  Parameters:
    `id` - the id of the features to retrieve
  Returns:
    The Feature with the alternateName and the Adm loaded
  See Also:
    `IDao.get(java.io.Serializable)`

### setEventManager

    public void setEventManager(EventManager eventManager)

### createGISTIndexForLocationColumn

    public void createGISTIndexForLocationColumn()

  Description copied from interface: `IGisDao`
  Create the database GIST index for the column 'location' for this entity

  Specified by:
    `createGISTIndexForLocationColumn` in interface `IGisDao<T extends GisFeature>`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012. All Rights Reserved.