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 <d...@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 <leand...@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: d...@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 <leand...@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 >> > > >> >> > >