com.gisgraphy.domain.repository
Class OpenStreetMapDao

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<OpenStreetMap,Long>
              extended by com.gisgraphy.domain.repository.OpenStreetMapDao
All Implemented Interfaces:
IDao<OpenStreetMap,Long>, IOpenStreetMapDao, org.springframework.beans.factory.InitializingBean

@Repository
public class OpenStreetMapDao
extends GenericDao<OpenStreetMap,Long>
implements IOpenStreetMapDao

A data access object for OpenStreetMap Object

Author:
David Masclet

Field Summary
protected static org.slf4j.Logger logger
          The logger
 
Fields inherited from class com.gisgraphy.domain.repository.GenericDao
persistentClass
 
Constructor Summary
OpenStreetMapDao()
          Default constructor
 
Method Summary
 void clearPartialSearchName()
          clear the value of the textsearchname column, the textsearchname column is used to calculate textsearchvector and is unused after the calculation
 long countEstimate()
           
 void createFulltextIndexes()
          Create the fulltext index for openstreetMap to improve performances
 void createSpatialIndexes()
          Create the database GIST for openstreetMap to improve performances
 int deleteAll()
          Delete all the object from the datastore
 OpenStreetMap getByGid(Long gid)
           
 long getMaxGid()
           
 long getMaxOpenstreetMapId()
           
 List<com.gisgraphy.domain.valueobject.StreetDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point, double distance, int firstResult, int maxResults, com.gisgraphy.street.StreetType streetType, Boolean oneWay, String name, com.gisgraphy.street.StreetSearchMode streetSearchMode, boolean includeDistanceField)
          base method for all findNearest
 void remove(OpenStreetMap openStreetMap)
          remove the object from the datastore
 OpenStreetMap save(OpenStreetMap openStreetMap)
          Saves the passed object, and returns an attached entity.
 void setEventManager(EventManager eventManager)
           
 void setStreetFactory(IStreetFactory streetFactory)
           
 Integer updateTS_vectorColumnForStreetNameSearch()
          Update the ts_vector column for the street name search (partial search and fulltext search)
 Integer updateTS_vectorColumnForStreetNameSearchPaginate(long from, long to)
          Update the ts_vector column for the street name search from the gid that are >= from and < to
 
Methods inherited from class com.gisgraphy.domain.repository.GenericDao
count, deleteAll, 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, deleteAll, exists, flushAndClear, get, getAll, getAllPaginate, getPersistenceClass, setFlushMode
 

Field Detail

logger

protected static final org.slf4j.Logger logger
The logger

Constructor Detail

OpenStreetMapDao

public OpenStreetMapDao()
Default constructor

Method Detail

getNearestAndDistanceFrom

public List<com.gisgraphy.domain.valueobject.StreetDistance> getNearestAndDistanceFrom(com.vividsolutions.jts.geom.Point point,
                                                                                       double distance,
                                                                                       int firstResult,
                                                                                       int maxResults,
                                                                                       com.gisgraphy.street.StreetType streetType,
                                                                                       Boolean oneWay,
                                                                                       String name,
                                                                                       com.gisgraphy.street.StreetSearchMode streetSearchMode,
                                                                                       boolean includeDistanceField)
Description copied from interface: IOpenStreetMapDao
base method for all findNearest

Specified by:
getNearestAndDistanceFrom in interface IOpenStreetMapDao
Parameters:
point - The point from which we want to find GIS Object
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
streetType - The type of street
oneWay - whether the street should be oneway or not
name - the name the street name must contains
streetSearchMode - if we search in fulltext or contain mode
includeDistanceField - if we have to calculate the distance or not
Returns:
A List of StreetDistance with the nearest elements or an empty list (never return null), ordered by distance.
See Also:
StreetDistance

getByGid

public OpenStreetMap getByGid(Long gid)
Specified by:
getByGid in interface IOpenStreetMapDao
Parameters:
gid - the gid of the openstreetmap entity we want to retrieve
Returns:
the OpenstreetMap entity or null if not found

updateTS_vectorColumnForStreetNameSearch

public Integer updateTS_vectorColumnForStreetNameSearch()
Description copied from interface: IOpenStreetMapDao
Update the ts_vector column for the street name search (partial search and fulltext search)

Specified by:
updateTS_vectorColumnForStreetNameSearch in interface IOpenStreetMapDao
Returns:
the number of line updated
See Also:
StreetSearchMode

updateTS_vectorColumnForStreetNameSearchPaginate

public Integer updateTS_vectorColumnForStreetNameSearchPaginate(long from,
                                                                long to)
Description copied from interface: IOpenStreetMapDao
Update the ts_vector column for the street name search from the gid that are >= from and < to

Specified by:
updateTS_vectorColumnForStreetNameSearchPaginate in interface IOpenStreetMapDao
Parameters:
from - the start pagination index of gid
to - the end pagination index (partial search and fulltext search)
Returns:
the number of line updated
See Also:
StreetSearchMode

createSpatialIndexes

public void createSpatialIndexes()
Description copied from interface: IOpenStreetMapDao
Create the database GIST for openstreetMap to improve performances

Specified by:
createSpatialIndexes in interface IOpenStreetMapDao

createFulltextIndexes

public void createFulltextIndexes()
Description copied from interface: IOpenStreetMapDao
Create the fulltext index for openstreetMap to improve performances

Specified by:
createFulltextIndexes in interface IOpenStreetMapDao

clearPartialSearchName

public void clearPartialSearchName()
Description copied from interface: IOpenStreetMapDao
clear the value of the textsearchname column, the textsearchname column is used to calculate textsearchvector and is unused after the calculation

Specified by:
clearPartialSearchName in interface IOpenStreetMapDao

countEstimate

public long countEstimate()
Specified by:
countEstimate in interface IOpenStreetMapDao
Returns:
the number of streets based on the highest gid

save

public OpenStreetMap save(OpenStreetMap openStreetMap)
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<OpenStreetMap,Long>
Overrides:
save in class GenericDao<OpenStreetMap,Long>
Parameters:
openStreetMap - The object to save
Returns:
The saved instance

remove

public void remove(OpenStreetMap openStreetMap)
Description copied from interface: IDao
remove the object from the datastore

Specified by:
remove in interface IDao<OpenStreetMap,Long>
Overrides:
remove in class GenericDao<OpenStreetMap,Long>
Parameters:
openStreetMap - The object to remove

deleteAll

public int deleteAll()
Description copied from interface: IDao
Delete all the object from the datastore

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

getMaxOpenstreetMapId

public long getMaxOpenstreetMapId()
Specified by:
getMaxOpenstreetMapId in interface IOpenStreetMapDao
Returns:
the highest openstreetMapId

getMaxGid

public long getMaxGid()
Specified by:
getMaxGid in interface IOpenStreetMapDao
Returns:
the highest Gid

setEventManager

public void setEventManager(EventManager eventManager)

setStreetFactory

public void setStreetFactory(IStreetFactory streetFactory)


Copyright © 2012. All Rights Reserved.