On Monday 02 of April 2012 15:07:24 Duncan Mac-Vicar P. wrote: > On 04/02/2012 11:14 AM, Duncan Mac-Vicar P. wrote: > > Hi guys, > > > > I was trying to add a small icon in one errata page, showing if an > > errata requires a reboot later. > > Ok, I am getting more familiar with the DataSource and SelectMode stuff > (what a framework you have in there :-) ) > > One possible solution is to do it at the SQL level: adding the column as > a sub-query. This is not very "portable" across distros but seems to be > a good solution: > > SELECT DISTINCT E.id, > E.advisory_name AS advisory, > E.update_date AS update_date, > E.synopsis AS advisory_synopsis, > E.advisory_type AS advisory_type, > (SELECT CASE WHEN (SELECT TRUE FROM rhnErrataKeyword EK > WHERE EK.keyword LIKE '%reboot_suggested%'AND EK.errata_id=E.id) IS NULL > THEN FALSE ELSE TRUE END) AS reboot_suggested > FROM rhnErrata E, > rhnChannelErrata CE > WHERE CE.channel_id = cid > AND CE.errata_id = E.id >
Hello Duncan, Yes, this would work. However I wouldn't go this way, because these queries shall fetch the information from the DB and shall not interpret the values. > Another solution, that is more consistent with the methods like > ErrataOverview.isProductEnhancement() This would be the preffered solution. > would be to have the SQL add a > comma joined version of the keywords and then have the logic in > ErrataOverview for isRebootSuggested() (I assume it is not possible to > have them fetched as a collection into the dto) It is. We already do it withe CVEs. > > I still haven't figured out the "Elaborators" part of the framework, but > I would like to hear what sounds a better approach to you. An elaborator is an additional query, that fetches additional information from the DB for a DTO object (may have additional parameters). It's always run with a main query. It may be associated only with those queries, where the additional information is needed. Let's say you would need the errata keywords only for some ErrataOverview queries. (The other queries shall not be slowed down by fetching information, that isn't needed.) Check the errata_cves_elab elaborator in Errata_queries.xml. I'd suggest to introduce a similar one for the keywords. Then check SecurityErrataOverview class to see, how the CVEs get added to the ErrataOverview dto. Add the keywords to the ErrataOverview in the same way. At least a simple method similar to the ErrataOverview.isProductEnhancement is needed, that determins reboot need on the fly. Regards, Tomas -- Tomas Lestach RHN Satellite Engineering _______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel