private int getLayoutID ( final int userId , final int profileId ) { return jdbcOperations . execute ( ( ConnectionCallback < Integer > ) con -> { String query = "SELECT LAYOUT_ID " + "FROM UP_USER_PROFILE " + "WHERE USER_ID=? AND PROFILE_ID=?" ; int layoutId = 0 ; PreparedStatement pstmt = con . prepareStatement ( query ) ; logger . debug ( "getLayoutID(userId={}, profileId={} ): {}" , userId , profileId , query ) ; pstmt . setInt ( 1 , userId ) ; pstmt . setInt ( 2 , profileId ) ; try { ResultSet rs = pstmt . executeQuery ( ) ; if ( rs . next ( ) ) { layoutId = rs . getInt ( 1 ) ; if ( rs . wasNull ( ) ) { layoutId = 0 ; } } } finally { pstmt . close ( ) ; } return layoutId ; } ) ; }
Returns the current layout ID for the user and profile . If the profile doesn t exist or the layout_id field is null 0 is returned .