public static List < InvCatalogRef > findAllCatRefsInDatasetTree ( List < InvDataset > datasets , StringBuilder log , boolean onlyRelativeUrls ) { List < InvCatalogRef > catRefList = new ArrayList < InvCatalogRef > ( ) ; for ( InvDataset invds : datasets ) { InvDatasetImpl curDs = ( InvDatasetImpl ) invds ; if ( curDs instanceof InvDatasetScan ) continue ; if ( curDs instanceof InvCatalogRef ) { InvCatalogRef catRef = ( InvCatalogRef ) curDs ; String name = catRef . getName ( ) ; String href = catRef . getXlinkHref ( ) ; URI uri ; try { uri = new URI ( href ) ; } catch ( URISyntaxException e ) { log . append ( log . length ( ) > 0 ? "\n" : "" ) . append ( "***WARN - CatalogRef [" ) . append ( name ) . append ( "] with bad HREF [" ) . append ( href ) . append ( "] " ) ; continue ; } if ( onlyRelativeUrls && uri . isAbsolute ( ) ) continue ; catRefList . add ( catRef ) ; continue ; } if ( curDs . hasNestedDatasets ( ) ) catRefList . addAll ( findAllCatRefsInDatasetTree ( curDs . getDatasets ( ) , log , onlyRelativeUrls ) ) ; } return catRefList ; }
Find all catalogRef elements in the dataset tree formed by the given dataset list .