public void reset ( int profileId , String clientUUID ) throws Exception { PreparedStatement statement = null ; // TODO: need a better way to do this than brute force.. but the iterative approach is too slow try ( Connection sqlConnection = sqlService . getConnection ( ) ) { // first remove all enabled overrides with this client uuid String queryString = "DELETE FROM " + Constants . DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants . GENERIC_CLIENT_UUID + "= ? " + " AND " + Constants . GENERIC_PROFILE_ID + " = ?" ; statement = sqlConnection . prepareStatement ( queryString ) ; statement . setString ( 1 , clientUUID ) ; statement . setInt ( 2 , profileId ) ; statement . executeUpdate ( ) ; statement . close ( ) ; // clean up request response table for this uuid queryString = "UPDATE " + Constants . DB_TABLE_REQUEST_RESPONSE + " SET " + Constants . REQUEST_RESPONSE_CUSTOM_REQUEST + "=?, " + Constants . REQUEST_RESPONSE_CUSTOM_RESPONSE + "=?, " + Constants . REQUEST_RESPONSE_REPEAT_NUMBER + "=-1, " + Constants . REQUEST_RESPONSE_REQUEST_ENABLED + "=0, " + Constants . REQUEST_RESPONSE_RESPONSE_ENABLED + "=0 " + "WHERE " + Constants . GENERIC_CLIENT_UUID + "=? " + " AND " + Constants . GENERIC_PROFILE_ID + "=?" ; statement = sqlConnection . prepareStatement ( queryString ) ; statement . setString ( 1 , "" ) ; statement . setString ( 2 , "" ) ; statement . setString ( 3 , clientUUID ) ; statement . setInt ( 4 , profileId ) ; statement . executeUpdate ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } this . updateActive ( profileId , clientUUID , false ) ; }
Resets all override settings for the clientUUID and disables it