Hi, We found out that commit 16f30f97d657ab7019489dfac5a11f67afc2143e apparently broke the Errata page for custom channels:
https://<hostname>/rhn/channels/manage/errata/ListRemove.do?cid=XXX Sorting (by clicking on the columns) as well as filtering the list is broken and it seems as if the query is not actually elaborated. So I am coming up with two patch proposals, since I am not really sure about how we are intended to solve the problem: - The first patch fixes it by calling elaborate() manually once - The second patch is a more generic fix and calls elaborate() in BaseManager.java even if PageControl is null What do you think, can you actually reproduce the bug? Why would we want to return an unelaborated list in case PageControl is null? Regards, Johannes -- SUSE LINUX Products GmbH, HRB 16746 (AG Nürnberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
>From 3a688e6570caa2ef2a4d0a20ffbf3f9237865efe Mon Sep 17 00:00:00 2001 From: Johannes Renner <jren...@suse.de> Date: Fri, 3 Aug 2012 12:13:49 +0200 Subject: [PATCH] Call elaborate manually --- .../redhat/rhn/manager/channel/ChannelManager.java | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java index da09b61..950edbe 100644 --- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java +++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java @@ -1288,7 +1288,7 @@ public class ChannelManager extends BaseManager { DataResult dr = m.execute(params); Map elabParams = new HashMap(); elabParams.put("user_id", user.getId()); - dr.setElaborationParams(elabParams); + dr.elaborate(elabParams); return dr; } -- 1.7.7
>From 72bbdde0170645907c240057bbd1ffede1b716d0 Mon Sep 17 00:00:00 2001 From: Johannes Renner <jren...@suse.de> Date: Fri, 3 Aug 2012 12:37:53 +0200 Subject: [PATCH] Return an elaborated list even if PageControl is null --- .../src/com/redhat/rhn/manager/BaseManager.java | 28 ++++++------------- .../redhat/rhn/manager/channel/ChannelManager.java | 4 +-- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/java/code/src/com/redhat/rhn/manager/BaseManager.java b/java/code/src/com/redhat/rhn/manager/BaseManager.java index 0a21cab..95fb490 100644 --- a/java/code/src/com/redhat/rhn/manager/BaseManager.java +++ b/java/code/src/com/redhat/rhn/manager/BaseManager.java @@ -106,8 +106,7 @@ public abstract class BaseManager { } /** - * Process the PageControl against the DataResult. Returns an - * <strong>unelaborated</strong> list if PageControl is null. + * Process the PageControl against the DataResult. * @param dr * @param elabParams Named parameters for the elaboration query. * @param pc Page Control boundary definition. @@ -116,10 +115,6 @@ public abstract class BaseManager { protected static DataResult processPageControl(DataResult dr, PageControl pc, Map elabParams) { - if (elabParams != null) { - dr.setElaborationParams(elabParams); - } - if (pc != null) { dr.setFilter(pc.hasFilter()); if (pc.hasFilter()) { @@ -140,22 +135,20 @@ public abstract class BaseManager { // now use the PageControl to limit the list to the // selected region. dr = dr.subList(pc.getStart() - 1, pc.getEnd()); + } - //elaborate the data result to get the detailed information. - if (elabParams != null) { - dr.elaborate(elabParams); - } + //elaborate the data result to get the detailed information. + if (elabParams != null) { + dr.elaborate(elabParams); } return dr; - } /** * Process the ListControl against the DataResult. The method * does not limit the number of results, unlike PageControl, and - * simply provides filtering. Returns an <strong>unelaborated</strong> - * list if ListControl is null. + * simply provides filtering. * @param dr * @param elabParams Named parameters for the elaboration query. * @param lc ListControl filtering definition. @@ -164,10 +157,6 @@ public abstract class BaseManager { protected static DataResult processListControl(DataResult dr, ListControl lc, Map elabParams) { - if (elabParams != null) { - dr.setElaborationParams(elabParams); - } - if (lc != null) { dr.setFilter(lc.hasFilter()); if (lc.hasFilter()) { @@ -184,12 +173,13 @@ public abstract class BaseManager { dr.setIndex(lc.createIndex(dr)); } } + } - //elaborate the data result to get the detailed information. + //elaborate the data result to get the detailed information. + if (elabParams != null) { dr.elaborate(elabParams); } - return dr; } } diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java index da09b61..5cd9e8e 100644 --- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java +++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java @@ -1285,11 +1285,9 @@ public class ChannelManager extends BaseManager { SelectMode m = ModeFactory.getMode( "Errata_queries", mode); - DataResult dr = m.execute(params); Map elabParams = new HashMap(); elabParams.put("user_id", user.getId()); - dr.setElaborationParams(elabParams); - return dr; + return makeDataResultNoPagination(params, elabParams, m); } -- 1.7.7
_______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel