You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2015/11/19 19:13:11 UTC

[jira] [Commented] (ISIS-915) Framework should transparently allow view models to reference other view models.

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

ASF subversion and git services commented on ISIS-915:
------------------------------------------------------

Commit 4b891285bc69f1e295c268175b32fb4b7bb3adf6 in isis's branch refs/heads/ISIS-1250 from [~danhaywood]
[ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=4b89128 ]

ISIS-915, ISIS-1250, ISIS-1251, ISIS-1252, ISIS-1254, ISIS-1255: documentation and minor code updates.


> Framework should transparently allow view models to reference other view models.
> --------------------------------------------------------------------------------
>
>                 Key: ISIS-915
>                 URL: https://issues.apache.org/jira/browse/ISIS-915
>             Project: Isis
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: core-1.6.0
>            Reporter: Vladimir Nisevic
>            Assignee: Dan Haywood
>             Fix For: 1.11.0
>
>
> The description below shows the current behaviour; the core tries to interpret the "Street" reference as a persisted entity.
> The workaround is to have explicitly implement ViewModel (rather than annotated with @ViewModel) and to traverse the graph manually.  Using XmlSnapshotService could be one way to do this (or at least to provide inspiration on how to accomplish this).
> Note though that ISIS-916 is a prereq in order to implement such as workaround.
> ~~~
> 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)