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 SpatialReferenceSystemDao
create(GeoPackageCoreConnection db)
Create the DAOstatic SpatialReferenceSystemDao
create(GeoPackageCore geoPackage)
Create the DAOint
create(SpatialReferenceSystem srs)
SpatialReferenceSystem
createIfNotExists(SpatialReferenceSystem data)
Dao.CreateOrUpdateStatus
createOrUpdate(SpatialReferenceSystem data)
SpatialReferenceSystem
createUndefinedCartesian()
Creates the required Undefined Cartesian Spatial Reference System (spec Requirement 11)SpatialReferenceSystem
createUndefinedGeographic()
Creates the required Undefined Geographic Spatial Reference System (spec Requirement 11)SpatialReferenceSystem
createWebMercator()
Creates the Web Mercator Spatial Reference System if it does not already existSpatialReferenceSystem
createWgs84()
Creates the required EPSG WGS84 Spatial Reference System (spec Requirement 11)SpatialReferenceSystem
createWgs84Geographical3D()
Creates the required EPSG WGS84 Geographical 3D Spatial Reference Systemint
deleteByIdCascade(Long id)
Delete a Spatial Reference System by id, cascadingint
deleteCascade(PreparedQuery<SpatialReferenceSystem> preparedDelete)
Delete the Spatial Reference Systems matching the prepared query, cascadingint
deleteCascade(Collection<SpatialReferenceSystem> srsCollection)
Delete the collection of Spatial Reference Systems, cascadingint
deleteCascade(SpatialReferenceSystem srs)
Delete the Spatial Reference System, cascadingint
deleteIdsCascade(Collection<Long> idCollection)
Delete the Spatial Reference Systems with the provided ids, cascadingString
getDefinition_12_063(long srsId)
Query to get the definition 12 063 value if the extension existsDouble
getEpoch(long srsId)
Query to get the epoch value if the extension existsSpatialReferenceSystem
getOrCreate(Projection projection)
Get or Create the Spatial Reference System from the projectionSpatialReferenceSystem
getOrCreateCode(String organization, long coordsysId)
Get or Create the Spatial Reference System for the provided organization and idSpatialReferenceSystem
getOrCreateFromEpsg(long epsg)
Get or Create the Spatial Reference System for the provided epsgboolean
hasDefinition_12_063()
Determine if the SRS table contains the extension definition 12 063 column for CRS WKTboolean
hasEpoch()
Determine if the SRS table contains the extension epoch column for CRS WKTList<SpatialReferenceSystem>
query(PreparedQuery<SpatialReferenceSystem> preparedQuery)
SpatialReferenceSystem
query(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)
SpatialReferenceSystem
queryForFirst(PreparedQuery<SpatialReferenceSystem> preparedQuery)
SpatialReferenceSystem
queryForId(Long id)
List<SpatialReferenceSystem>
queryForMatching(SpatialReferenceSystem matchObj)
List<SpatialReferenceSystem>
queryForMatchingArgs(SpatialReferenceSystem matchObj)
SpatialReferenceSystem
queryForOrganizationCoordsysId(String organization, long organizationCoordsysId)
Query for the organization coordsys idSpatialReferenceSystem
queryForSameId(SpatialReferenceSystem data)
void
setCrsWktExtension(CrsWktExtension crsWktExtension)
Set the CRS WKT Extensionvoid
setExtension(Collection<SpatialReferenceSystem> srsList)
Query and set the values in the srs objects if the extension existsvoid
setExtension(SpatialReferenceSystem srs)
Query and set the values in the srs object if the extension existsstatic void
setExtensionValues(GeoPackageCoreConnection db, SpatialReferenceSystem srs)
Set extension values into the spatial reference systemstatic void
setExtensionValues(GeoPackageCore geoPackage, SpatialReferenceSystem srs)
Set extension values into the spatial reference systemint
update(SpatialReferenceSystem data)
void
updateDefinition_12_063(long srsId, String definition)
Update the definition 12 063 in the database if the extension existsvoid
updateEpoch(long srsId, Double epoch)
Update the epoch in the database if the extension existsvoid
updateExtension(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:
queryForId
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForId
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
queryForFirst
public SpatialReferenceSystem queryForFirst(PreparedQuery<SpatialReferenceSystem> preparedQuery) throws SQLException
- Specified by:
queryForFirst
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForFirst
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
queryForAll
public List<SpatialReferenceSystem> queryForAll() throws SQLException
- Specified by:
queryForAll
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForAll
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
queryForEq
public List<SpatialReferenceSystem> queryForEq(String fieldName, Object value) throws SQLException
- Specified by:
queryForEq
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForEq
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
query
public List<SpatialReferenceSystem> query(PreparedQuery<SpatialReferenceSystem> preparedQuery) throws SQLException
- Specified by:
query
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
query
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
queryForMatching
public List<SpatialReferenceSystem> queryForMatching(SpatialReferenceSystem matchObj) throws SQLException
- Specified by:
queryForMatching
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForMatching
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
queryForMatchingArgs
public List<SpatialReferenceSystem> queryForMatchingArgs(SpatialReferenceSystem matchObj) throws SQLException
- Specified by:
queryForMatchingArgs
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForMatchingArgs
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
queryForFieldValues
public List<SpatialReferenceSystem> queryForFieldValues(Map<String,Object> fieldValues) throws SQLException
- Specified by:
queryForFieldValues
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForFieldValues
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
queryForFieldValuesArgs
public List<SpatialReferenceSystem> queryForFieldValuesArgs(Map<String,Object> fieldValues) throws SQLException
- Specified by:
queryForFieldValuesArgs
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForFieldValuesArgs
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
queryForSameId
public SpatialReferenceSystem queryForSameId(SpatialReferenceSystem data) throws SQLException
- Specified by:
queryForSameId
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
queryForSameId
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
create
public int create(SpatialReferenceSystem srs) throws SQLException
- Specified by:
create
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
create
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
createIfNotExists
public SpatialReferenceSystem createIfNotExists(SpatialReferenceSystem data) throws SQLException
- Specified by:
createIfNotExists
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
createIfNotExists
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
createOrUpdate
public Dao.CreateOrUpdateStatus createOrUpdate(SpatialReferenceSystem data) throws SQLException
- Specified by:
createOrUpdate
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
createOrUpdate
in classBaseDaoImpl<SpatialReferenceSystem,Long>
- Throws:
SQLException
-
update
public int update(SpatialReferenceSystem data) throws SQLException
- Specified by:
update
in interfaceDao<SpatialReferenceSystem,Long>
- Overrides:
update
in 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
-
-