/** * Constructor * * @param name * relation name * @param dataType * contents data type */ private RelationType(String name, ContentsDataType dataType) { this(name, dataType.getName()); }
/** * Get the data type * * @return data type */ public ContentsDataType getDataType() { return ContentsDataType.fromName(dataType); }
/** * Get the Data Type from the name * * @param name * name * @return contents data type */ public static ContentsDataType fromName(String name) { ContentsDataType dataType = null; if (name != null) { for (ContentsDataType type : ContentsDataType.values()) { if (name.equals(type.getName())) { dataType = type; break; } } } return dataType; }
/** * Set the data type * * @param dataType * data type */ public void setDataType(ContentsDataType dataType) { this.dataType = dataType.getName(); }
ContentsDataType dataType = ContentsDataType.fromName(tableType); if (dataType != null) { switch (dataType) {
/** * {@inheritDoc} */ @Override public List<String> getTables(ContentsDataType type) { return getTables(type.getName()); }
/** * {@inheritDoc} */ @Override public boolean isTableType(ContentsDataType type, String table) { return isTableType(type.getName(), table); }
/** * Get table names by data type * * @param dataType * data type * @return table names * @throws SQLException * upon query error * @since 1.2.1 */ public List<String> getTables(ContentsDataType dataType) throws SQLException { return getTables(dataType.getName()); }
/** * Get contents by data type * * @param dataType * data type * @return list of contents * @throws SQLException * upon query error * @since 1.2.1 */ public List<Contents> getContents(ContentsDataType dataType) throws SQLException { return getContents(dataType.getName()); }
public void setContents(Contents contents) { this.contents = contents; if (contents != null) { // Verify the Contents have a tiles data type (Spec Requirement 33) ContentsDataType dataType = contents.getDataType(); if (dataType == null || (dataType != ContentsDataType.TILES && dataType != ContentsDataType.GRIDDED_COVERAGE)) { throw new GeoPackageException("The " + Contents.class.getSimpleName() + " of a " + TileMatrixSet.class.getSimpleName() + " must have a data type of " + ContentsDataType.TILES.getName() + " or " + ContentsDataType.GRIDDED_COVERAGE.getName()); } tableName = contents.getId(); } else { tableName = null; } }
public void setContents(Contents contents) { this.contents = contents; if (contents != null) { // Verify the Contents have a tiles data type (Spec Requirement 42) ContentsDataType dataType = contents.getDataType(); if (dataType == null || (dataType != ContentsDataType.TILES && dataType != ContentsDataType.GRIDDED_COVERAGE)) { throw new GeoPackageException("The " + Contents.class.getSimpleName() + " of a " + TileMatrix.class.getSimpleName() + " must have a data type of " + ContentsDataType.TILES.getName() + " or " + ContentsDataType.GRIDDED_COVERAGE.getName()); } tableName = contents.getId(); } else { tableName = null; } }
/** * Set the contents * * @param contents * contents */ public void setContents(Contents contents) { this.contents = contents; if (contents != null) { // Verify the Contents have an attributes data type ContentsDataType dataType = contents.getDataType(); if (dataType == null || dataType != ContentsDataType.ATTRIBUTES) { throw new GeoPackageException("The " + Contents.class.getSimpleName() + " of a " + AttributesTable.class.getSimpleName() + " must have a data type of " + ContentsDataType.ATTRIBUTES.getName()); } } }
public void setContents(Contents contents) { this.contents = contents; if (contents != null) { // Verify the Contents have a features data type (Spec Requirement // 23) ContentsDataType dataType = contents.getDataType(); if (dataType == null || dataType != ContentsDataType.FEATURES) { throw new GeoPackageException("The " + Contents.class.getSimpleName() + " of a " + GeometryColumnsSfSql.class.getSimpleName() + " must have a data type of " + ContentsDataType.FEATURES.getName()); } fTableName = contents.getId(); } }
public void setContents(Contents contents) { this.contents = contents; if (contents != null) { // Verify the Contents have a features data type (Spec Requirement // 23) ContentsDataType dataType = contents.getDataType(); if (dataType == null || dataType != ContentsDataType.FEATURES) { throw new GeoPackageException("The " + Contents.class.getSimpleName() + " of a " + GeometryColumnsSqlMm.class.getSimpleName() + " must have a data type of " + ContentsDataType.FEATURES.getName()); } tableName = contents.getId(); } }
public void setContents(Contents contents) { this.contents = contents; if (contents != null) { // Verify the Contents have a features data type (Spec Requirement // 23) ContentsDataType dataType = contents.getDataType(); if (dataType == null || dataType != ContentsDataType.FEATURES) { throw new GeoPackageException("The " + Contents.class.getSimpleName() + " of a " + GeometryColumns.class.getSimpleName() + " must have a data type of " + ContentsDataType.FEATURES.getName()); } tableName = contents.getId(); } else { tableName = null; } }
/** * Verify the required tile tables exist * * @param dataType * data type * @throws SQLException * upon tiles verification error */ private void verifyTiles(ContentsDataType dataType) throws SQLException { // Tiles require Tile Matrix Set table (Spec Requirement 37) TileMatrixSetDao tileMatrixSetDao = getTileMatrixSetDao(); if (!tileMatrixSetDao.isTableExists()) { throw new GeoPackageException("A data type of " + dataType.getName() + " requires the " + TileMatrixSet.class.getSimpleName() + " table to first be created using the GeoPackage."); } // Tiles require Tile Matrix table (Spec Requirement 41) TileMatrixDao tileMatrixDao = getTileMatrixDao(); if (!tileMatrixDao.isTableExists()) { throw new GeoPackageException("A data type of " + dataType.getName() + " requires the " + TileMatrix.class.getSimpleName() + " table to first be created using the GeoPackage."); } }
/** * Validate contents * * @param mediaTable media table * @param contents contents */ private static void validateContents(MediaTable mediaTable, Contents contents) { TestCase.assertNotNull(contents); TestCase.assertNotNull(contents.getDataType()); TestCase.assertEquals(MediaTable.RELATION_TYPE.getDataType(), contents .getDataType().getName()); TestCase.assertEquals(MediaTable.RELATION_TYPE.getDataType(), contents.getDataTypeString()); TestCase.assertEquals(mediaTable.getTableName(), contents.getTableName()); TestCase.assertNotNull(contents.getLastChange()); }
/** * Validate contents * * @param simpleAttributesTable simple attributes table * @param contents contents */ private static void validateContents( SimpleAttributesTable simpleAttributesTable, Contents contents) { TestCase.assertNotNull(contents); TestCase.assertNotNull(contents.getDataType()); TestCase.assertEquals( SimpleAttributesTable.RELATION_TYPE.getDataType(), contents .getDataType().getName()); TestCase.assertEquals( SimpleAttributesTable.RELATION_TYPE.getDataType(), contents.getDataTypeString()); TestCase.assertEquals(simpleAttributesTable.getTableName(), contents.getTableName()); TestCase.assertNotNull(contents.getLastChange()); }
throw new GeoPackageException( "A data type of " + dataType.getName() + " requires the " + GeometryColumns.class.getSimpleName()
contents.getDataType().getName()); PreparedQuery<Contents> query = qb.prepare(); List<Contents> queryResults = dao.query(query); DeleteBuilder<Contents, String> db = dao.deleteBuilder(); db.where().eq(Contents.COLUMN_DATA_TYPE, contents.getDataType().getName()); PreparedDelete<Contents> deleteQuery = db.prepare(); deleted = dao.delete(deleteQuery);