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.
>