Java Code Examples for mil.nga.geopackage.core.contents.ContentsDao#queryForId()
The following examples show how to use
mil.nga.geopackage.core.contents.ContentsDao#queryForId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeoPackageImpl.java From geopackage-android with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public AttributesDao getAttributesDao(String tableName) { ContentsDao dao = getContentsDao(); Contents contents = null; try { contents = dao.queryForId(tableName); } catch (SQLException e) { throw new GeoPackageException("Failed to retrieve " + Contents.class.getSimpleName() + " for table name: " + tableName, e); } if (contents == null) { throw new GeoPackageException( "No Contents Table exists for table name: " + tableName); } return getAttributesDao(contents); }
Example 2
Source File: RelatedTablesCoreExtension.java From geopackage-core-java with MIT License | 6 votes |
/** * Set the contents in the user table * * @param table * user table */ public void setContents(UserTable<? extends UserColumn> table) { ContentsDao dao = geoPackage.getContentsDao(); Contents contents = null; try { contents = dao.queryForId(table.getTableName()); } catch (SQLException e) { throw new GeoPackageException( "Failed to retrieve " + Contents.class.getSimpleName() + " for table name: " + table.getTableName(), e); } if (contents == null) { throw new GeoPackageException( "No Contents Table exists for table name: " + table.getTableName()); } table.setContents(contents); }
Example 3
Source File: GeoPackageRepository.java From geopackage-mapcache-android with MIT License | 6 votes |
/** * Get table Contents object */ public Contents getTableContents(String gpName, String tableName) { GeoPackage geo = null; try{ geo = manager.open(gpName); if(geo != null) { ContentsDao contentsDao = geo.getContentsDao(); Contents contents = contentsDao.queryForId(tableName); return contents; } } catch (Exception e){ } finally { if(geo != null){ geo.close(); } } return null; }
Example 4
Source File: GeoPackageImpl.java From geopackage-java with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public AttributesDao getAttributesDao(String tableName) { ContentsDao dao = getContentsDao(); Contents contents = null; try { contents = dao.queryForId(tableName); } catch (SQLException e) { throw new GeoPackageException( "Failed to retrieve " + Contents.class.getSimpleName() + " for table name: " + tableName, e); } if (contents == null) { throw new GeoPackageException( "No Contents Table exists for table name: " + tableName); } return getAttributesDao(contents); }
Example 5
Source File: ContentsIdExtension.java From geopackage-core-java with MIT License | 5 votes |
/** * Get or create if needed the extension * * @return extensions object */ public Extensions getOrCreateExtension() { // Create table geoPackage.createContentsIdTable(); Extensions extension = getOrCreate(EXTENSION_NAME, null, null, EXTENSION_DEFINITION, ExtensionScopeType.READ_WRITE); ContentsDao contentsDao = geoPackage.getContentsDao(); try { if (contentsDao.queryForId(ContentsId.TABLE_NAME) == null) { Contents contents = new Contents(); contents.setTableName(ContentsId.TABLE_NAME); contents.setDataTypeString(Extensions.TABLE_NAME); contents.setIdentifier(ContentsId.TABLE_NAME); contentsDao.create(contents); } } catch (SQLException e) { throw new GeoPackageException( "Failed to create contents entry for contents id. GeoPackage: " + geoPackage.getName(), e); } return extension; }
Example 6
Source File: FeatureTableCoreIndex.java From geopackage-core-java with MIT License | 5 votes |
/** * Determine if the feature table is indexed * * @return true if indexed */ public boolean isIndexed() { boolean indexed = false; Extensions extension = getExtension(); if (extension != null) { ContentsDao contentsDao = geoPackage.getContentsDao(); try { Contents contents = contentsDao.queryForId(tableName); if (contents != null) { Date lastChange = contents.getLastChange(); TableIndexDao tableIndexDao = geoPackage.getTableIndexDao(); TableIndex tableIndex = tableIndexDao.queryForId(tableName); if (tableIndex != null) { Date lastIndexed = tableIndex.getLastIndexed(); indexed = lastIndexed != null && lastIndexed .getTime() >= lastChange.getTime(); } } } catch (SQLException e) { throw new GeoPackageException( "Failed to check if table is indexed, GeoPackage: " + geoPackage.getName() + ", Table Name: " + tableName, e); } } return indexed; }
Example 7
Source File: GeoPackageCoreImpl.java From geopackage-core-java with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public Contents getTableContents(String table) { ContentsDao contentDao = getContentsDao(); Contents contents = null; try { contents = contentDao.queryForId(table); } catch (SQLException e) { throw new GeoPackageException( "Failed to retrieve table contents: " + table, e); } return contents; }