You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Vladimir Nišević <vn...@gmail.com> on 2014/09/23 16:39:20 UTC

ViewModel as return value of domain service

Hi everybody, here my second question today.

I need to provide a domain service which handles multiple elasticsearch and
database queries and builds a "non persistent domain object" and gives that
as a response to the 3rd party client thru REST API.

So my idea is to define a ViewModel classes representing my "non-persistent
domain model" and use them as method return value of a domain service. In a
domain service method I would make those elasticsearch and database queries
and then build and provide that object as a return value.

It seems that ViewModel cannot be returned thru REST API?

BR,Vladimir

Re: ViewModel as return value of domain service

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
OK, have committed a fix in 1.7.0-SNAPSHOT, see [1]

In my (fairly limited testing), is now working.  Let me know if it works
for you.

Cheers
Dan


[1] https://issues.apache.org/jira/browse/ISIS-899

On 24 September 2014 08:37, Vladimir Nišević <vn...@gmail.com> wrote:

> Hi, yes, we're currently using 1.6.
>
> Is this fixed in curent dev branch?
> Could I fix it? Where to look?
>
> Vladimir
>
>
> > Am 24.09.2014 um 00:23 schrieb Dan Haywood <dan@haywood-associates.co.uk
> >:
> >
> > Um, it certainly is the intention that view models can be returned from
> the
> > REST API, but was just double checking this before answering, and it
> seems
> > that there is a bug in 1.6.0.  Apologies for that.
> >
> > Looks like the fix is easy enough, and I need to put out a 1.6.1 release
> > anyway to address some security issues raised recently, so will look to
> > incorporate the fix into that.
> >
> > So your idea is sound; I'll report back when made some progress.
> >
> > Ta
> > Dan
> >
> >
> >> On 23 September 2014 15:39, Vladimir Nišević <vn...@gmail.com>
> wrote:
> >>
> >> Hi everybody, here my second question today.
> >>
> >> I need to provide a domain service which handles multiple elasticsearch
> and
> >> database queries and builds a "non persistent domain object" and gives
> that
> >> as a response to the 3rd party client thru REST API.
> >>
> >> So my idea is to define a ViewModel classes representing my
> "non-persistent
> >> domain model" and use them as method return value of a domain service.
> In a
> >> domain service method I would make those elasticsearch and database
> queries
> >> and then build and provide that object as a return value.
> >>
> >> It seems that ViewModel cannot be returned thru REST API?
> >>
> >> BR,Vladimir
> >>
>

Re: ViewModel as return value of domain service

Posted by Vladimir Nišević <vn...@gmail.com>.
Hi, yes, we're currently using 1.6. 

Is this fixed in curent dev branch?
Could I fix it? Where to look?

Vladimir


> Am 24.09.2014 um 00:23 schrieb Dan Haywood <da...@haywood-associates.co.uk>:
> 
> Um, it certainly is the intention that view models can be returned from the
> REST API, but was just double checking this before answering, and it seems
> that there is a bug in 1.6.0.  Apologies for that.
> 
> Looks like the fix is easy enough, and I need to put out a 1.6.1 release
> anyway to address some security issues raised recently, so will look to
> incorporate the fix into that.
> 
> So your idea is sound; I'll report back when made some progress.
> 
> Ta
> Dan
> 
> 
>> On 23 September 2014 15:39, Vladimir Nišević <vn...@gmail.com> wrote:
>> 
>> Hi everybody, here my second question today.
>> 
>> I need to provide a domain service which handles multiple elasticsearch and
>> database queries and builds a "non persistent domain object" and gives that
>> as a response to the 3rd party client thru REST API.
>> 
>> So my idea is to define a ViewModel classes representing my "non-persistent
>> domain model" and use them as method return value of a domain service. In a
>> domain service method I would make those elasticsearch and database queries
>> and then build and provide that object as a return value.
>> 
>> It seems that ViewModel cannot be returned thru REST API?
>> 
>> BR,Vladimir
>> 

Re: ViewModel as return value of domain service

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Um, it certainly is the intention that view models can be returned from the
REST API, but was just double checking this before answering, and it seems
that there is a bug in 1.6.0.  Apologies for that.

Looks like the fix is easy enough, and I need to put out a 1.6.1 release
anyway to address some security issues raised recently, so will look to
incorporate the fix into that.

So your idea is sound; I'll report back when made some progress.

Ta
Dan


On 23 September 2014 15:39, Vladimir Nišević <vn...@gmail.com> wrote:

> Hi everybody, here my second question today.
>
> I need to provide a domain service which handles multiple elasticsearch and
> database queries and builds a "non persistent domain object" and gives that
> as a response to the 3rd party client thru REST API.
>
> So my idea is to define a ViewModel classes representing my "non-persistent
> domain model" and use them as method return value of a domain service. In a
> domain service method I would make those elasticsearch and database queries
> and then build and provide that object as a return value.
>
> It seems that ViewModel cannot be returned thru REST API?
>
> BR,Vladimir
>