Package mil.nga.geopackage.srs
Class SpatialReferenceSystemDao
- java.lang.Object
-
- com.j256.ormlite.dao.BaseDaoImpl<T,ID>
-
- mil.nga.geopackage.db.GeoPackageDao<SpatialReferenceSystem,Long>
-
- mil.nga.geopackage.srs.SpatialReferenceSystemDao
-
- All Implemented Interfaces:
CloseableIterable<SpatialReferenceSystem>,Dao<SpatialReferenceSystem,Long>,Iterable<SpatialReferenceSystem>
public class SpatialReferenceSystemDao extends GeoPackageDao<SpatialReferenceSystem,Long>
Spatial Reference System Data Access Object- Author:
- osbornb
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.j256.ormlite.dao.Dao
Dao.CreateOrUpdateStatus, Dao.DaoObserver
-
-
Field Summary
-
Fields inherited from class mil.nga.geopackage.db.GeoPackageDao
db
-
Fields inherited from class com.j256.ormlite.dao.BaseDaoImpl
connectionSource, constructor, databaseType, dataClass, lastIterator, objectFactory, statementExecutor, tableConfig, tableInfo
-
-
Constructor Summary
Constructors Constructor Description SpatialReferenceSystemDao(ConnectionSource connectionSource, Class<SpatialReferenceSystem> dataClass)Constructor, required by ORMLite
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SpatialReferenceSystemDaocreate(GeoPackageCoreConnection db)Create the DAOstatic SpatialReferenceSystemDaocreate(GeoPackageCore geoPackage)Create the DAOintcreate(SpatialReferenceSystem srs)SpatialReferenceSystemcreateIfNotExists(SpatialReferenceSystem data)Dao.CreateOrUpdateStatuscreateOrUpdate(SpatialReferenceSystem data)SpatialReferenceSystemcreateUndefinedCartesian()Creates the required Undefined Cartesian Spatial Reference System (spec Requirement 11)SpatialReferenceSystemcreateUndefinedGeographic()Creates the required Undefined Geographic Spatial Reference System (spec Requirement 11)SpatialReferenceSystemcreateWebMercator()Creates the Web Mercator Spatial Reference System if it does not already existSpatialReferenceSystemcreateWgs84()Creates the required EPSG WGS84 Spatial Reference System (spec Requirement 11)SpatialReferenceSystemcreateWgs84Geographical3D()Creates the required EPSG WGS84 Geographical 3D Spatial Reference SystemintdeleteByIdCascade(Long id)Delete a Spatial Reference System by id, cascadingintdeleteCascade(PreparedQuery<SpatialReferenceSystem> preparedDelete)Delete the Spatial Reference Systems matching the prepared query, cascadingintdeleteCascade(Collection<SpatialReferenceSystem> srsCollection)Delete the collection of Spatial Reference Systems, cascadingintdeleteCascade(SpatialReferenceSystem srs)Delete the Spatial Reference System, cascadingintdeleteIdsCascade(Collection<Long> idCollection)Delete the Spatial Reference Systems with the provided ids, cascadingStringgetDefinition_12_063(long srsId)Query to get the definition 12 063 value if the extension existsDoublegetEpoch(long srsId)Query to get the epoch value if the extension existsSpatialReferenceSystemgetOrCreate(Projection projection)Get or Create the Spatial Reference System from the projectionSpatialReferenceSystemgetOrCreateCode(String organization, long coordsysId)Get or Create the Spatial Reference System for the provided organization and idSpatialReferenceSystemgetOrCreateFromEpsg(long epsg)Get or Create the Spatial Reference System for the provided epsgbooleanhasDefinition_12_063()Determine if the SRS table contains the extension definition 12 063 column for CRS WKTbooleanhasEpoch()Determine if the SRS table contains the extension epoch column for CRS WKTList<SpatialReferenceSystem>query(PreparedQuery<SpatialReferenceSystem> preparedQuery)SpatialReferenceSystemquery(Projection projection)Query for the projectionList<SpatialReferenceSystem>queryForAll()List<SpatialReferenceSystem>queryForEq(String fieldName, Object value)List<SpatialReferenceSystem>queryForFieldValues(Map<String,Object> fieldValues)List<SpatialReferenceSystem>queryForFieldValuesArgs(Map<String,Object> fieldValues)SpatialReferenceSystemqueryForFirst(PreparedQuery<SpatialReferenceSystem> preparedQuery)SpatialReferenceSystemqueryForId(Long id)List<SpatialReferenceSystem>queryForMatching(SpatialReferenceSystem matchObj)List<SpatialReferenceSystem>queryForMatchingArgs(SpatialReferenceSystem matchObj)SpatialReferenceSystemqueryForOrganizationCoordsysId(String organization, long organizationCoordsysId)Query for the organization coordsys idSpatialReferenceSystemqueryForSameId(SpatialReferenceSystem data)voidsetCrsWktExtension(CrsWktExtension crsWktExtension)Set the CRS WKT ExtensionvoidsetExtension(Collection<SpatialReferenceSystem> srsList)Query and set the values in the srs objects if the extension existsvoidsetExtension(SpatialReferenceSystem srs)Query and set the values in the srs object if the extension existsstatic voidsetExtensionValues(GeoPackageCoreConnection db, SpatialReferenceSystem srs)Set extension values into the spatial reference systemstatic voidsetExtensionValues(GeoPackageCore geoPackage, SpatialReferenceSystem srs)Set extension values into the spatial reference systemintupdate(SpatialReferenceSystem data)voidupdateDefinition_12_063(long srsId, String definition)Update the definition 12 063 in the database if the extension existsvoidupdateEpoch(long srsId, Double epoch)Update the epoch in the database if the extension existsvoidupdateExtension(SpatialReferenceSystem srs)Update the extension if exists-
Methods inherited from class mil.nga.geopackage.db.GeoPackageDao
createDao, createDao, createDao, dropTable, getDatabase, isTable, isTableExists, isTableOrView, isView, setDatabase, tableExists, tableOrViewExists, verifyExists, viewExists
-
Methods inherited from class com.j256.ormlite.dao.BaseDaoImpl
assignEmptyForeignCollection, callBatchTasks, checkForInitialized, clearAllInternalObjectCaches, clearObjectCache, closeableIterator, closeLastIterator, commit, countOf, countOf, create, createObjectInstance, delete, delete, delete, deleteBuilder, deleteById, deleteIds, endThreadConnection, executeRaw, executeRawNoArgs, extractId, findForeignFieldType, getConnectionSource, getDataClass, getEmptyForeignCollection, getObjectCache, getRawRowMapper, getSelectStarRowMapper, getTableConfig, getTableInfo, getTableName, getWrappedIterable, getWrappedIterable, idExists, initialize, isAutoCommit, isUpdatable, iterator, iterator, iterator, iterator, mapSelectStarRow, notifyChanges, objectsEqual, objectToString, queryBuilder, queryForFirst, queryRaw, queryRaw, queryRaw, queryRaw, queryRaw, queryRawValue, refresh, registerObserver, rollBack, setAutoCommit, setConnectionSource, setObjectCache, setObjectCache, setObjectFactory, setTableConfig, startThreadConnection, unregisterObserver, update, updateBuilder, updateId, updateRaw
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
SpatialReferenceSystemDao
public SpatialReferenceSystemDao(ConnectionSource connectionSource, Class<SpatialReferenceSystem> dataClass) throws SQLException
Constructor, required by ORMLite- Parameters:
connectionSource- connection sourcedataClass- data class- Throws:
SQLException- upon creation failure
-
-
Method Detail
-
create
public static SpatialReferenceSystemDao create(GeoPackageCore geoPackage)
Create the DAO- Parameters:
geoPackage- GeoPackage- Returns:
- dao
- Since:
- 4.0.0
-
create
public static SpatialReferenceSystemDao create(GeoPackageCoreConnection db)
Create the DAO- Parameters:
db- database connection- Returns:
- dao
- Since:
- 4.0.0
-
setExtensionValues
public static void setExtensionValues(GeoPackageCore geoPackage, SpatialReferenceSystem srs)
Set extension values into the spatial reference system- Parameters:
geoPackage- GeoPackagesrs- spatial reference system
-
setExtensionValues
public static void setExtensionValues(GeoPackageCoreConnection db, SpatialReferenceSystem srs)
Set extension values into the spatial reference system- Parameters:
db- database connectionsrs- spatial reference system
-
setCrsWktExtension
public void setCrsWktExtension(CrsWktExtension crsWktExtension)
Set the CRS WKT Extension- Parameters:
crsWktExtension- CRS WKT Extension- Since:
- 1.1.8
-
hasDefinition_12_063
public boolean hasDefinition_12_063()
Determine if the SRS table contains the extension definition 12 063 column for CRS WKT- Returns:
- true if has extension
- Since:
- 1.2.1
-
hasEpoch
public boolean hasEpoch()
Determine if the SRS table contains the extension epoch column for CRS WKT- Returns:
- true if has extension
- Since:
- 6.6.0
-
createWgs84
public SpatialReferenceSystem createWgs84() throws SQLException
Creates the required EPSG WGS84 Spatial Reference System (spec Requirement 11)- Returns:
- spatial reference system
- Throws:
SQLException- upon creation failure
-
createUndefinedCartesian
public SpatialReferenceSystem createUndefinedCartesian() throws SQLException
Creates the required Undefined Cartesian Spatial Reference System (spec Requirement 11)- Returns:
- spatial reference system
- Throws:
SQLException- upon creation failure
-
createUndefinedGeographic
public SpatialReferenceSystem createUndefinedGeographic() throws SQLException
Creates the required Undefined Geographic Spatial Reference System (spec Requirement 11)- Returns:
- spatial reference system
- Throws:
SQLException- upon creation failure
-
createWebMercator
public SpatialReferenceSystem createWebMercator() throws SQLException
Creates the Web Mercator Spatial Reference System if it does not already exist- Returns:
- spatial reference system
- Throws:
SQLException- upon creation failure
-
createWgs84Geographical3D
public SpatialReferenceSystem createWgs84Geographical3D() throws SQLException
Creates the required EPSG WGS84 Geographical 3D Spatial Reference System- Returns:
- spatial reference system
- Throws:
SQLException- upon creation failure- Since:
- 1.2.1
-
getDefinition_12_063
public String getDefinition_12_063(long srsId)
Query to get the definition 12 063 value if the extension exists- Parameters:
srsId- srs id- Returns:
- definition or null
- Since:
- 1.2.1
-
getEpoch
public Double getEpoch(long srsId)
Query to get the epoch value if the extension exists- Parameters:
srsId- srs id- Returns:
- epoch or null
- Since:
- 6.6.0
-
setExtension
public void setExtension(SpatialReferenceSystem srs)
Query and set the values in the srs object if the extension exists- Parameters:
srs- spatial reference system- Since:
- 6.6.0
-
setExtension
public void setExtension(Collection<SpatialReferenceSystem> srsList)
Query and set the values in the srs objects if the extension exists- Parameters:
srsList- srs list- Since:
- 6.6.0
-
updateDefinition_12_063
public void updateDefinition_12_063(long srsId, String definition)Update the definition 12 063 in the database if the extension exists- Parameters:
srsId- srs iddefinition- definition- Since:
- 1.2.1
-
updateEpoch
public void updateEpoch(long srsId, Double epoch)Update the epoch in the database if the extension exists- Parameters:
srsId- srs idepoch- epoch- Since:
- 6.6.0
-
updateExtension
public void updateExtension(SpatialReferenceSystem srs)
Update the extension if exists- Parameters:
srs- srs- Since:
- 6.6.0
-
queryForId
public SpatialReferenceSystem queryForId(Long id) throws SQLException
- Specified by:
queryForIdin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForIdin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
queryForFirst
public SpatialReferenceSystem queryForFirst(PreparedQuery<SpatialReferenceSystem> preparedQuery) throws SQLException
- Specified by:
queryForFirstin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForFirstin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
queryForAll
public List<SpatialReferenceSystem> queryForAll() throws SQLException
- Specified by:
queryForAllin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForAllin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
queryForEq
public List<SpatialReferenceSystem> queryForEq(String fieldName, Object value) throws SQLException
- Specified by:
queryForEqin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForEqin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
query
public List<SpatialReferenceSystem> query(PreparedQuery<SpatialReferenceSystem> preparedQuery) throws SQLException
- Specified by:
queryin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
queryForMatching
public List<SpatialReferenceSystem> queryForMatching(SpatialReferenceSystem matchObj) throws SQLException
- Specified by:
queryForMatchingin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForMatchingin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
queryForMatchingArgs
public List<SpatialReferenceSystem> queryForMatchingArgs(SpatialReferenceSystem matchObj) throws SQLException
- Specified by:
queryForMatchingArgsin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForMatchingArgsin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
queryForFieldValues
public List<SpatialReferenceSystem> queryForFieldValues(Map<String,Object> fieldValues) throws SQLException
- Specified by:
queryForFieldValuesin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForFieldValuesin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
queryForFieldValuesArgs
public List<SpatialReferenceSystem> queryForFieldValuesArgs(Map<String,Object> fieldValues) throws SQLException
- Specified by:
queryForFieldValuesArgsin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForFieldValuesArgsin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
queryForSameId
public SpatialReferenceSystem queryForSameId(SpatialReferenceSystem data) throws SQLException
- Specified by:
queryForSameIdin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
queryForSameIdin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
create
public int create(SpatialReferenceSystem srs) throws SQLException
- Specified by:
createin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
createin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
createIfNotExists
public SpatialReferenceSystem createIfNotExists(SpatialReferenceSystem data) throws SQLException
- Specified by:
createIfNotExistsin interfaceDao<SpatialReferenceSystem,Long>- Overrides:
createIfNotExistsin classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
createOrUpdate
public Dao.CreateOrUpdateStatus createOrUpdate(SpatialReferenceSystem data) throws SQLException
- Specified by:
createOrUpdatein interfaceDao<SpatialReferenceSystem,Long>- Overrides:
createOrUpdatein classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
update
public int update(SpatialReferenceSystem data) throws SQLException
- Specified by:
updatein interfaceDao<SpatialReferenceSystem,Long>- Overrides:
updatein classBaseDaoImpl<SpatialReferenceSystem,Long>- Throws:
SQLException
-
getOrCreateFromEpsg
public SpatialReferenceSystem getOrCreateFromEpsg(long epsg) throws SQLException
Get or Create the Spatial Reference System for the provided epsg- Parameters:
epsg- epsg- Returns:
- srs
- Throws:
SQLException- upon query or creation failure- Since:
- 1.2.0
-
getOrCreateCode
public SpatialReferenceSystem getOrCreateCode(String organization, long coordsysId) throws SQLException
Get or Create the Spatial Reference System for the provided organization and id- Parameters:
organization- organizationcoordsysId- coordsys id- Returns:
- srs
- Throws:
SQLException- upon query or creation failure- Since:
- 1.3.0
-
getOrCreate
public SpatialReferenceSystem getOrCreate(Projection projection) throws SQLException
Get or Create the Spatial Reference System from the projection- Parameters:
projection- projection- Returns:
- srs
- Throws:
SQLException- upon query or creation failure- Since:
- 5.0.0
-
queryForOrganizationCoordsysId
public SpatialReferenceSystem queryForOrganizationCoordsysId(String organization, long organizationCoordsysId) throws SQLException
Query for the organization coordsys id- Parameters:
organization- organizationorganizationCoordsysId- organization coordsys id- Returns:
- srs
- Throws:
SQLException- upon query failure- Since:
- 1.3.0
-
query
public SpatialReferenceSystem query(Projection projection) throws SQLException
Query for the projection- Parameters:
projection- projection- Returns:
- srs
- Throws:
SQLException- upon query failure- Since:
- 5.0.0
-
deleteCascade
public int deleteCascade(SpatialReferenceSystem srs) throws SQLException
Delete the Spatial Reference System, cascading- Parameters:
srs- spatial reference system- Returns:
- deleted count
- Throws:
SQLException- upon deletion failure
-
deleteCascade
public int deleteCascade(Collection<SpatialReferenceSystem> srsCollection) throws SQLException
Delete the collection of Spatial Reference Systems, cascading- Parameters:
srsCollection- spatial reference system collection- Returns:
- deleted count
- Throws:
SQLException- upon deletion failure
-
deleteCascade
public int deleteCascade(PreparedQuery<SpatialReferenceSystem> preparedDelete) throws SQLException
Delete the Spatial Reference Systems matching the prepared query, cascading- Parameters:
preparedDelete- prepared delete query- Returns:
- deleted count
- Throws:
SQLException- upon deletion failure
-
deleteByIdCascade
public int deleteByIdCascade(Long id) throws SQLException
Delete a Spatial Reference System by id, cascading- Parameters:
id- id- Returns:
- deleted count
- Throws:
SQLException- upon deletion failure
-
deleteIdsCascade
public int deleteIdsCascade(Collection<Long> idCollection) throws SQLException
Delete the Spatial Reference Systems with the provided ids, cascading- Parameters:
idCollection- id collection- Returns:
- deleted count
- Throws:
SQLException- upon deletion failure
-
-