@ PreAuthorize ( "hasAnyRole('ROLE_SU')" ) @ PostMapping ( value = "/add-bootstrap-theme" ) public @ ResponseBody Style addBootstrapTheme ( @ RequestParam ( value = "bootstrap3-style" ) MultipartFile bootstrap3Style , @ RequestParam ( value = "bootstrap4-style" , required = false ) MultipartFile bootstrap4Style ) throws MolgenisStyleException { String styleIdentifier = bootstrap3Style . getOriginalFilename ( ) ; try { String bs4FileName = null ; InputStream bs3InputStream = null ; InputStream bs4InputStream = null ; try { bs3InputStream = bootstrap3Style . getInputStream ( ) ; if ( bootstrap4Style != null ) { bs4FileName = bootstrap4Style . getOriginalFilename ( ) ; bs4InputStream = bootstrap4Style . getInputStream ( ) ; } return styleService . addStyle ( styleIdentifier , bootstrap3Style . getOriginalFilename ( ) , bs3InputStream , bs4FileName , bs4InputStream ) ; } finally { if ( bs3InputStream != null ) { bs3InputStream . close ( ) ; } if ( bs4InputStream != null ) { bs4InputStream . close ( ) ; } } } catch ( IOException e ) { throw new MolgenisStyleException ( "unable to add style: " + styleIdentifier , e ) ; } }
Add a new bootstrap theme theme is passed as a bootstrap css file . It is mandatory to pass a bootstrap3 style file but optional to pass a bootstrap 4 style file