[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Spacewalk-devel] dto's from the database?

Hi guys,

I was trying to add a small icon in one errata page, showing if an errata requires a reboot later.

After modifying the jsp file and adding a method isRebootSuggested to errata and implementing it in PublishedErrata as hasKeyword("reboot_suggested") (we set that keyword from reposync) I realized that the object shown on the screen was a DTO (ErrataOverview). Ok, back to find out where the object was created and add there a bool property to the DTO based on whether the keyword is present or not.

But after following the code path from ErrataManager.errataInChannel it looks like the properties of the DTO are set dynamically using reflection.

While this may make sense, it confuses me a lot on the role of the domain objects. If the DTOs are being used to be displayed in the UI and their properties are optimized for this, populating them from the database does not feel right (you would need to fill the keyword list instead of setting a bool), and kind of confuses on what are then the domain classes for.

I am not criticizing the design, just not getting it completely :-), but I would like to hear from someone understanding this approach what would be the right way to add a property that is calculated from the persisted ones, if the DTOs are not manually created.

Duncan Mac-Vicar P. - http://www.suse.com/

SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]