You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by james agada <ok...@gmail.com> on 2013/11/16 20:50:11 UTC

How can I search for an entity using the OID

When creating a view model, I am retrieving the OID of a referenced entity.
Is it possible to retrieve an entity with just the OID which is usually an
integer

Re: How can I search for an entity using the OID

Posted by Okwui <ok...@gmail.com>.
Hmm. I will have to try this.

Sent from my iPad

> On Nov 17, 2013, at 1:31 PM, Dan Haywood <da...@haywood-associates.co.uk> wrote:
> 
> Yes, we can do this.
> 
> The easiest thing to do is to use the BookmarkService, eg as configured in
> the quickstart example [1] or (even better) in a demo application "rrraddd"
> that I put together for a conference recently [2] and now refererenced as a
> tutorial from our website [3]
> 
> In [2], the SpeakerViewModel is a view model that is "backed" by an
> individual Speaker entity (the domain is ConferenceSession, Speaker, Tag).
> As [4] shows, you can use BookmarkService to bother convert the OID of a
> Speaker into an opaque string, and convert it back again as shown in [5]
> 
> The base32() encoding is to avoid Isis getting confused between the OID of
> the SpeakerViewModel and the OID of the Speaker itself that gets wrapped.
> 
> This approach should work for any entity at all; the string is basically a
> URI to any object in the domain - a very powerful concept!
> 
> HTH
> Dan
> 
> 
> [1]
> https://github.com/apache/isis/blob/5e9d586a3a1dcb9e4cf23470f6cb4ef43ebae06d/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties#L171
> [2]
> https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/webapp/src/main/webapp/WEB-INF/isis.properties#L169
> [3] http://isis.apache.org/documentation.html
> [4]
> https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L29<https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L28>
> [5]
> https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L36
> 
> 
> 
>> On 17 November 2013 08:36, David Tildesley <da...@yahoo.co.nz> wrote:
>> 
>> I'm interested in the answer to that also.
>> 
>> David.
>> 
>> 
>> 
>> On Sunday, 17 November 2013 8:50 AM, james agada <ok...@gmail.com>
>> wrote:
>> 
>> When creating a view model, I am retrieving the OID of a referenced entity.
>> Is it possible to retrieve an entity with just the OID which is usually an
>> integer
>> 

Re: How can I search for an entity using the OID

Posted by David Tildesley <da...@yahoo.co.nz>.
Thanks Dan.

David.




On Monday, 18 November 2013 1:32 AM, Dan Haywood <da...@haywood-associates.co.uk> wrote:
 
Yes, we can do this.

The easiest thing to do is to use the BookmarkService, eg as configured in
the quickstart example [1] or (even better) in a demo application "rrraddd"
that I put together for a conference recently [2] and now refererenced as a
tutorial from our website [3]

In [2], the SpeakerViewModel is a view model that is "backed" by an
individual Speaker entity (the domain is ConferenceSession, Speaker, Tag).
As [4] shows, you can use BookmarkService to bother convert the OID of a
Speaker into an opaque string, and convert it back again as shown in [5]

The base32() encoding is to avoid Isis getting confused between the OID of
the SpeakerViewModel and the OID of the Speaker itself that gets wrapped.

This approach should work for any entity at all; the string is basically a
URI to any object in the domain - a very powerful concept!

HTH
Dan


[1]
https://github.com/apache/isis/blob/5e9d586a3a1dcb9e4cf23470f6cb4ef43ebae06d/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties#L171
[2]
https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/webapp/src/main/webapp/WEB-INF/isis.properties#L169
[3] http://isis.apache.org/documentation.html
[4]
https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L29<https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L28>
[5]
https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L36




On 17 November 2013 08:36, David Tildesley <da...@yahoo.co.nz> wrote:

> I'm interested in the answer to that also.
>
> David.
>
>
>
> On Sunday, 17 November 2013 8:50 AM, james agada <ok...@gmail.com>
> wrote:
>
> When creating a view model, I am retrieving the OID of a referenced entity.
> Is it possible to retrieve an entity with just the OID which is usually an
> integer
>

Re: How can I search for an entity using the OID

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Yes, we can do this.

The easiest thing to do is to use the BookmarkService, eg as configured in
the quickstart example [1] or (even better) in a demo application "rrraddd"
that I put together for a conference recently [2] and now refererenced as a
tutorial from our website [3]

In [2], the SpeakerViewModel is a view model that is "backed" by an
individual Speaker entity (the domain is ConferenceSession, Speaker, Tag).
 As [4] shows, you can use BookmarkService to bother convert the OID of a
Speaker into an opaque string, and convert it back again as shown in [5]

The base32() encoding is to avoid Isis getting confused between the OID of
the SpeakerViewModel and the OID of the Speaker itself that gets wrapped.

This approach should work for any entity at all; the string is basically a
URI to any object in the domain - a very powerful concept!

HTH
Dan


[1]
https://github.com/apache/isis/blob/5e9d586a3a1dcb9e4cf23470f6cb4ef43ebae06d/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties#L171
[2]
https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/webapp/src/main/webapp/WEB-INF/isis.properties#L169
[3] http://isis.apache.org/documentation.html
[4]
https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L29<https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L28>
[5]
https://github.com/danhaywood/rrraddd-isis-131/blob/c3cdf918f7da0c83a1408c7e6712ab10b8798103/myapp/dom/src/main/java/dom/simple/SpeakerViewModel.java#L36



On 17 November 2013 08:36, David Tildesley <da...@yahoo.co.nz> wrote:

> I'm interested in the answer to that also.
>
> David.
>
>
>
> On Sunday, 17 November 2013 8:50 AM, james agada <ok...@gmail.com>
> wrote:
>
> When creating a view model, I am retrieving the OID of a referenced entity.
> Is it possible to retrieve an entity with just the OID which is usually an
> integer
>

Re: How can I search for an entity using the OID

Posted by David Tildesley <da...@yahoo.co.nz>.
I'm interested in the answer to that also.

David.



On Sunday, 17 November 2013 8:50 AM, james agada <ok...@gmail.com> wrote:
 
When creating a view model, I am retrieving the OID of a referenced entity.
Is it possible to retrieve an entity with just the OID which is usually an
integer