public List < String > getMissing ( String type ) { List < String > missing = new ArrayList <> ( ) ; ContentsDao contentsDao = geoPackage . getContentsDao ( ) ; GenericRawResults < String [ ] > results = null ; try { StringBuilder query = new StringBuilder ( ) ; query . append ( "SELECT " ) ; query . append ( Contents . COLUMN_TABLE_NAME ) ; query . append ( " FROM " ) ; query . append ( Contents . TABLE_NAME ) ; StringBuilder where = new StringBuilder ( ) ; String [ ] queryArgs ; if ( type != null && ! type . isEmpty ( ) ) { where . append ( Contents . COLUMN_DATA_TYPE ) ; where . append ( " = ?" ) ; queryArgs = new String [ ] { type } ; } else { queryArgs = new String [ ] { } ; type = null ; } if ( contentsIdDao . isTableExists ( ) ) { if ( where . length ( ) > 0 ) { where . append ( " AND " ) ; } where . append ( Contents . COLUMN_TABLE_NAME ) ; where . append ( " NOT IN (SELECT " ) ; where . append ( ContentsId . COLUMN_TABLE_NAME ) ; where . append ( " FROM " ) ; where . append ( ContentsId . TABLE_NAME ) ; where . append ( ")" ) ; } if ( where . length ( ) > 0 ) { query . append ( " WHERE " ) . append ( where ) ; } results = contentsDao . queryRaw ( query . toString ( ) , queryArgs ) ; for ( String [ ] resultRow : results ) { missing . add ( resultRow [ 0 ] ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to query for missing contents ids. GeoPackage: " + geoPackage . getName ( ) + ", Type: " + type , e ) ; } finally { if ( results != null ) { try { results . close ( ) ; } catch ( IOException e ) { logger . log ( Level . WARNING , "Failed to close generic raw results from missing contents ids query. type: " + type , e ) ; } } } return missing ; }
Get contents by data type without contents ids