You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by "Rade, Joerg / Kuehne + Nagel / HAM GI-DP" <Jo...@Kuehne-Nagel.com> on 2019/05/31 09:29:35 UTC

Domain Model and the Generation Gap Pattern

Hi,

I'm working on a tool that reads in and sends out XML messages.
Depth of the XML sometimes reaches level 7. Users should be able to edit some of the data.
Once in a while, XSD's of the messages change, java objects have to be regenerated, and mappings

               input xml -> UI object -> output xml

have to be updated. The UI is handcrafted. This is error prone and messy.

Persistence is not a requirement.

Is it possible to implement UI objects as subclasses of the generated code, where subclasses constitute the (annotated) domain model, thereby applying [1]?

Thanks in advance
Jörg

[1] https://en.wikipedia.org/wiki/Generation_gap_(pattern)

Kühne + Nagel (AG & Co.) KG
Rechtsform: Kommanditgesellschaft, Bremen HRA 21928, USt-IdNr.: DE 812773878.
Geschäftsleitung Kühne + Nagel (AG & Co.) KG: Holger Ketz (Vors. ), Martin Brinkmann, Lars-Olof Grün, Matthias Knicky, Nicholas Minde, Johannes Trimborn, Lars Wedel, Matthias Weiner.
Persönlich haftende Gesellschafterin: Kühne & Nagel A.G., Rechtsform: Aktiengesellschaft nach luxemburgischem Recht, HR-Nr.: B 18745, Geschäftsführendes Verwaltungsratsmitglied: Karl Gernandt.
Geschäftsleitung Region Europa: Dr. Hansjörg Rodi (Vors.), Mart Ambur, Tom Ban, Dominic Edmonds, Thierry Held, Uwe Hött, Richard Huhn, Jan-Hendrik Köstergarten, Heiko Schuhmacher.

Wir arbeiten ausschließlich auf Grundlage der Allgemeinen Deutschen Spediteurbedingungen 2017 (ADSp 2017). Hinweis: Die ADSp 2017 weichen in Ziffer 23 hinsichtlich des Haftungshöchstbetrages für Güterschäden (§ 431 HGB) vom Gesetz ab, indem sie die Haftung bei multimodalen Transporten unter Einschluss einer Seebeförderung und bei unbekanntem Schadenort auf 2 SZR/kg und im Übrigen die Regelhaftung von 8,33 SZR/kg zusätzlich auf 1,25 Millionen Euro je Schadenfall sowie 2,5 Millionen Euro je Schadenereignis, mindestens aber 2 SZR/kg, beschränken. Die ADSp sind auf unserer Webseite als Download erhältlich. Auf Anfrage senden wir Ihnen diese auch gerne zu.

AW: Domain Model and the Generation Gap Pattern

Posted by "Rade, Joerg / Kuehne + Nagel / HAM GI-DP" <Jo...@Kuehne-Nagel.com>.
Hi Dan,

thanks for your input!

Yes, @XmlRootElement is used in some of the generated classes - so I will use the ViewModel approach.

Best regards
Jörg

-----Ursprüngliche Nachricht-----
Von: Dan Haywood [mailto:dan@haywood-associates.co.uk]
Gesendet: Freitag, 31. Mai 2019 12:35
An: users
Betreff: Re: Domain Model and the Generation Gap Pattern

Hi  Jörg,

If the generated classes are annotated with @XmlRootElement, then they are
view models so far as Isis is concerned, so they ought to be UI objects in
and of themselves.  Is that the case?

If so, then rather than subclass, you could use mixins to provide the
editing behaviour you require, and use the layout file to suppress the
detail that you don't care about.

Given these XML is presumably large ("7 levels deep"), you might need to
provide an implementation of the UrlEncodingService because the serialized
state of the XML object could be too large for a URL (8000 chars).

If, on the other hand the generated classes are not view models, then yes,
you could subclass them.  But I think I would rather use composition rather
than inheritance ... ie have a simple view model as a wrapper around the
XML object.  Here the the editing functionality would probably simply be
actions on that wrapper view model, no real need to use mixins.

HTH
Dan


[1]
http://isis.apache.org/guides/rgsvc/rgsvc.html#_rgsvc_presentation-layer-spi_UrlEncodingService

On Fri, 31 May 2019 at 10:29, Rade, Joerg / Kuehne + Nagel / HAM GI-DP <
Joerg.Rade@kuehne-nagel.com> wrote:

> Hi,
>
> I'm working on a tool that reads in and sends out XML messages.
> Depth of the XML sometimes reaches level 7. Users should be able to edit
> some of the data.
> Once in a while, XSD's of the messages change, java objects have to be
> regenerated, and mappings
>
>                input xml -> UI object -> output xml
>
> have to be updated. The UI is handcrafted. This is error prone and messy.
>
> Persistence is not a requirement.
>
> Is it possible to implement UI objects as subclasses of the generated
> code, where subclasses constitute the (annotated) domain model, thereby
> applying [1]?
>
> Thanks in advance
> Jörg
>
> [1] https://en.wikipedia.org/wiki/Generation_gap_(pattern)
>
> Kühne + Nagel (AG & Co.) KG
> Rechtsform: Kommanditgesellschaft, Bremen HRA 21928, USt-IdNr.: DE
> 812773878.
> Geschäftsleitung Kühne + Nagel (AG & Co.) KG: Holger Ketz (Vors. ), Martin
> Brinkmann, Lars-Olof Grün, Matthias Knicky, Nicholas Minde, Johannes
> Trimborn, Lars Wedel, Matthias Weiner.
> Persönlich haftende Gesellschafterin: Kühne & Nagel A.G., Rechtsform:
> Aktiengesellschaft nach luxemburgischem Recht, HR-Nr.: B 18745,
> Geschäftsführendes Verwaltungsratsmitglied: Karl Gernandt.
> Geschäftsleitung Region Europa: Dr. Hansjörg Rodi (Vors.), Mart Ambur, Tom
> Ban, Dominic Edmonds, Thierry Held, Uwe Hött, Richard Huhn, Jan-Hendrik
> Köstergarten, Heiko Schuhmacher.
>
> Wir arbeiten ausschließlich auf Grundlage der Allgemeinen Deutschen
> Spediteurbedingungen 2017 (ADSp 2017). Hinweis: Die ADSp 2017 weichen in
> Ziffer 23 hinsichtlich des Haftungshöchstbetrages für Güterschäden (§ 431
> HGB) vom Gesetz ab, indem sie die Haftung bei multimodalen Transporten
> unter Einschluss einer Seebeförderung und bei unbekanntem Schadenort auf 2
> SZR/kg und im Übrigen die Regelhaftung von 8,33 SZR/kg zusätzlich auf 1,25
> Millionen Euro je Schadenfall sowie 2,5 Millionen Euro je Schadenereignis,
> mindestens aber 2 SZR/kg, beschränken. Die ADSp sind auf unserer Webseite
> als Download erhältlich. Auf Anfrage senden wir Ihnen diese auch gerne zu.
>

Kühne + Nagel (AG & Co.) KG
Rechtsform: Kommanditgesellschaft, Bremen HRA 21928, USt-IdNr.: DE 812773878.
Geschäftsleitung Kühne + Nagel (AG & Co.) KG: Holger Ketz (Vors. ), Martin Brinkmann, Lars-Olof Grün, Matthias Knicky, Nicholas Minde, Johannes Trimborn, Lars Wedel, Matthias Weiner.
Persönlich haftende Gesellschafterin: Kühne & Nagel A.G., Rechtsform: Aktiengesellschaft nach luxemburgischem Recht, HR-Nr.: B 18745, Geschäftsführendes Verwaltungsratsmitglied: Karl Gernandt.
Geschäftsleitung Region Europa: Dr. Hansjörg Rodi (Vors.), Mart Ambur, Tom Ban, Dominic Edmonds, Thierry Held, Uwe Hött, Richard Huhn, Jan-Hendrik Köstergarten, Heiko Schuhmacher.

Wir arbeiten ausschließlich auf Grundlage der Allgemeinen Deutschen Spediteurbedingungen 2017 (ADSp 2017). Hinweis: Die ADSp 2017 weichen in Ziffer 23 hinsichtlich des Haftungshöchstbetrages für Güterschäden (§ 431 HGB) vom Gesetz ab, indem sie die Haftung bei multimodalen Transporten unter Einschluss einer Seebeförderung und bei unbekanntem Schadenort auf 2 SZR/kg und im Übrigen die Regelhaftung von 8,33 SZR/kg zusätzlich auf 1,25 Millionen Euro je Schadenfall sowie 2,5 Millionen Euro je Schadenereignis, mindestens aber 2 SZR/kg, beschränken. Die ADSp sind auf unserer Webseite als Download erhältlich. Auf Anfrage senden wir Ihnen diese auch gerne zu.

Re: Domain Model and the Generation Gap Pattern

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi  Jörg,

If the generated classes are annotated with @XmlRootElement, then they are
view models so far as Isis is concerned, so they ought to be UI objects in
and of themselves.  Is that the case?

If so, then rather than subclass, you could use mixins to provide the
editing behaviour you require, and use the layout file to suppress the
detail that you don't care about.

Given these XML is presumably large ("7 levels deep"), you might need to
provide an implementation of the UrlEncodingService because the serialized
state of the XML object could be too large for a URL (8000 chars).

If, on the other hand the generated classes are not view models, then yes,
you could subclass them.  But I think I would rather use composition rather
than inheritance ... ie have a simple view model as a wrapper around the
XML object.  Here the the editing functionality would probably simply be
actions on that wrapper view model, no real need to use mixins.

HTH
Dan


[1]
http://isis.apache.org/guides/rgsvc/rgsvc.html#_rgsvc_presentation-layer-spi_UrlEncodingService

On Fri, 31 May 2019 at 10:29, Rade, Joerg / Kuehne + Nagel / HAM GI-DP <
Joerg.Rade@kuehne-nagel.com> wrote:

> Hi,
>
> I'm working on a tool that reads in and sends out XML messages.
> Depth of the XML sometimes reaches level 7. Users should be able to edit
> some of the data.
> Once in a while, XSD's of the messages change, java objects have to be
> regenerated, and mappings
>
>                input xml -> UI object -> output xml
>
> have to be updated. The UI is handcrafted. This is error prone and messy.
>
> Persistence is not a requirement.
>
> Is it possible to implement UI objects as subclasses of the generated
> code, where subclasses constitute the (annotated) domain model, thereby
> applying [1]?
>
> Thanks in advance
> Jörg
>
> [1] https://en.wikipedia.org/wiki/Generation_gap_(pattern)
>
> Kühne + Nagel (AG & Co.) KG
> Rechtsform: Kommanditgesellschaft, Bremen HRA 21928, USt-IdNr.: DE
> 812773878.
> Geschäftsleitung Kühne + Nagel (AG & Co.) KG: Holger Ketz (Vors. ), Martin
> Brinkmann, Lars-Olof Grün, Matthias Knicky, Nicholas Minde, Johannes
> Trimborn, Lars Wedel, Matthias Weiner.
> Persönlich haftende Gesellschafterin: Kühne & Nagel A.G., Rechtsform:
> Aktiengesellschaft nach luxemburgischem Recht, HR-Nr.: B 18745,
> Geschäftsführendes Verwaltungsratsmitglied: Karl Gernandt.
> Geschäftsleitung Region Europa: Dr. Hansjörg Rodi (Vors.), Mart Ambur, Tom
> Ban, Dominic Edmonds, Thierry Held, Uwe Hött, Richard Huhn, Jan-Hendrik
> Köstergarten, Heiko Schuhmacher.
>
> Wir arbeiten ausschließlich auf Grundlage der Allgemeinen Deutschen
> Spediteurbedingungen 2017 (ADSp 2017). Hinweis: Die ADSp 2017 weichen in
> Ziffer 23 hinsichtlich des Haftungshöchstbetrages für Güterschäden (§ 431
> HGB) vom Gesetz ab, indem sie die Haftung bei multimodalen Transporten
> unter Einschluss einer Seebeförderung und bei unbekanntem Schadenort auf 2
> SZR/kg und im Übrigen die Regelhaftung von 8,33 SZR/kg zusätzlich auf 1,25
> Millionen Euro je Schadenfall sowie 2,5 Millionen Euro je Schadenereignis,
> mindestens aber 2 SZR/kg, beschränken. Die ADSp sind auf unserer Webseite
> als Download erhältlich. Auf Anfrage senden wir Ihnen diese auch gerne zu.
>