public List < Method > getMethodsFromGroupId ( int groupId , String [ ] filters ) throws Exception { ArrayList < Method > methods = new ArrayList < Method > ( ) ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_OVERRIDE + " WHERE " + Constants . OVERRIDE_GROUP_ID + " = ?" ) ; statement . setInt ( 1 , groupId ) ; results = statement . executeQuery ( ) ; while ( results . next ( ) ) { Method method = PathOverrideService . getInstance ( ) . getMethodForOverrideId ( results . getInt ( "id" ) ) ; if ( method == null ) { continue ; } // decide whether or not to add this method based on the filters boolean add = true ; if ( filters != null ) { add = false ; for ( String filter : filters ) { if ( method . getMethodType ( ) . endsWith ( filter ) ) { add = true ; break ; } } } if ( add && ! methods . contains ( method ) ) { methods . add ( method ) ; } } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( Exception e ) { } try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } return methods ; }
Returns all methods for a specific group