public int deleteCascade ( Contents contents ) throws SQLException { int count = 0 ; if ( contents != null ) { ContentsDataType dataType = contents . getDataType ( ) ; if ( dataType != null ) { switch ( dataType ) { case FEATURES : // Delete Geometry Columns GeometryColumnsDao geometryColumnsDao = getGeometryColumnsDao ( ) ; if ( geometryColumnsDao . isTableExists ( ) ) { GeometryColumns geometryColumns = contents . getGeometryColumns ( ) ; if ( geometryColumns != null ) { geometryColumnsDao . delete ( geometryColumns ) ; } } break ; case TILES : case GRIDDED_COVERAGE : // Delete Tile Matrix collection TileMatrixDao tileMatrixDao = getTileMatrixDao ( ) ; if ( tileMatrixDao . isTableExists ( ) ) { ForeignCollection < TileMatrix > tileMatrixCollection = contents . getTileMatrix ( ) ; if ( ! tileMatrixCollection . isEmpty ( ) ) { tileMatrixDao . delete ( tileMatrixCollection ) ; } } // Delete Tile Matrix Set TileMatrixSetDao tileMatrixSetDao = getTileMatrixSetDao ( ) ; if ( tileMatrixSetDao . isTableExists ( ) ) { TileMatrixSet tileMatrixSet = contents . getTileMatrixSet ( ) ; if ( tileMatrixSet != null ) { tileMatrixSetDao . delete ( tileMatrixSet ) ; } } break ; case ATTRIBUTES : dropTable ( contents . getTableName ( ) ) ; break ; } } else { dropTable ( contents . getTableName ( ) ) ; } count = delete ( contents ) ; } return count ; }
Delete the Contents cascading