com.gisgraphy.importer

## Class OpenStreetMapHouseNumberSimpleImporter

- java.lang.Object
- - com.gisgraphy.importer.AbstractSimpleImporterProcessor
  - - com.gisgraphy.importer.OpenStreetMapHouseNumberSimpleImporter

- All Implemented Interfaces:
    IImporterProcessor

      public class OpenStreetMapHouseNumberSimpleImporter
      extends AbstractSimpleImporterProcessor

  Import the street from an (pre-processed) openStreet map data file .
  Author:
    David Masclet

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.gisgraphy.fulltext.IFullTextSearchEngine` | `fullTextSearchEngine`
    `protected IhouseNumberDao` | `houseNumberDao`
    `protected static org.slf4j.Logger` | `logger`
    `protected static com.gisgraphy.domain.valueobject.Output` | `MEDIUM_OUTPUT`
    `protected IOpenStreetMapDao` | `openStreetMapDao`
    `protected static double` | `SEARCH_DISTANCE`
    `protected ISolRSynchroniser` | `solRSynchroniser`

    - ### Fields inherited from class com.gisgraphy.importer.AbstractSimpleImporterProcessor

      `COMMENT_START, currentFile, importerConfig, in, internationalisationService, readFileLine, status, statusMessage, totalReadLine, transactionManager, txDefinition, txStatus`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OpenStreetMapHouseNumberSimpleImporter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected HouseNumber` | `buildHouseNumberFromAssociatedHouseNumber(AssociatedStreetMember houseMember)`
    `protected OpenStreetMap` | `findNearestStreet(String streetName, com.vividsolutions.jts.geom.Point location)`
    `protected void` | `flushAndClear()` Should flush and clear all the Daos that are used by the processor.
    `protected File[]` | `getFiles()`
    `protected OpenStreetMap` | `getNearestByIds(List<com.gisgraphy.fulltext.SolrResponseDto> results, com.vividsolutions.jts.geom.Point point)`
    `protected int` | `getNumberOfColumns()`
    `protected AssociatedStreetHouseNumber` | `parseAssociatedStreetHouseNumber(String line)`
    `protected InterpolationHouseNumber` | `parseInterpolationHouseNumber(String line)`
    `protected NodeHouseNumber` | `parseNodeHouseNumber(String line)`
    `protected void` | `processAssociatedStreet(AssociatedStreetHouseNumber house)`
    `protected void` | `processData(String line)` Process a read line of the geonames file, must be implemented by the concrete class
    `protected List<HouseNumber>` | `processInterpolationHouseNumber(InterpolationHouseNumber house)`
    `protected HouseNumber` | `processNodeHouseNumber(NodeHouseNumber house)`
    `List<NameValueDTO<Integer>>` | `rollback()` /!
    `protected List<com.vividsolutions.jts.geom.Point>` | `segmentize(List<com.vividsolutions.jts.geom.Point> points, int nbInnerPoint)`
    `protected void` | `setCommitFlushMode()` Will flush after every commit
    `void` | `setFullTextSearchEngine(com.gisgraphy.fulltext.IFullTextSearchEngine fullTextSearchEngine)`
    `void` | `setHouseNumberDao(IhouseNumberDao houseNumberDao)`
    `void` | `setOpenStreetMapDao(IOpenStreetMapDao openStreetMapDao)`
    `void` | `setSolRSynchroniser(ISolRSynchroniser solRSynchroniser)`
    `protected void` | `setup()` Template method that can be override.
    `boolean` | `shouldBeSkipped()`
    `protected boolean` | `shouldIgnoreComments()` Whether the filter should ignore the comments (i.e. lines starting with #)
    `protected boolean` | `shouldIgnoreFirstLine()` Template Method : Whether the processor should ignore the first line of the input
    `protected void` | `tearDown()` Template method that can be override.

    - ### Methods inherited from class com.gisgraphy.importer.AbstractSimpleImporterProcessor

      `checkNumberOfColumn, commit, countLines, decrementReadedFileLine, dumpFields, getCurrentFileName, getMaxInsertsBeforeFlush, getNumberOfLinesToProcess, getReadFileLine, getStatus, getStatusMessage, getTotalReadLine, incrementReadedFileLine, isEmptyField, isEndOfDocument, needCommit, onFileProcessed, process, processError, readLineAndProcessData, resetStatus, rollbackTransaction, setImporterConfig, setInternationalisationService, setTransactionManager, startTransaction`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### logger

          protected static final org.slf4j.Logger logger

    - #### openStreetMapDao

          protected IOpenStreetMapDao openStreetMapDao

    - #### houseNumberDao

          protected IhouseNumberDao houseNumberDao

    - #### solRSynchroniser

          protected ISolRSynchroniser solRSynchroniser

    - #### fullTextSearchEngine

          protected com.gisgraphy.fulltext.IFullTextSearchEngine fullTextSearchEngine

    - #### MEDIUM_OUTPUT

          protected static final com.gisgraphy.domain.valueobject.Output MEDIUM_OUTPUT

    - #### SEARCH_DISTANCE

          protected static final double SEARCH_DISTANCE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### OpenStreetMapHouseNumberSimpleImporter

          public OpenStreetMapHouseNumberSimpleImporter()

  - ### Method Detail

    - #### flushAndClear

          protected void flushAndClear()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Should flush and clear all the Daos that are used by the processor. This avoid memory leak
      Specified by:
        `flushAndClear` in class `AbstractSimpleImporterProcessor`

    - #### setup

          protected void setup()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Template method that can be override. This method is called before the process start. it is not called for each file processed.
      Overrides:
        `setup` in class `AbstractSimpleImporterProcessor`

    - #### getFiles

          protected File[] getFiles()

      Specified by:
        `getFiles` in class `AbstractSimpleImporterProcessor`
      Returns:
        The files to be process
      See Also:
        `ImporterHelper`

    - #### getNumberOfColumns

          protected int getNumberOfColumns()

      Specified by:
        `getNumberOfColumns` in class `AbstractSimpleImporterProcessor`
      Returns:
        the number of fields the processed Geonames file should have

    - #### parseAssociatedStreetHouseNumber

          protected AssociatedStreetHouseNumber parseAssociatedStreetHouseNumber(String line)

    - #### parseInterpolationHouseNumber

          protected InterpolationHouseNumber parseInterpolationHouseNumber(String line)

    - #### parseNodeHouseNumber

          protected NodeHouseNumber parseNodeHouseNumber(String line)

    - #### processData

          protected void processData(String line)
                              throws ImporterException

      Description copied from class: `AbstractSimpleImporterProcessor`
      Process a read line of the geonames file, must be implemented by the concrete class
      Specified by:
        `processData` in class `AbstractSimpleImporterProcessor`
      Parameters:
        `line` - the line to process
      Throws:
        `ImporterException`

    - #### processAssociatedStreet

          protected void processAssociatedStreet(AssociatedStreetHouseNumber house)

    - #### processNodeHouseNumber

          protected HouseNumber processNodeHouseNumber(NodeHouseNumber house)

    - #### processInterpolationHouseNumber

          protected List<HouseNumber> processInterpolationHouseNumber(InterpolationHouseNumber house)

    - #### findNearestStreet

          protected OpenStreetMap findNearestStreet(String streetName,
                                        com.vividsolutions.jts.geom.Point location)

    - #### getNearestByIds

          protected OpenStreetMap getNearestByIds(List<com.gisgraphy.fulltext.SolrResponseDto> results,
                                      com.vividsolutions.jts.geom.Point point)

    - #### buildHouseNumberFromAssociatedHouseNumber

          protected HouseNumber buildHouseNumberFromAssociatedHouseNumber(AssociatedStreetMember houseMember)

    - #### segmentize

          protected List<com.vividsolutions.jts.geom.Point> segmentize(List<com.vividsolutions.jts.geom.Point> points,
                                                           int nbInnerPoint)

      Parameters:
        `points` - a list of point, typically a list of point that represent a street
        `nbInnerPoint` - the number of point to add beetween the startpoint and the endpoint
      Returns:
        the intermediate points that represents segments of same size, if nbInnerPoint=4, we will get 6 points back

    - #### shouldBeSkipped

          public boolean shouldBeSkipped()

      Specified by:
        `shouldBeSkipped` in interface `IImporterProcessor`
      Overrides:
        `shouldBeSkipped` in class `AbstractSimpleImporterProcessor`
      Returns:
        true if the processor should Not be executed

    - #### setCommitFlushMode

          protected void setCommitFlushMode()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Will flush after every commit
      Specified by:
        `setCommitFlushMode` in class `AbstractSimpleImporterProcessor`
      See Also:
        `AbstractSimpleImporterProcessor.flushAndClear()`

    - #### shouldIgnoreComments

          protected boolean shouldIgnoreComments()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Whether the filter should ignore the comments (i.e. lines starting with #)
      Specified by:
        `shouldIgnoreComments` in class `AbstractSimpleImporterProcessor`
      See Also:
        `AbstractSimpleImporterProcessor.COMMENT_START`

    - #### shouldIgnoreFirstLine

          protected boolean shouldIgnoreFirstLine()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Template Method : Whether the processor should ignore the first line of the input
      Specified by:
        `shouldIgnoreFirstLine` in class `AbstractSimpleImporterProcessor`
      Returns:
        true if the processor should ignore first line

    - #### rollback

          public List<NameValueDTO<Integer>> rollback()

      Description copied from interface: `IImporterProcessor`
      /!\ USE THIS METHOD VERY CAREFULLY /!\ : If you call this function, all the imported data for the specified importer will be deleted
      Returns:
        a NameValueDTO with the name of the deleted object and the number of deleted Object. No entry will be return for Object that were 0 object will be deleted except if an error occurred during the deletion.

    - #### tearDown

          protected void tearDown()

      Description copied from class: `AbstractSimpleImporterProcessor`
      Template method that can be override. This method is called after the end of the process. it is not called for each file processed. You should always call super.tearDown() when you overide this method
      Overrides:
        `tearDown` in class `AbstractSimpleImporterProcessor`

    - #### setHouseNumberDao

          public void setHouseNumberDao(IhouseNumberDao houseNumberDao)

    - #### setOpenStreetMapDao

          public void setOpenStreetMapDao(IOpenStreetMapDao openStreetMapDao)

    - #### setFullTextSearchEngine

          public void setFullTextSearchEngine(com.gisgraphy.fulltext.IFullTextSearchEngine fullTextSearchEngine)

    - #### setSolRSynchroniser

          public void setSolRSynchroniser(ISolRSynchroniser solRSynchroniser)

Copyright © 2015. All rights reserved.