@ Override protected void validate ( List < TableInfo > tableInfos ) { try { if ( ! checkForDBExistence ( ) ) { throw new SchemaGenerationException ( "Database " + databaseName + " not exist" ) ; } for ( TableInfo tableInfo : tableInfos ) { Map < String , MapReduce > views = new HashMap < String , MapReduce > ( ) ; String id = CouchDBConstants . DESIGN + tableInfo . getTableName ( ) ; CouchDBDesignDocument designDocument = getDesignDocument ( id ) ; designDocument . setLanguage ( CouchDBConstants . LANGUAGE ) ; views = designDocument . getViews ( ) ; if ( views == null ) { logger . warn ( "No view exist for table " + tableInfo . getTableName ( ) + "so any query will not produce any result" ) ; return ; } for ( IndexInfo indexInfo : tableInfo . getColumnsToBeIndexed ( ) ) { if ( views . get ( indexInfo . getColumnName ( ) ) == null ) { logger . warn ( "No view exist for column " + indexInfo . getColumnName ( ) + " of table " + tableInfo . getTableName ( ) + "so any query on column " + indexInfo . getColumnName ( ) + "will not produce any result" ) ; } } // for id column. if ( views . get ( tableInfo . getIdColumnName ( ) ) == null ) { logger . warn ( "No view exist for id column " + tableInfo . getIdColumnName ( ) + " of table " + tableInfo . getTableName ( ) + "so any query on id column " + tableInfo . getIdColumnName ( ) + "will not produce any result" ) ; } // for select all. if ( views . get ( "all" ) == null ) { logger . warn ( "No view exist for select all for table " + tableInfo . getTableName ( ) + "so select all query will not produce any result" ) ; } } } catch ( Exception e ) { throw new SchemaGenerationException ( "Database " + databaseName + " not exist" ) ; } }
Validate design document .