com.gisgraphy.domain.repository
Class GisFeatureDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by com.gisgraphy.domain.repository.GenericDao<T,Long>
              extended by com.gisgraphy.domain.repository.GenericGisDao<GisFeature>
                  extended by com.gisgraphy.domain.repository.GisFeatureDao
All Implemented Interfaces:
IDao<GisFeature,Long>, IGisDao<GisFeature>, IGisFeatureDao, org.springframework.beans.factory.InitializingBean

@Repository
public class GisFeatureDao
extends GenericGisDao<GisFeature>
implements IGisFeatureDao

A data access object for GisFeature

Author:
David Masclet

Field Summary
 
Fields inherited from class com.gisgraphy.domain.repository.GenericGisDao
GEOMETRY_TYPE, 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
GisFeatureDao()
          Default Constructor
 
Method Summary
 int deleteAllExceptAdmsAndCountries()
          Delete all gisFeatures and subclass except Adms and countries (gisFeature with null featureCode will be deleted too). this method is usefull when gisFeature 'belongs' to some adms and we want to delete the gisfeature first and then the adms and countries.
 long getMaxFeatureId()
           
 List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point, double distance, boolean includeDistanceField, Class<? extends GisFeature> requiredClass)
           
 List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point, double distance, int firstResult, int maxResults, boolean includeDistanceField, Class<? extends GisFeature> requiredClass)
          tips to search the nearestplace use firstresult=1 and maxResults=1
 List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFromGisFeature(GisFeature gisFeature, double distance, boolean includeDistanceField, Class<? extends GisFeature> requiredClass)
           
 List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFromGisFeature(GisFeature gisFeature, double distance, int firstResult, int maxResults, boolean includeDistanceField, Class<? extends GisFeature> requiredClass)
          tips to search the nearestplace use firstresult=1 and maxResults=1
 List<GisFeature> listAllFeaturesFromText(String name, boolean includeAlternateNames)
          Do a full text search for the given name.
 
Methods inherited from class com.gisgraphy.domain.repository.GenericGisDao
createGISTIndexForLocationColumn, deleteAll, deleteAll, getByFeatureId, getDirties, getEager, getNearestAndDistanceFrom, getNearestAndDistanceFrom, getNearestAndDistanceFrom, getNearestAndDistanceFromGisFeature, getNearestAndDistanceFromGisFeature, listByFeatureIds, listByName, listFromText, listFromText, remove, save, setEventManager
 
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.IGisDao
createGISTIndexForLocationColumn, getByFeatureId, getDirties, getEager, getNearestAndDistanceFrom, getNearestAndDistanceFrom, getNearestAndDistanceFromGisFeature, getNearestAndDistanceFromGisFeature, listByFeatureIds, listByName, listFromText
 
Methods inherited from interface com.gisgraphy.domain.repository.IDao
count, deleteAll, deleteAll, exists, flushAndClear, get, getAll, getAllPaginate, getPersistenceClass, remove, save, setFlushMode
 

Constructor Detail

GisFeatureDao

public GisFeatureDao()
Default Constructor

Method Detail

listAllFeaturesFromText

public List<GisFeature> listAllFeaturesFromText(String name,
                                                boolean includeAlternateNames)
Description copied from interface: IGisFeatureDao
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. The search is done for all type, independentely of the type

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

getNearestAndDistanceFromGisFeature

public List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFromGisFeature(GisFeature gisFeature,
                                                                                                     double distance,
                                                                                                     int firstResult,
                                                                                                     int maxResults,
                                                                                                     boolean includeDistanceField,
                                                                                                     Class<? extends GisFeature> requiredClass)
Description copied from interface: IGisFeatureDao
tips to search the nearestplace use firstresult=1 and maxResults=1

Specified by:
getNearestAndDistanceFromGisFeature in interface IGisFeatureDao
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
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

getNearestAndDistanceFromGisFeature

public List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFromGisFeature(GisFeature gisFeature,
                                                                                                     double distance,
                                                                                                     boolean includeDistanceField,
                                                                                                     Class<? extends GisFeature> requiredClass)
Specified by:
getNearestAndDistanceFromGisFeature in interface IGisFeatureDao
Parameters:
gisFeature - The GisFeature from which we want to find GIS Object
distance - distance The radius in meters
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

getNearestAndDistanceFrom

public List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point,
                                                                                           double distance,
                                                                                           int firstResult,
                                                                                           int maxResults,
                                                                                           boolean includeDistanceField,
                                                                                           Class<? extends GisFeature> requiredClass)
Description copied from interface: IGisFeatureDao
tips to search the nearestplace use firstresult=1 and maxResults=1

Specified by:
getNearestAndDistanceFrom in interface IGisFeatureDao
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
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

getNearestAndDistanceFrom

public List<com.gisgraphy.domain.valueobject.GisFeatureDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point,
                                                                                           double distance,
                                                                                           boolean includeDistanceField,
                                                                                           Class<? extends GisFeature> requiredClass)
Specified by:
getNearestAndDistanceFrom in interface IGisFeatureDao
Parameters:
point - The point from which we want to find GIS Object
distance - distance The radius in meters
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

deleteAllExceptAdmsAndCountries

public int deleteAllExceptAdmsAndCountries()
Description copied from interface: IGisFeatureDao
Delete all gisFeatures and subclass except Adms and countries (gisFeature with null featureCode will be deleted too). this method is usefull when gisFeature 'belongs' to some adms and we want to delete the gisfeature first and then the adms and countries. We don't control the fact that adms should be delete after all gisFeature due to Primary /foreign key with GenericGisDao.deleteAll()

Specified by:
deleteAllExceptAdmsAndCountries in interface IGisFeatureDao
Returns:
the number of deleted elements

getMaxFeatureId

public long getMaxFeatureId()
Specified by:
getMaxFeatureId in interface IGisFeatureDao
Returns:
the highest featureId (independant from the placetype)


Copyright © 2012. All Rights Reserved.