|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
com.gisgraphy.domain.repository.GenericDao<T,Long>
com.gisgraphy.domain.repository.GenericGisDao<Adm>
com.gisgraphy.domain.repository.AdmDao
@Repository public class AdmDao
A data access object for Adm
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 | |
---|---|
AdmDao()
|
Method Summary | |
---|---|
long |
countByLevel(int level)
|
int |
deleteAllByLevel(int level)
|
Adm |
get(Long id)
Retrieve the Object whith the specified primary key |
Adm |
getAdm(String countryCode,
String adm1Code,
String adm2Code,
String adm3Code,
String adm4Code)
Retrieve the Adm of the highest level according to the AdmXcode. |
Adm |
getAdm1(String countryCode,
String adm1Code)
|
Adm |
getAdm2(String countryCode,
String adm1Code,
String adm2Code)
|
Adm |
getAdm3(String countryCode,
String adm1Code,
String adm2Code,
String adm3Code)
|
Adm |
getAdm4(String countryCode,
String adm1Code,
String adm2Code,
String adm3Code,
String adm4Code)
|
List<Adm> |
getAdmByCountryAndCodeAndLevel(String countryCode,
String admCode,
int level)
Returns The Adm with the specified code and the specified level for the specified country code. |
Adm |
getAdmOrFirstValidParentIfNotFound(String countryCode,
String adm1Code,
String adm2Code,
String adm3Code,
String adm4Code)
Return The Adm for the specified Code in the same way of IAdmDao.getAdm(String, String, String, String, String) or the first
valid parent if no Adm is found with the specified codes. |
List<Adm> |
getAllbyLevel(int level)
|
List<Adm> |
getDirties()
Returns inconsistant object (in most case object With featureid < 0) |
List<Adm> |
getUnused()
|
List<Long> |
listFeatureIdByLevel(int level)
List all the featureId of the Adms of a specified level |
Adm |
save(Adm adm)
Check that codes are consistent according the level (see Adm.isConsistentForLevel() and save it in the datastore |
Adm |
suggestMostAccurateAdm(String countryCode,
String adm1Code,
String adm2Code,
String adm3Code,
String adm4Code,
GisFeature gisfeature)
This method is used when ImporterConfig.isTryToDetectAdmIfNotFound() is true or when error
correction is needed. the algorithm will return an Adm according the
specified rules:
If an Adm with the specified code is found (see
IAdmDao.getAdm(String, String, String, String, String) ) : retrun it
If an Adm with the highest not null level is found for the specified
country (e.g : if adm1,2,3 are specified and adm4 is null and it exist an
adm with level 3 for the specified adm3Code then it will be return)
If no parent Adm is found (see
IAdmDao.getAdmOrFirstValidParentIfNotFound(String, String, String, String, String) :
return Adm with the highest not null level
If a parent Adm is found (see
IAdmDao.getAdmOrFirstValidParentIfNotFound(String, String, String, String, String) :
If the difference beetween the Adm and The parent Adm is <=2 : we
assume that it is an error with only one code and return the Adm with the
highest not null level
If the difference is >1 we assume that there is too much error and
return the nearest parent
If No Adm with the highest not null level is found for the specified
country
If a parent Adm is found (see
IAdmDao.getAdmOrFirstValidParentIfNotFound(String, String, String, String, String) :
return Adm with the highest not null level : return the Parent
If no parent is found : return null
|
Methods inherited from class com.gisgraphy.domain.repository.GenericGisDao |
---|
createGISTIndexForLocationColumn, deleteAll, deleteAll, getByFeatureId, getEager, getNearestAndDistanceFrom, getNearestAndDistanceFrom, getNearestAndDistanceFrom, getNearestAndDistanceFromGisFeature, getNearestAndDistanceFromGisFeature, listByFeatureIds, listByName, listFromText, listFromText, remove, setEventManager |
Methods inherited from class com.gisgraphy.domain.repository.GenericDao |
---|
count, exists, flushAndClear, 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, getEager, getNearestAndDistanceFrom, getNearestAndDistanceFrom, getNearestAndDistanceFromGisFeature, getNearestAndDistanceFromGisFeature, listByFeatureIds, listByName, listFromText |
Methods inherited from interface com.gisgraphy.domain.repository.IDao |
---|
count, deleteAll, deleteAll, exists, flushAndClear, getAll, getAllPaginate, getPersistenceClass, remove, setFlushMode |
Constructor Detail |
---|
public AdmDao()
Method Detail |
---|
public Adm get(Long id)
IDao
get
in interface IDao<Adm,Long>
get
in class GenericDao<Adm,Long>
id
- the primarey key
public Adm save(Adm adm)
Adm.isConsistentForLevel()
and save it in the datastore
save
in interface IDao<Adm,Long>
save
in class GenericGisDao<Adm>
adm
- The Adm to save
Adm.isConsistentForLevel()
public Adm getAdm1(String countryCode, String adm1Code)
getAdm1
in interface IAdmDao
countryCode
- The country code of the Adm to retrieveadm1Code
- The Adm1Code of the Adm to retrieve
IAdmDao.getAdm(String, String, String, String, String)
,
IAdmDao.getAdmByCountryAndCodeAndLevel(String, String, int)
public Adm getAdm2(String countryCode, String adm1Code, String adm2Code)
getAdm2
in interface IAdmDao
countryCode
- The country code of the Adm to retrieveadm1Code
- The Adm1Code of the Adm to retrieveadm2Code
- The Adm2Code of the Adm to retrieve NOTE : The
countryCode will be automaticaly converted in upperCase
IAdmDao.getAdm(String, String, String, String, String)
,
IAdmDao.getAdmByCountryAndCodeAndLevel(String, String, int)
public Adm getAdm3(String countryCode, String adm1Code, String adm2Code, String adm3Code)
getAdm3
in interface IAdmDao
countryCode
- The country code of the Adm to retrieveadm1Code
- The Adm1Code of the Adm to retrieveadm2Code
- The Adm2Code of the Adm to retrieveadm3Code
- The Adm3Code of the Adm to retrieve NOTE : The
countryCode will be automaticaly converted in upperCase
IAdmDao.getAdm(String, String, String, String, String)
,
IAdmDao.getAdmByCountryAndCodeAndLevel(String, String, int)
public Adm getAdm4(String countryCode, String adm1Code, String adm2Code, String adm3Code, String adm4Code)
getAdm4
in interface IAdmDao
countryCode
- The country code of the Adm to retrieveadm1Code
- The Adm1Code of the Adm to retrieveadm2Code
- The Adm2Code of the Adm to retrieveadm3Code
- The Adm3Code of the Adm to retrieveadm4Code
- The Adm4Code of the Adm to retrieve NOTE : The
countryCode will be automaticaly converted in upperCase
IAdmDao.getAdm(String, String, String, String, String)
public Adm getAdm(String countryCode, String adm1Code, String adm2Code, String adm3Code, String adm4Code)
IAdmDao
IAdmDao.getAdm1(String, String)
,
IAdmDao.getAdm2(String, String, String)
,
IAdmDao.getAdm3(String, String, String, String)
, and
IAdmDao.getAdm4(String, String, String, String, String)
. Use This
Method ONLY if you've got some AdmXcode and you don't know the Level.
you'll have better performance with the getAdmX() methods.
getAdm
in interface IAdmDao
countryCode
- The country code of the Adm to retrieveadm1Code
- The Adm1Code of the Adm to retrieveadm2Code
- The Adm2Code of the Adm to retrieveadm3Code
- The Adm3Code of the Adm to retrieveadm4Code
- The Adm4Code of the Adm to retrieve NOTE : The
countryCode will be automaticaly converted in upperCase
IAdmDao.getAdm1(String, String)
,
IAdmDao.getAdm2(String, String, String)
,
IAdmDao.getAdm3(String, String, String, String)
,
IAdmDao.getAdm4(String, String, String, String, String)
,
IAdmDao.getAdmByCountryAndCodeAndLevel(String, String, int)
,
Adm.getProcessedLevelFromCodes(String, String, String, String)
public List<Adm> getUnused()
getUnused
in interface IAdmDao
public List<Adm> getDirties()
IGisDao
getDirties
in interface IGisDao<Adm>
getDirties
in class GenericGisDao<Adm>
public List<Adm> getAllbyLevel(int level)
getAllbyLevel
in interface IAdmDao
level
- The level of the Adms to retrieve. The Level is not
checked (not necessary beetween 1 and 4)
public long countByLevel(int level)
countByLevel
in interface IAdmDao
level
- The level we want the Adm to count The Level is not
checked (not necessary beetween 1 and 4)
public List<Adm> getAdmByCountryAndCodeAndLevel(String countryCode, String admCode, int level)
IAdmDao
getAdmByCountryAndCodeAndLevel
in interface IAdmDao
countryCode
- The countryCode that the Adm must belongs toadmCode
- The code of the Adm for the specified levellevel
- The level of the Adm : The Level is not checked (not
necessary beetween 1 and 4)
public Adm getAdmOrFirstValidParentIfNotFound(String countryCode, String adm1Code, String adm2Code, String adm3Code, String adm4Code)
IAdmDao
IAdmDao.getAdm(String, String, String, String, String)
or the first
valid parent if no Adm is found with the specified codes.IAdmDao.suggestMostAccurateAdm(String, String, String, String, String, GisFeature)
getAdmOrFirstValidParentIfNotFound
in interface IAdmDao
countryCode
- The country code of the Adm to retrieveadm1Code
- The Adm1Code of the Adm to retrieveadm2Code
- The Adm2Code of the Adm to retrieveadm3Code
- The Adm3Code of the Adm to retrieveadm4Code
- The Adm4Code of the Adm to retrieve
IAdmDao.getAdm(String, String, String, String, String)
or the
first valid parent if no Adm is found with the specified codesIAdmDao.getAdmByCountryAndCodeAndLevel(String, String, int)
,
Adm.getProcessedLevelFromCodes(String, String, String, String)
public Adm suggestMostAccurateAdm(String countryCode, String adm1Code, String adm2Code, String adm3Code, String adm4Code, GisFeature gisfeature)
IAdmDao
ImporterConfig.isTryToDetectAdmIfNotFound()
is true or when error
correction is needed. the algorithm will return an Adm according the
specified rules:
IAdmDao.getAdm(String, String, String, String, String)
) : retrun itIAdmDao.getAdmOrFirstValidParentIfNotFound(String, String, String, String, String)
:
return Adm with the highest not null level IAdmDao.getAdmOrFirstValidParentIfNotFound(String, String, String, String, String)
:
IAdmDao.getAdmOrFirstValidParentIfNotFound(String, String, String, String, String)
:
return Adm with the highest not null level : return the Parent
suggestMostAccurateAdm
in interface IAdmDao
countryCode
- The country code of the Adm to retrieveadm1Code
- The Adm1Code of the Adm to retrieveadm2Code
- The Adm2Code of the Adm to retrieveadm3Code
- The Adm3Code of the Adm to retrieveadm4Code
- The Adm4Code of the Adm to retrievegisfeature
- The gisFeature is not really used in the algorithm, but it
can be useful to have it for logs or for specific
algorithm implementation.(It is only used for logs)
IAdmDao.getAdmOrFirstValidParentIfNotFound(String, String, String, String,
String)
public int deleteAllByLevel(int level)
deleteAllByLevel
in interface IAdmDao
level
- the level we want to delete Adm return the number of
deleted Admpublic List<Long> listFeatureIdByLevel(int level)
IAdmDao
listFeatureIdByLevel
in interface IAdmDao
level
- the level
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |