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.importer
Class GeonamesZipCodeSimpleImporter

    java.lang.Object
      com.gisgraphy.importer.AbstractSimpleImporterProcessor
          com.gisgraphy.importer.GeonamesZipCodeSimpleImporter

All Implemented Interfaces:
  IImporterProcessor

    public class GeonamesZipCodeSimpleImporter

extends AbstractSimpleImporterProcessor

Import the zipcode from a Geonames dump file.

Author:
  David Masclet

Field Summary
`protected int[]` | `accuracyToDistance`
`protected IAdmDao` | `admDao`
`protected ICityDao` | `cityDao`
`protected com.gisgraphy.fulltext.IFullTextSearchEngine` | `fullTextSearchEngine`
`protected IGisFeatureDao` | `gisFeatureDao`
`protected IIdGenerator` | `IdGenerator`
`protected ISolRSynchroniser` | `solRSynchroniser`
`protected IZipCodeDao` | `zipCodeDao`

Fields inherited from class com.gisgraphy.importer.AbstractSimpleImporterProcessor
`COMMENT_START, currentFile, importerConfig, in, internationalisationService, logger, readFileLine, status, statusMessage, totalReadLine, transactionManager, txDefinition, txStatus`

Constructor Summary
`GeonamesZipCodeSimpleImporter()`

Method Summary
`protected GisFeature` | `addAndSaveZipCodeToFeature(String code, Long featureId)`
`protected GisFeature` | `addNewEntityAndZip(String[] fields)`
`protected com.gisgraphy.fulltext.FulltextResultsDto` | `doAFulltextSearch(String query, String countryCode)`
`protected Long` | `findFeature(String[] fields, com.vividsolutions.jts.geom.Point zipPoint, int maxDistance)`
`protected Long` | `findNearest(com.vividsolutions.jts.geom.Point zipPoint, int maxDistance, com.gisgraphy.fulltext.FulltextResultsDto results)`
`protected void` | `flushAndClear()` Should flush and clear all the Daos that are used by the processor.
`protected int` | `getAccurateDistance(int accuracyLevel)`
`protected File[]` | `getFiles()`
`protected int` | `getNumberOfColumns()`
`protected void` | `processData(String line)` Process a read line of the geonames file, must be implemented by the concrete class
`List<NameValueDTO<Integer>>` | `rollback()` /!
`void` | `setAdmDao(IAdmDao admDao)`
`void` | `setCityDao(ICityDao cityDao)`
`protected void` | `setCommitFlushMode()` Will flush after every commit
`void` | `setFullTextSearchEngine(com.gisgraphy.fulltext.IFullTextSearchEngine fullTextSearchEngine)`
`void` | `setGisFeatureDao(IGisFeatureDao gisFeatureDao)`
`void` | `setIdGenerator(IIdGenerator idGenerator)`
`void` | `setSolRSynchroniser(ISolRSynchroniser solRSynchroniser)`
`protected void` | `setup()` Template method that can be override.
`void` | `setZipCodeDao(IZipCodeDao zipCodeDao)`
`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

### gisFeatureDao

    protected IGisFeatureDao gisFeatureDao

### admDao

    protected IAdmDao admDao

### fullTextSearchEngine

    protected com.gisgraphy.fulltext.IFullTextSearchEngine fullTextSearchEngine

### solRSynchroniser

    protected ISolRSynchroniser solRSynchroniser

### cityDao

    protected ICityDao cityDao

### zipCodeDao

    protected IZipCodeDao zipCodeDao

### IdGenerator

    protected IIdGenerator IdGenerator

### accuracyToDistance

    protected int[] accuracyToDistance

Constructor Detail

### GeonamesZipCodeSimpleImporter

    public GeonamesZipCodeSimpleImporter()

Method Detail

### processData

    protected void processData(String line)

  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

### findFeature

    protected Long findFeature(String[] fields,
                               com.vividsolutions.jts.geom.Point zipPoint,
                               int maxDistance)

### findNearest

    protected Long findNearest(com.vividsolutions.jts.geom.Point zipPoint,
                               int maxDistance,
                               com.gisgraphy.fulltext.FulltextResultsDto results)

### getAccurateDistance

    protected int getAccurateDistance(int accuracyLevel)

### addNewEntityAndZip

    protected GisFeature addNewEntityAndZip(String[] fields)

### addAndSaveZipCodeToFeature

    protected GisFeature addAndSaveZipCodeToFeature(String code,
                                                    Long featureId)

### doAFulltextSearch

    protected com.gisgraphy.fulltext.FulltextResultsDto doAFulltextSearch(String query,
                                                                          String countryCode)

### shouldBeSkipped

    public boolean shouldBeSkipped()

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

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

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

### setCommitFlushMode

    protected void setCommitFlushMode()

  Description copied from class: `AbstractSimpleImporterProcessor`
  Will flush after every commit

  Specified by:
    `setCommitFlushMode` in class `AbstractSimpleImporterProcessor`
  See Also:
    `AbstractSimpleImporterProcessor.flushAndClear()`

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

### getNumberOfColumns

    protected int getNumberOfColumns()

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

### setCityDao

    public void setCityDao(ICityDao cityDao)

  Parameters:
    `cityDao` - The CityDao to set

### setGisFeatureDao

    public void setGisFeatureDao(IGisFeatureDao gisFeatureDao)

  Parameters:
    `gisFeatureDao` - The GisFeatureDao to set

### setAdmDao

    public void setAdmDao(IAdmDao admDao)

  Parameters:
    `admDao` - the admDao to set

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

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

### getFiles

    protected File[] getFiles()

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

### setSolRSynchroniser

    public void setSolRSynchroniser(ISolRSynchroniser solRSynchroniser)

  Parameters:
    `solRSynchroniser` - the solRSynchroniser to set

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

### setZipCodeDao

    public void setZipCodeDao(IZipCodeDao zipCodeDao)

### setFullTextSearchEngine

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

### setIdGenerator

    public void setIdGenerator(IIdGenerator idGenerator)

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.