private static boolean getAccessSetFromDB ( final String _sql , final Object _criteria ) throws CacheReloadException { boolean ret = false ; Connection con = null ; try { AccessSet accessSet = null ; con = Context . getConnection ( ) ; PreparedStatement stmt = null ; try { stmt = con . prepareStatement ( _sql ) ; stmt . setObject ( 1 , _criteria ) ; final ResultSet rs = stmt . executeQuery ( ) ; if ( rs . next ( ) ) { final long id = rs . getLong ( 1 ) ; final String uuid = rs . getString ( 2 ) ; final String name = rs . getString ( 3 ) ; AccessSet . LOG . debug ( "read AccessSet '{}' (id = {}, uuid ={})" , name , id , uuid ) ; accessSet = new AccessSet ( id , uuid , name ) ; } ret = true ; rs . close ( ) ; } finally { if ( stmt != null ) { stmt . close ( ) ; } } con . commit ( ) ; if ( accessSet != null ) { accessSet . readLinks2AccessTypes ( ) ; accessSet . readLinks2DMTypes ( ) ; accessSet . readLinks2Status ( ) ; accessSet . readLinks2Person ( ) ; // needed due to cluster serialization that does not update automatically AccessSet . cacheAccessSet ( accessSet ) ; } } catch ( final SQLException e ) { throw new CacheReloadException ( "could not read roles" , e ) ; } catch ( final EFapsException e ) { throw new CacheReloadException ( "could not read roles" , e ) ; } finally { try { if ( con != null && ! con . isClosed ( ) ) { con . close ( ) ; } } catch ( final SQLException e ) { throw new CacheReloadException ( "could not read child type ids" , e ) ; } } return ret ; }
Read the AccessSet from the DataBase .