You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Dan Haywood <da...@haywood-associates.co.uk> on 2013/07/10 16:12:47 UTC

Re: [Android Viewer]Problem in Domain Service representations

On 10 July 2013 10:20, DImuthu Upeksha <di...@gmail.com> wrote:

>
> For my testing purposes I use RO viewers of Quick Start archetype [1] and
> TCK (Viewer we used to write TCK tests). I got an issue in domain service
> representation when I was comparing the both representations.
>
> 1. In Quick Start viewer "oid" attribute is directly a child of outer
> object while in TCK viewer it is put in "extensions" map
>
> 2  In Quick Start viewer "members" attribute is an array but in TCK viewer
> it is an object.
>
> What is the correct representation?
>

(2).

The "oid" attribute is not defined in the RO spec; therefore it should be
in "extensions". The quickstart viewer archetype is referencing 1.2.0
release artifacts.  This is a fix that I (guess I) did post 1.2.0 release.

~~~
More fundamentally, though, you should probably be shouldn't be using "oid"
at all; instead use "serviceId" (for domain services) or
 "domainType/instanceId" pair (for domain objects).  See section 14.4.

Also... if you find anywhere that the implementation is incorrect with
respect to the spec, please fix it in your clone of Isis and attach patch
to the ISIS ticket (as a few weeks ago).

Thx
Dan

Re: [Android Viewer]Problem in Domain Service representations

Posted by DImuthu Upeksha <di...@gmail.com>.
Hi Dan
In newTodo


   - {
      - rel: "invoke",
      - href: "
      http://localhost:8080/restful/services/toDoItems/actions/newToDo/invoke
      ",
      - method: "POST",
      - type:
      "application/json;profile="urn:org.restfulobjects/actionresult"",
      - arguments:
      {
         - description: null,
         - category: null,
         - dueBy: null
         }
      },

In to do items

   - {
      - rel: "modify",
      - href: "
      http://localhost:8080/restful/objects/objstore.jdo.todo.ToDoItemsJdo:1
      ",
      - method: "PUT",
      - type:
      "application/json;profile="urn:org.restfulobjects/domainobject"",
      - arguments:
      {
         - members:
         [
            -
            {
               - id: "id",
               - memberType: "property",
               - value: "toDoItems",
               - disabledReason: "Always disabled"
               }
            ]
         }
      }

Yes. both arguments attributes are maps. But the value of those maps are
different types (one has an array and one has just null values). As you
said I'm also thinking of generic representation but I couldn't figure out
a way to do this. You mentioned about "downcasting". Can you please provide
some examples how to do this?

Thanx
Dimuthu


On Wed, Jul 10, 2013 at 9:23 AM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:

> Sorry, Dimuthu, I must be being thick, but I can't see any "arguments"
> attribute for any of the links in
> http://localhost:8080/restful/services/toDoItems .
>
> In http://localhost:8080/restful/services/toDoItems/actions/newToDo there
> is indeed an "arguments" attribute for the invoke link, I see that as:
>
> {
>   rel: "urn:org.restfulobjects:rels/invoke",
>   href: "
> http://localhost:8080/restful/services/toDoItems/actions/newToDo/invoke",
>   method: "POST",
>   type:
> "application/json;profile="urn:org.restfulobjects:repr-types/action-result"",
>   arguments: {
>     description: {
>       value: null
>     },
>     category: {
>       value: null
>     },
>     dueBy: {
>       value: null
>    },
>    cost: {
>       value: null
>     }
>    }
> }
>
> This looks correct to me. The arguments attribute is a map of values.
> Those values will be somewhat generic; indeed in the C# applib I called it
> GenericRepr, I think.  You'll need to provide some sort of "downcasting"
> utility (the CastAs<X> or As<X> method) so that a GenericRepr can be cast
> to either a scalar repr or to a LinkRepr depending on what the value of the
> "value" attribute is.
>
> The Isis RO applib also uses Jackson, so I imagine you could probably
> borrow some of that code.
>
> Anyway, if you can you show me some JSON samples where you are stuck, I'll
> try to comment further.
>
> Dan
>
>
>
> On 10 July 2013 16:29, DImuthu Upeksha <di...@gmail.com> wrote:
>
>> Thank you Dan.
>>
>> I use Jackson to wrap json objects to representation classes. I got an
>> issue in writing "LinkRepr" class.
>> http://localhost:8080/restful/services/toDoItems
>> http://localhost:8080/restful/services/toDoItems/actions/newToDo
>>
>> Both has a link in "links" attribute which has "arguments" attribute. But
>> types of "arguments" attribute are different (Object and Map).
>>
>> This is my ListRepr class
>>
>> https://github.com/DImuthuUpe/ISIS_Android_Viewer/blob/master/Android_Viewer/src/com/dimuthuupeksha/viewer/android/applib/representation/Link.java
>>
>> This only supports for "toDoItems". What I need to know is, what is the
>> data type I can put instead of "public Map<String, List<
>> ArgumentNodeForLink>> arguments;" to make "arguments" variable
>> compatible to both two cases?
>>
>> Thnx
>> Dimuthu
>>
>>
>>
>> On Wed, Jul 10, 2013 at 7:41 AM, Dan Haywood <
>> dan@haywood-associates.co.uk> wrote:
>>
>>> It should be a map (object)... see RO Spec 14.4, and the subsections
>>> 14.4.1, 14.4.2, 14.4.3.
>>>
>>> I think this was in the last release (isis-core-1.2.0, 31 May 2013).
>>>  Perhaps the quickstart archetype is running against the previous version
>>> (isis-core-1.1.0, 31 Jan 2013).
>>>
>>> Dan
>>>
>>>
>>>
>>> On 10 July 2013 15:35, DImuthu Upeksha <di...@gmail.com>wrote:
>>>
>>>> Thank you Dan
>>>>
>>>> What about the problem of "members" attribute? One has a representation
>>>> of an object and the other one has an array representation. I have marked
>>>> it in the attachment.
>>>>
>>>> Thanx
>>>> Dimuthu
>>>>
>>>>
>>>> On Wed, Jul 10, 2013 at 7:12 AM, Dan Haywood <
>>>> dan@haywood-associates.co.uk> wrote:
>>>>
>>>>>
>>>>> On 10 July 2013 10:20, DImuthu Upeksha <di...@gmail.com>wrote:
>>>>>
>>>>>>
>>>>>> For my testing purposes I use RO viewers of Quick Start archetype [1]
>>>>>> and TCK (Viewer we used to write TCK tests). I got an issue in domain
>>>>>> service representation when I was comparing the both representations.
>>>>>>
>>>>>> 1. In Quick Start viewer "oid" attribute is directly a child of outer
>>>>>> object while in TCK viewer it is put in "extensions" map
>>>>>>
>>>>>> 2  In Quick Start viewer "members" attribute is an array but in TCK
>>>>>> viewer it is an object.
>>>>>>
>>>>>> What is the correct representation?
>>>>>>
>>>>>
>>>>> (2).
>>>>>
>>>>> The "oid" attribute is not defined in the RO spec; therefore it should
>>>>> be in "extensions". The quickstart viewer archetype is referencing 1.2.0
>>>>> release artifacts.  This is a fix that I (guess I) did post 1.2.0 release.
>>>>>
>>>>> ~~~
>>>>> More fundamentally, though, you should probably be shouldn't be using
>>>>> "oid" at all; instead use "serviceId" (for domain services) or
>>>>>  "domainType/instanceId" pair (for domain objects).  See section 14.4.
>>>>>
>>>>> Also... if you find anywhere that the implementation is incorrect with
>>>>> respect to the spec, please fix it in your clone of Isis and attach patch
>>>>> to the ISIS ticket (as a few weeks ago).
>>>>>
>>>>> Thx
>>>>> Dan
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Regards
>>>>
>>>> W.Dimuthu Upeksha
>>>> Undergraduate
>>>> Department of Computer Science And Engineering
>>>>
>>>> University of Moratuwa, Sri Lanka
>>>>
>>>
>>>
>>
>>
>> --
>> Regards
>>
>> W.Dimuthu Upeksha
>> Undergraduate
>> Department of Computer Science And Engineering
>>
>> University of Moratuwa, Sri Lanka
>>
>
>


-- 
Regards

W.Dimuthu Upeksha
Undergraduate
Department of Computer Science And Engineering

University of Moratuwa, Sri Lanka

Re: [Android Viewer]Problem in Domain Service representations

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Sorry, Dimuthu, I must be being thick, but I can't see any "arguments"
attribute for any of the links in
http://localhost:8080/restful/services/toDoItems .

In http://localhost:8080/restful/services/toDoItems/actions/newToDo there
is indeed an "arguments" attribute for the invoke link, I see that as:

{
  rel: "urn:org.restfulobjects:rels/invoke",
  href: "
http://localhost:8080/restful/services/toDoItems/actions/newToDo/invoke",
  method: "POST",
  type:
"application/json;profile="urn:org.restfulobjects:repr-types/action-result"",
  arguments: {
    description: {
      value: null
    },
    category: {
      value: null
    },
    dueBy: {
      value: null
   },
   cost: {
      value: null
    }
  }
}

This looks correct to me. The arguments attribute is a map of values.
Those values will be somewhat generic; indeed in the C# applib I called it
GenericRepr, I think.  You'll need to provide some sort of "downcasting"
utility (the CastAs<X> or As<X> method) so that a GenericRepr can be cast
to either a scalar repr or to a LinkRepr depending on what the value of the
"value" attribute is.

The Isis RO applib also uses Jackson, so I imagine you could probably
borrow some of that code.

Anyway, if you can you show me some JSON samples where you are stuck, I'll
try to comment further.

Dan



On 10 July 2013 16:29, DImuthu Upeksha <di...@gmail.com> wrote:

> Thank you Dan.
>
> I use Jackson to wrap json objects to representation classes. I got an
> issue in writing "LinkRepr" class.
> http://localhost:8080/restful/services/toDoItems
> http://localhost:8080/restful/services/toDoItems/actions/newToDo
>
> Both has a link in "links" attribute which has "arguments" attribute. But
> types of "arguments" attribute are different (Object and Map).
>
> This is my ListRepr class
>
> https://github.com/DImuthuUpe/ISIS_Android_Viewer/blob/master/Android_Viewer/src/com/dimuthuupeksha/viewer/android/applib/representation/Link.java
>
> This only supports for "toDoItems". What I need to know is, what is the
> data type I can put instead of "public Map<String, List<
> ArgumentNodeForLink>> arguments;" to make "arguments" variable compatible
> to both two cases?
>
> Thnx
> Dimuthu
>
>
>
> On Wed, Jul 10, 2013 at 7:41 AM, Dan Haywood <dan@haywood-associates.co.uk
> > wrote:
>
>> It should be a map (object)... see RO Spec 14.4, and the subsections
>> 14.4.1, 14.4.2, 14.4.3.
>>
>> I think this was in the last release (isis-core-1.2.0, 31 May 2013).
>>  Perhaps the quickstart archetype is running against the previous version
>> (isis-core-1.1.0, 31 Jan 2013).
>>
>> Dan
>>
>>
>>
>> On 10 July 2013 15:35, DImuthu Upeksha <di...@gmail.com>wrote:
>>
>>> Thank you Dan
>>>
>>> What about the problem of "members" attribute? One has a representation
>>> of an object and the other one has an array representation. I have marked
>>> it in the attachment.
>>>
>>> Thanx
>>> Dimuthu
>>>
>>>
>>> On Wed, Jul 10, 2013 at 7:12 AM, Dan Haywood <
>>> dan@haywood-associates.co.uk> wrote:
>>>
>>>>
>>>> On 10 July 2013 10:20, DImuthu Upeksha <di...@gmail.com>wrote:
>>>>
>>>>>
>>>>> For my testing purposes I use RO viewers of Quick Start archetype [1]
>>>>> and TCK (Viewer we used to write TCK tests). I got an issue in domain
>>>>> service representation when I was comparing the both representations.
>>>>>
>>>>> 1. In Quick Start viewer "oid" attribute is directly a child of outer
>>>>> object while in TCK viewer it is put in "extensions" map
>>>>>
>>>>> 2  In Quick Start viewer "members" attribute is an array but in TCK
>>>>> viewer it is an object.
>>>>>
>>>>> What is the correct representation?
>>>>>
>>>>
>>>> (2).
>>>>
>>>> The "oid" attribute is not defined in the RO spec; therefore it should
>>>> be in "extensions". The quickstart viewer archetype is referencing 1.2.0
>>>> release artifacts.  This is a fix that I (guess I) did post 1.2.0 release.
>>>>
>>>> ~~~
>>>> More fundamentally, though, you should probably be shouldn't be using
>>>> "oid" at all; instead use "serviceId" (for domain services) or
>>>>  "domainType/instanceId" pair (for domain objects).  See section 14.4.
>>>>
>>>> Also... if you find anywhere that the implementation is incorrect with
>>>> respect to the spec, please fix it in your clone of Isis and attach patch
>>>> to the ISIS ticket (as a few weeks ago).
>>>>
>>>> Thx
>>>> Dan
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Regards
>>>
>>> W.Dimuthu Upeksha
>>> Undergraduate
>>> Department of Computer Science And Engineering
>>>
>>> University of Moratuwa, Sri Lanka
>>>
>>
>>
>
>
> --
> Regards
>
> W.Dimuthu Upeksha
> Undergraduate
> Department of Computer Science And Engineering
>
> University of Moratuwa, Sri Lanka
>

Re: [Android Viewer]Problem in Domain Service representations

Posted by DImuthu Upeksha <di...@gmail.com>.
Thank you Dan.

I use Jackson to wrap json objects to representation classes. I got an
issue in writing "LinkRepr" class.
http://localhost:8080/restful/services/toDoItems
http://localhost:8080/restful/services/toDoItems/actions/newToDo

Both has a link in "links" attribute which has "arguments" attribute. But
types of "arguments" attribute are different (Object and Map).

This is my ListRepr class
https://github.com/DImuthuUpe/ISIS_Android_Viewer/blob/master/Android_Viewer/src/com/dimuthuupeksha/viewer/android/applib/representation/Link.java

This only supports for "toDoItems". What I need to know is, what is the
data type I can put instead of "public Map<String, List<ArgumentNodeForLink
>> arguments;" to make "arguments" variable compatible to both two cases?

Thnx
Dimuthu



On Wed, Jul 10, 2013 at 7:41 AM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:

> It should be a map (object)... see RO Spec 14.4, and the subsections
> 14.4.1, 14.4.2, 14.4.3.
>
> I think this was in the last release (isis-core-1.2.0, 31 May 2013).
>  Perhaps the quickstart archetype is running against the previous version
> (isis-core-1.1.0, 31 Jan 2013).
>
> Dan
>
>
>
> On 10 July 2013 15:35, DImuthu Upeksha <di...@gmail.com> wrote:
>
>> Thank you Dan
>>
>> What about the problem of "members" attribute? One has a representation
>> of an object and the other one has an array representation. I have marked
>> it in the attachment.
>>
>> Thanx
>> Dimuthu
>>
>>
>> On Wed, Jul 10, 2013 at 7:12 AM, Dan Haywood <
>> dan@haywood-associates.co.uk> wrote:
>>
>>>
>>> On 10 July 2013 10:20, DImuthu Upeksha <di...@gmail.com>wrote:
>>>
>>>>
>>>> For my testing purposes I use RO viewers of Quick Start archetype [1]
>>>> and TCK (Viewer we used to write TCK tests). I got an issue in domain
>>>> service representation when I was comparing the both representations.
>>>>
>>>> 1. In Quick Start viewer "oid" attribute is directly a child of outer
>>>> object while in TCK viewer it is put in "extensions" map
>>>>
>>>> 2  In Quick Start viewer "members" attribute is an array but in TCK
>>>> viewer it is an object.
>>>>
>>>> What is the correct representation?
>>>>
>>>
>>> (2).
>>>
>>> The "oid" attribute is not defined in the RO spec; therefore it should
>>> be in "extensions". The quickstart viewer archetype is referencing 1.2.0
>>> release artifacts.  This is a fix that I (guess I) did post 1.2.0 release.
>>>
>>> ~~~
>>> More fundamentally, though, you should probably be shouldn't be using
>>> "oid" at all; instead use "serviceId" (for domain services) or
>>>  "domainType/instanceId" pair (for domain objects).  See section 14.4.
>>>
>>> Also... if you find anywhere that the implementation is incorrect with
>>> respect to the spec, please fix it in your clone of Isis and attach patch
>>> to the ISIS ticket (as a few weeks ago).
>>>
>>> Thx
>>> Dan
>>>
>>>
>>>
>>
>>
>> --
>> Regards
>>
>> W.Dimuthu Upeksha
>> Undergraduate
>> Department of Computer Science And Engineering
>>
>> University of Moratuwa, Sri Lanka
>>
>
>


-- 
Regards

W.Dimuthu Upeksha
Undergraduate
Department of Computer Science And Engineering

University of Moratuwa, Sri Lanka

Re: [Android Viewer]Problem in Domain Service representations

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
It should be a map (object)... see RO Spec 14.4, and the subsections
14.4.1, 14.4.2, 14.4.3.

I think this was in the last release (isis-core-1.2.0, 31 May 2013).
 Perhaps the quickstart archetype is running against the previous version
(isis-core-1.1.0, 31 Jan 2013).

Dan



On 10 July 2013 15:35, DImuthu Upeksha <di...@gmail.com> wrote:

> Thank you Dan
>
> What about the problem of "members" attribute? One has a representation of
> an object and the other one has an array representation. I have marked it
> in the attachment.
>
> Thanx
> Dimuthu
>
>
> On Wed, Jul 10, 2013 at 7:12 AM, Dan Haywood <dan@haywood-associates.co.uk
> > wrote:
>
>>
>> On 10 July 2013 10:20, DImuthu Upeksha <di...@gmail.com>wrote:
>>
>>>
>>> For my testing purposes I use RO viewers of Quick Start archetype [1]
>>> and TCK (Viewer we used to write TCK tests). I got an issue in domain
>>> service representation when I was comparing the both representations.
>>>
>>> 1. In Quick Start viewer "oid" attribute is directly a child of outer
>>> object while in TCK viewer it is put in "extensions" map
>>>
>>> 2  In Quick Start viewer "members" attribute is an array but in TCK
>>> viewer it is an object.
>>>
>>> What is the correct representation?
>>>
>>
>> (2).
>>
>> The "oid" attribute is not defined in the RO spec; therefore it should be
>> in "extensions". The quickstart viewer archetype is referencing 1.2.0
>> release artifacts.  This is a fix that I (guess I) did post 1.2.0 release.
>>
>> ~~~
>> More fundamentally, though, you should probably be shouldn't be using
>> "oid" at all; instead use "serviceId" (for domain services) or
>>  "domainType/instanceId" pair (for domain objects).  See section 14.4.
>>
>> Also... if you find anywhere that the implementation is incorrect with
>> respect to the spec, please fix it in your clone of Isis and attach patch
>> to the ISIS ticket (as a few weeks ago).
>>
>> Thx
>> Dan
>>
>>
>>
>
>
> --
> Regards
>
> W.Dimuthu Upeksha
> Undergraduate
> Department of Computer Science And Engineering
>
> University of Moratuwa, Sri Lanka
>

Re: [Android Viewer]Problem in Domain Service representations

Posted by DImuthu Upeksha <di...@gmail.com>.
Thank you Dan

What about the problem of "members" attribute? One has a representation of
an object and the other one has an array representation. I have marked it
in the attachment.

Thanx
Dimuthu


On Wed, Jul 10, 2013 at 7:12 AM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:

>
> On 10 July 2013 10:20, DImuthu Upeksha <di...@gmail.com> wrote:
>
>>
>> For my testing purposes I use RO viewers of Quick Start archetype [1] and
>> TCK (Viewer we used to write TCK tests). I got an issue in domain service
>> representation when I was comparing the both representations.
>>
>> 1. In Quick Start viewer "oid" attribute is directly a child of outer
>> object while in TCK viewer it is put in "extensions" map
>>
>> 2  In Quick Start viewer "members" attribute is an array but in TCK
>> viewer it is an object.
>>
>> What is the correct representation?
>>
>
> (2).
>
> The "oid" attribute is not defined in the RO spec; therefore it should be
> in "extensions". The quickstart viewer archetype is referencing 1.2.0
> release artifacts.  This is a fix that I (guess I) did post 1.2.0 release.
>
> ~~~
> More fundamentally, though, you should probably be shouldn't be using
> "oid" at all; instead use "serviceId" (for domain services) or
>  "domainType/instanceId" pair (for domain objects).  See section 14.4.
>
> Also... if you find anywhere that the implementation is incorrect with
> respect to the spec, please fix it in your clone of Isis and attach patch
> to the ISIS ticket (as a few weeks ago).
>
> Thx
> Dan
>
>
>


-- 
Regards

W.Dimuthu Upeksha
Undergraduate
Department of Computer Science And Engineering

University of Moratuwa, Sri Lanka