You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Leandro Torroija <le...@hotmail.com> on 2014/09/23 22:42:29 UTC
Using MementoService
Hi everybody!
I'm using the viewModels to represent non persistent data via WicketViewer. How can I implement the MementoService to make the use of the viewModels easier?
Thanks!
Leandro
RE: Using MementoService
Posted by Leandro Torroija <le...@hotmail.com>.
thank you very much! I now understand how to use it in my project :)
> From: dan@haywood-associates.co.uk
> Date: Wed, 24 Sep 2014 12:52:39 +0100
> Subject: Re: Using MementoService
> To: users@isis.apache.org
>
> I've now updated the website with a note about this [1].
>
> Cheers
> Dan
>
> [1] http://isis.apache.org/reference/services/memento-service.html
>
> On 24 September 2014 09:33, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
>
> > Hi Leandro,
> >
> > The code I linked to is a unit test, which is why it instantiates the
> > concrete class (MementoServiceDefault).
> >
> > However, Isis automatically registers this implementation as a domain
> > service, so in your code it's sufficient and more straightforward just to
> > declare a service through the interface:
> >
> >
> > import org.apache.isis.applib.services.memento.MementoService;
> >
> > public class MyEntity {
> >
> >
> > javax.inject.Inject
> > private MementoService mementoService;
> > }
> >
> >
> > HTH
> > Dan
> >
> >
> >
> >
> >
> > On 24 September 2014 02:40, Leandro Torroija <le...@hotmail.com> wrote:
> >
> >> Thanks Dan and Joren for your responses. I've been reading the code you
> >> linked, and I see you import a MementoServiceDefault:
> >>
> >> What is the correct way to import and use it?
> >>
> >>
> >> > From: dan@haywood-associates.co.uk
> >> > Date: Tue, 23 Sep 2014 22:35:48 +0100
> >> > Subject: Re: Using MementoService
> >> > To: users@isis.apache.org
> >> >
> >> > Hi Leandro,
> >> >
> >> > As I'm sure you've figured out, the idea of the MementoService is to be
> >> > able to convert arbitrary values to and from a base 64 encoded string,
> >> such
> >> > that this can be used for the view model memento.
> >> >
> >> > This unit test [1] shows the datatypes that are supported; all the usual
> >> > scalars and also Bookmarks. Bookmarks are useful because (by way of the
> >> > related BookmarkService) they capture a reference to any arbitrary
> >> domain
> >> > object.
> >> >
> >> > It's quite common for view models to have a "backing" persistent
> >> entity, so
> >> > in such cases you can use the BookmarkService to convert that entity
> >> into a
> >> > bookmark, then the MementoService to convert it into a string.
> >> >
> >> > Anyway, hope that helps. Let us know if you get stuck.
> >> >
> >> > Cheers
> >> > Dan
> >> >
> >> >
> >> > [1]
> >> >
> >> https://github.com/apache/isis/blob/0af3219129076161143bd388e3fc3ec039cbed79/core/runtime/src/test/java/org/apache/isis/core/runtime/services/memento/MementoServiceDefaultTest.java#L48
> >> >
> >> > On 23 September 2014 21:42, Leandro Torroija <le...@hotmail.com>
> >> wrote:
> >> >
> >> > > Hi everybody!
> >> > >
> >> > > I'm using the viewModels to represent non persistent data via
> >> > > WicketViewer. How can I implement the MementoService to make the use
> >> of the
> >> > > viewModels easier?
> >> > >
> >> > >
> >> > > Thanks!
> >> > >
> >> > > Leandro
> >> > >
> >>
> >>
> >
> >
Re: Using MementoService
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
I've now updated the website with a note about this [1].
Cheers
Dan
[1] http://isis.apache.org/reference/services/memento-service.html
On 24 September 2014 09:33, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
> Hi Leandro,
>
> The code I linked to is a unit test, which is why it instantiates the
> concrete class (MementoServiceDefault).
>
> However, Isis automatically registers this implementation as a domain
> service, so in your code it's sufficient and more straightforward just to
> declare a service through the interface:
>
>
> import org.apache.isis.applib.services.memento.MementoService;
>
> public class MyEntity {
>
>
> javax.inject.Inject
> private MementoService mementoService;
> }
>
>
> HTH
> Dan
>
>
>
>
>
> On 24 September 2014 02:40, Leandro Torroija <le...@hotmail.com> wrote:
>
>> Thanks Dan and Joren for your responses. I've been reading the code you
>> linked, and I see you import a MementoServiceDefault:
>>
>> What is the correct way to import and use it?
>>
>>
>> > From: dan@haywood-associates.co.uk
>> > Date: Tue, 23 Sep 2014 22:35:48 +0100
>> > Subject: Re: Using MementoService
>> > To: users@isis.apache.org
>> >
>> > Hi Leandro,
>> >
>> > As I'm sure you've figured out, the idea of the MementoService is to be
>> > able to convert arbitrary values to and from a base 64 encoded string,
>> such
>> > that this can be used for the view model memento.
>> >
>> > This unit test [1] shows the datatypes that are supported; all the usual
>> > scalars and also Bookmarks. Bookmarks are useful because (by way of the
>> > related BookmarkService) they capture a reference to any arbitrary
>> domain
>> > object.
>> >
>> > It's quite common for view models to have a "backing" persistent
>> entity, so
>> > in such cases you can use the BookmarkService to convert that entity
>> into a
>> > bookmark, then the MementoService to convert it into a string.
>> >
>> > Anyway, hope that helps. Let us know if you get stuck.
>> >
>> > Cheers
>> > Dan
>> >
>> >
>> > [1]
>> >
>> https://github.com/apache/isis/blob/0af3219129076161143bd388e3fc3ec039cbed79/core/runtime/src/test/java/org/apache/isis/core/runtime/services/memento/MementoServiceDefaultTest.java#L48
>> >
>> > On 23 September 2014 21:42, Leandro Torroija <le...@hotmail.com>
>> wrote:
>> >
>> > > Hi everybody!
>> > >
>> > > I'm using the viewModels to represent non persistent data via
>> > > WicketViewer. How can I implement the MementoService to make the use
>> of the
>> > > viewModels easier?
>> > >
>> > >
>> > > Thanks!
>> > >
>> > > Leandro
>> > >
>>
>>
>
>
Re: Using MementoService
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Leandro,
The code I linked to is a unit test, which is why it instantiates the
concrete class (MementoServiceDefault).
However, Isis automatically registers this implementation as a domain
service, so in your code it's sufficient and more straightforward just to
declare a service through the interface:
import org.apache.isis.applib.services.memento.MementoService;
public class MyEntity {
javax.inject.Inject
private MementoService mementoService;
}
HTH
Dan
On 24 September 2014 02:40, Leandro Torroija <le...@hotmail.com> wrote:
> Thanks Dan and Joren for your responses. I've been reading the code you
> linked, and I see you import a MementoServiceDefault:
>
> What is the correct way to import and use it?
>
>
> > From: dan@haywood-associates.co.uk
> > Date: Tue, 23 Sep 2014 22:35:48 +0100
> > Subject: Re: Using MementoService
> > To: users@isis.apache.org
> >
> > Hi Leandro,
> >
> > As I'm sure you've figured out, the idea of the MementoService is to be
> > able to convert arbitrary values to and from a base 64 encoded string,
> such
> > that this can be used for the view model memento.
> >
> > This unit test [1] shows the datatypes that are supported; all the usual
> > scalars and also Bookmarks. Bookmarks are useful because (by way of the
> > related BookmarkService) they capture a reference to any arbitrary domain
> > object.
> >
> > It's quite common for view models to have a "backing" persistent entity,
> so
> > in such cases you can use the BookmarkService to convert that entity
> into a
> > bookmark, then the MementoService to convert it into a string.
> >
> > Anyway, hope that helps. Let us know if you get stuck.
> >
> > Cheers
> > Dan
> >
> >
> > [1]
> >
> https://github.com/apache/isis/blob/0af3219129076161143bd388e3fc3ec039cbed79/core/runtime/src/test/java/org/apache/isis/core/runtime/services/memento/MementoServiceDefaultTest.java#L48
> >
> > On 23 September 2014 21:42, Leandro Torroija <le...@hotmail.com>
> wrote:
> >
> > > Hi everybody!
> > >
> > > I'm using the viewModels to represent non persistent data via
> > > WicketViewer. How can I implement the MementoService to make the use
> of the
> > > viewModels easier?
> > >
> > >
> > > Thanks!
> > >
> > > Leandro
> > >
>
>
RE: Using MementoService
Posted by Leandro Torroija <le...@hotmail.com>.
Thanks Dan and Joren for your responses. I've been reading the code you linked, and I see you import a MementoServiceDefault:
What is the correct way to import and use it?
> From: dan@haywood-associates.co.uk
> Date: Tue, 23 Sep 2014 22:35:48 +0100
> Subject: Re: Using MementoService
> To: users@isis.apache.org
>
> Hi Leandro,
>
> As I'm sure you've figured out, the idea of the MementoService is to be
> able to convert arbitrary values to and from a base 64 encoded string, such
> that this can be used for the view model memento.
>
> This unit test [1] shows the datatypes that are supported; all the usual
> scalars and also Bookmarks. Bookmarks are useful because (by way of the
> related BookmarkService) they capture a reference to any arbitrary domain
> object.
>
> It's quite common for view models to have a "backing" persistent entity, so
> in such cases you can use the BookmarkService to convert that entity into a
> bookmark, then the MementoService to convert it into a string.
>
> Anyway, hope that helps. Let us know if you get stuck.
>
> Cheers
> Dan
>
>
> [1]
> https://github.com/apache/isis/blob/0af3219129076161143bd388e3fc3ec039cbed79/core/runtime/src/test/java/org/apache/isis/core/runtime/services/memento/MementoServiceDefaultTest.java#L48
>
> On 23 September 2014 21:42, Leandro Torroija <le...@hotmail.com> wrote:
>
> > Hi everybody!
> >
> > I'm using the viewModels to represent non persistent data via
> > WicketViewer. How can I implement the MementoService to make the use of the
> > viewModels easier?
> >
> >
> > Thanks!
> >
> > Leandro
> >
Re: Using MementoService
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Leandro,
As I'm sure you've figured out, the idea of the MementoService is to be
able to convert arbitrary values to and from a base 64 encoded string, such
that this can be used for the view model memento.
This unit test [1] shows the datatypes that are supported; all the usual
scalars and also Bookmarks. Bookmarks are useful because (by way of the
related BookmarkService) they capture a reference to any arbitrary domain
object.
It's quite common for view models to have a "backing" persistent entity, so
in such cases you can use the BookmarkService to convert that entity into a
bookmark, then the MementoService to convert it into a string.
Anyway, hope that helps. Let us know if you get stuck.
Cheers
Dan
[1]
https://github.com/apache/isis/blob/0af3219129076161143bd388e3fc3ec039cbed79/core/runtime/src/test/java/org/apache/isis/core/runtime/services/memento/MementoServiceDefaultTest.java#L48
On 23 September 2014 21:42, Leandro Torroija <le...@hotmail.com> wrote:
> Hi everybody!
>
> I'm using the viewModels to represent non persistent data via
> WicketViewer. How can I implement the MementoService to make the use of the
> viewModels easier?
>
>
> Thanks!
>
> Leandro
>
Re: Using MementoService
Posted by Jeroen van der Wal <je...@stromboli.it>.
Buenos noches amigos :-)
In the org.estatio.dom.party.relationship package [1] I've started
simplifying the creation of viewmodels [2]. Let me know what you think.
Cheers,
Jeroen
[1]
https://github.com/estatio/estatio/tree/master/dom/src/main/java/org/estatio/dom/party/relationship
[2]
https://github.com/estatio/estatio/blob/master/dom/src/main/java/org/estatio/dom/party/relationship/PartyRelationshipViewService.java#L52-L63
On Tue, Sep 23, 2014 at 10:49 PM, Emiliano Pereyra <
emilianopereyra@gmail.com> wrote:
> Eeehh buen ahí! Interactuando con la lista!
>
> Abz,
>
> --
> Emiliano Pereyra
>
> Enviado desde mi Moto X
> El sep 23, 2014 5:43 PM, "Leandro Torroija" <le...@hotmail.com>
> escribió:
>
> > Hi everybody!
> >
> > I'm using the viewModels to represent non persistent data via
> > WicketViewer. How can I implement the MementoService to make the use of
> the
> > viewModels easier?
> >
> >
> > Thanks!
> >
> > Leandro
> >
>
Re: Using MementoService
Posted by Emiliano Pereyra <em...@gmail.com>.
Eeehh buen ahí! Interactuando con la lista!
Abz,
--
Emiliano Pereyra
Enviado desde mi Moto X
El sep 23, 2014 5:43 PM, "Leandro Torroija" <le...@hotmail.com> escribió:
> Hi everybody!
>
> I'm using the viewModels to represent non persistent data via
> WicketViewer. How can I implement the MementoService to make the use of the
> viewModels easier?
>
>
> Thanks!
>
> Leandro
>