It is my goal to put a first version (just a zip file) of the
javascript application online by the end of next week. After that I'll
create a Google code project to host it more officially.

Two remarks about the polymorphism question:

1. http://~/domainTypes/org.apache.isis.example.claims.dom.employee.Employee
would have to list all super classes (and interfaces it implements),
not all sub classes as you mention. In this example that would be the
two interfaces Claimant and Approver. I am not sure that would not
scale.

2. isAssignableFrom is a technical action without real business
meaning, so it must not be offered to end-users in the UI. Isn't that
a bit inconsistent?

3. The js application would have to call this isAssignableFrom action
right at the moment that the user tries to drop an Employee object on
a Claiment or Approver form field. Of course I could cache previous
calls to isAssignableFrom.

Conclusion: I would like to ask you to reconsider my original
suggestion (item1 in the list above)...

Johan.

On Fri, Nov 4, 2011 at 9:24 AM, Dan Haywood
<[email protected]> wrote:
> Interesting question.
>
> Rather than listing all subtypes - which I think would not scale
> particularly well - I think it would be better to have an action,
> equivalent to java.lang.Class#isAssignableFrom(java.lang.Class).  This
> would allow a client to ask whether the Employee is compatible with the
> Claimant interface.
>
> In other words:
>
> {
>  "href": "http://
> ~/types/com.mycompany.myapp.claims.Claimant/actions/isAssignableFrom/invoke",
>  "arguments": {
>    "href": "http://~/types/com.mycompany.myapp.employee.Employee";
>  }
> }
>
> Thoughts?
>
> ~~~
> Question back to you: do you intend to open source your Javascript app?
> I'd be very interested in seeing it, at any rate.
>
> Cheers
> Dan
>
>
>
>
> On 4 November 2011 07:13, Johan Andries <[email protected]> wrote:
>
>> Hi,
>>
>> in the claims example application the class
>>
>> org.apache.isis.example.claims.dom.claim.Claim
>>
>> is using the interfaces
>>
>> org.apache.isis.example.claims.dom.claim.Claimant
>> org.apache.isis.example.claims.dom.claim.Approver
>>
>> both implemented by
>>
>> org.apache.isis.example.claims.dom.employee.Employee
>>
>> The problem is now that my javascript application does not know about
>> the polymorphic relationship between the Employee class and the two
>> interfaces, so in this case I have no way of enforcing type safety in
>> the UI when invoking actions or updating properties.
>>
>> One way of solving this would be to specify all implemented interfaces
>> and superclasses for a given domain type in chapter 20 (Domain Type
>> Resource) of the restful objects spec (v0.50). For example,
>>
>> http://~/domainTypes/org.apache.isis.example.claims.dom.employee.Employee
>>
>> should list all other domain types it can act as.
>>
>> Or is there an other solution I am not aware of?
>>
>> Johan.
>>
>

Reply via email to