You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2014/10/04 10:31:33 UTC

[jira] [Comment Edited] (ISIS-915) Using ViewModel annotations creates exception in wicket viewer

    [ https://issues.apache.org/jira/browse/ISIS-915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14159044#comment-14159044 ] 

Dan Haywood edited comment on ISIS-915 at 10/4/14 8:31 AM:
-----------------------------------------------------------

This is because Address is referring to Street, both view models.  We currently don't - transparently - support this use case.

The fix would be to make MementoService more sophisticated.  The memento string you see is actually a base64-encoded version of an XML document.  So that XML could in principal be arbitrarily complex, and thus could embed the state of the referenced ViewModel.

The snag is the right now we don't have a way for framework-provided services annotated with @DomainService to be replaced.  But I intend to address that for 1.7.0.

I'm going to update this issue with the actual requirement for the framework to transparently support view models referencing other view models.


was (Author: danhaywood):
could you upload the complete stacktrace?


> Using ViewModel annotations creates exception in wicket viewer
> --------------------------------------------------------------
>
>                 Key: ISIS-915
>                 URL: https://issues.apache.org/jira/browse/ISIS-915
>             Project: Isis
>          Issue Type: Bug
>          Components: Viewer: Wicket
>    Affects Versions: viewer-wicket-1.7.0
>            Reporter: Vladimir Nisevic
>            Assignee: Dan Haywood
>
> Having this ViewModel annotated classes
> {code}
> @org.apache.isis.applib.annotation.ViewModel
> public class Address2 {
>     public Address2(String lkmsId) {
>         this.lkmsId = lkmsId;
>     }
>     public String title() {
>         return "Address lkmsId:" + lkmsId;
>     }
>     public String iconName() {
>         return "Location_icon";
>     }
>     // {{ LkmsId (property)
>     private String lkmsId;
>     @MemberOrder(sequence = "1")
>     public String getLkmsId() {
>         return lkmsId;
>     }
>     public void setLkmsId(final String lkmsId) {
>         this.lkmsId = lkmsId;
>     }
>     // }}
>     // {{ Street (property)
>     private Street2 street;
>     @MemberOrder(sequence = "3")
>     public Street2 getStreet() {
>         return street;
>     }
>     public void setStreet(final Street2 street) {
>         this.street = street;
>     }
>     // }}
>     // {{ Housenumber (property)
>     private String houseNumber;
>     @MemberOrder(sequence = "2")
>     public String getHouseNumber() {
>         return houseNumber;
>     }
>     public void setHouseNumber(final String housenumber) {
>         this.houseNumber = housenumber;
>     }
>     // }}
> }
> {code}
> and 
> {code}
> @ViewModel
> public class Street2 {
>     public Street2(String lkmsId) {
>         this.lkmsId = lkmsId;
>     }
>     public String title() {
>         return "Street lkmsId:" + lkmsId;
>     }
>     // {{ LkmsId (property)
>     private String lkmsId;
>     @MemberOrder(sequence = "1")
>     public String getLkmsId() {
>         return lkmsId;
>     }
>     public void setLkmsId(final String lkmsId) {
>         this.lkmsId = lkmsId;
>     }
>     // }}
>     // {{ Streetname (property)
>     private String streetname;
>     @MemberOrder(sequence = "2")
>     public String getStreetname() {
>         return streetname;
>     }
>     public void setStreetname(final String aName) {
>         this.streetname = aName;
>     }
>     // }}
>     // {{ Plz (property)
>     private String plz;
>     @MemberOrder(sequence = "3")
>     public String getPlz() {
>         return plz;
>     }
>     public void setPlz(final String plz) {
>         this.plz = plz;
>     }
>     // }}
> }
> {code}
> When calling the domain service method
> {code}
>  @Prototype
>     @Render(Type.EAGERLY)
>     public Address2 retreiveAnnotatedAddressModelSample() {
>         Address2 address = new Address2("11");
>         address.setHouseNumber("12");
>         Street2 street = new Street2("123");
>         street.setStreetname("5th street");
>         street.setPlz("1100");
>         address.setStreet(street);
>         return address;
>     }
> {code}
> will bring this exception 
> {code}
> Handling the following exception
> org.apache.isis.core.runtime.persistence.PojoRecreationException: Could not recreate pojo for oid oid *a1.ase.viewmodel.annotated.Address2:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8-PGxrbXNJZD4xMTwvbGttc0lkPjxob3VzZU51bWJlcj4xMjwvaG91c2VOdW1iZXI-PHN0cmVldC5ib29rbWFyaz5hMS5hc2Uudmlld21vZGVsLmFubm90YXRlZC5TdHJlZXQyOlBEOTRiV3dnZG1WeWMybHZiajBpTVM0d0lpQmxibU52WkdsdVp6MGlWVlJHTFRnaVB6NEtQRzFsYldWdWRHOC1QR3hyYlhOSlpENHhNak04TDJ4cmJYTkpaRDQ4YzNSeVpXVjBibUZ0WlQ0MWRHZ2djM1J5WldWMFBDOXpkSEpsWlhSdVlXMWxQanh3YkhvLU1URXdNRHd2Y0d4NlBqd3ZiV1Z0Wlc1MGJ6ND08L3N0cmVldC5ib29rbWFyaz48L21lbWVudG8-
> 	at org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:311)
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)