com.gisgraphy.domain.repository

## Class OpenStreetMapDao

- java.lang.Object
- - org.springframework.dao.support.DaoSupport
  - - org.springframework.orm.hibernate3.support.HibernateDaoSupport
    - - com.gisgraphy.domain.repository.GenericDao<OpenStreetMap,Long>
      - - 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static int` | `DEFAULT_DISTANCE`
    `protected static org.slf4j.Logger` | `logger` The logger

    - ### Fields inherited from class com.gisgraphy.domain.repository.GenericDao

      `persistentClass`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OpenStreetMapDao()` Default constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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)`
    `OpenStreetMap` | `getByOpenStreetMapId(Long openstreetmapId)`
    `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
    `OpenStreetMap` | `getNearestByosmIds(com.vividsolutions.jts.geom.Point point, List<Long> ids)`
    `OpenStreetMap` | `getNearestFrom(com.vividsolutions.jts.geom.Point point)` find the nearest street based on the shape, not the middle point
    `OpenStreetMap` | `getNearestFrom(com.vividsolutions.jts.geom.Point point, boolean onlyroad, boolean filterEmptyName)`
    `OpenStreetMap` | `getNearestRoadFrom(com.vividsolutions.jts.geom.Point point)` find the nearest road based on the shape, not the middle point and exclude footway
    `String` | `getShapeAsWKTByGId(Long gid)`
    `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

    - #### DEFAULT_DISTANCE

          protected static final int DEFAULT_DISTANCE

      See Also:
        Constant Field Values

  - ### 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`

    - #### 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

    - #### getByOpenStreetMapId

          public OpenStreetMap getByOpenStreetMapId(Long openstreetmapId)

      Specified by:
        `getByOpenStreetMapId` in interface `IOpenStreetMapDao`
      Parameters:
        `openstreetmapId` - the openstreetmap id (not the id, not the gid)
      Returns:
        the openstreetmap

    - #### getMaxOpenstreetMapId

          public long getMaxOpenstreetMapId()

      Specified by:
        `getMaxOpenstreetMapId` in interface `IOpenStreetMapDao`
      Returns:
        the highest openstreetMapId

    - #### getNearestByosmIds

          public OpenStreetMap getNearestByosmIds(com.vividsolutions.jts.geom.Point point,
                                         List<Long> ids)

      Specified by:
        `getNearestByosmIds` in interface `IOpenStreetMapDao`
      Parameters:
        `point` - the point to search around
        `ids` - the openstreetmap ids of streets we want to restrict search
      Returns:
        the nearest street of all the streets with the ids specified, for the given point

    - #### getMaxGid

          public long getMaxGid()

      Specified by:
        `getMaxGid` in interface `IOpenStreetMapDao`
      Returns:
        the highest Gid

    - #### setEventManager

          @Autowired
          public void setEventManager(EventManager eventManager)

    - #### setStreetFactory

          public void setStreetFactory(IStreetFactory streetFactory)

    - #### getNearestRoadFrom

          public OpenStreetMap getNearestRoadFrom(com.vividsolutions.jts.geom.Point point)

      Description copied from interface: `IOpenStreetMapDao`
      find the nearest road based on the shape, not the middle point and exclude footway
      Specified by:
        `getNearestRoadFrom` in interface `IOpenStreetMapDao`
      Parameters:
        `point` - The point from which we want to find street

    - #### getNearestFrom

          public OpenStreetMap getNearestFrom(com.vividsolutions.jts.geom.Point point)

      Description copied from interface: `IOpenStreetMapDao`
      find the nearest street based on the shape, not the middle point
      Specified by:
        `getNearestFrom` in interface `IOpenStreetMapDao`
      Parameters:
        `point` - The point from which we want to find street

    - #### getNearestFrom

          public OpenStreetMap getNearestFrom(com.vividsolutions.jts.geom.Point point,
                                     boolean onlyroad,
                                     boolean filterEmptyName)

      Specified by:
        `getNearestFrom` in interface `IOpenStreetMapDao`
        `filterEmptyName` - filter street with name=null
      Returns:
        the nearest street based on the shape, not the middle point

    - #### getShapeAsWKTByGId

          public String getShapeAsWKTByGId(Long gid)

      Specified by:
        `getShapeAsWKTByGId` in interface `IOpenStreetMapDao`
      Parameters:
        `gid` - the gid of the feature
      Returns:
        the shape as wkt

Copyright © 2015. All rights reserved.