public void populate ( ) { PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver ( ) ; try { Resource [ ] bootstrap3Themes = resolver . getResources ( LOCAL_CSS_BOOTSTRAP_3_THEME_LOCATION ) ; Resource [ ] bootstrap4Themes = resolver . getResources ( LOCAL_CSS_BOOTSTRAP_4_THEME_LOCATION ) ; // filter out themes already stored in the database List < Resource > newThemes = Arrays . stream ( bootstrap3Themes ) . filter ( theme -> dataService . getRepository ( STYLE_SHEET ) . findOneById ( theme . getFilename ( ) ) == null ) . collect ( Collectors . toList ( ) ) ; newThemes . forEach ( nt -> { try { addNewTheme ( nt , bootstrap4Themes ) ; } catch ( IOException | MolgenisStyleException e ) { LOG . error ( "error adding new bootstrap themes" , e ) ; } } ) ; } catch ( IOException e ) { LOG . error ( "error populating bootstrap themes" , e ) ; } }
Populate the database with the available bootstrap themes found in the jar . This enables the release of the application with a set of predefined bootstrap themes .