[Building Sakai] Announcement Entitybroker and ReferenceParseable

Matthew Buckett matthew.buckett at oucs.ox.ac.uk
Thu Apr 21 09:06:15 PDT 2011


On 21 April 2011 14:37, Aaron Zeckoski <azeckoski at unicon.net> wrote:

Thanks for the pointers.

> It allows for:
> /direct/prefix/{someId}/action/....

EntityView.VIEW_SHOW

> or
> /direct/prefix/action/....

EntityView.VIEW_LIST

This confused me for a moment as the documentation, and naming state
that this is for returning a collection of entities, but it allows me
to handle that part of the URL space and returning a single entity
works fine. This is what I am now using

> /direct/announcement/{siteId}/{announcementId}
> would be handled by the standard object retrieval method and you could
> do some special handling in that method but I do not think that is
> clean or easy to maintain for someone looking at the code.

One issue was then that I was getting properties on the returned JSON of:

entityReference: "/announcement/5641323b-761a-4a4d-8761-688f4928141b"
entityURL: "http://localhost:8080/direct/announcement/5641323b-761a-4a4d-8761-688f4928141b"
entityId: "5641323b-761a-4a4d-8761-688f4928141b"

and these aren't correct as you need more information than just the
announcement ID to load the announcement. So I tried to (ab)use the
@EntityId annotation to correct these these values, but this fails
with the error message:

Illegal arguments: prefix (announcement) and id
(/announcement/msg/21b1984d-af58-43da-8583-f4adee769aa2/main/5641323b-761a-4a4d-8761-688f4928141b)
must contain only valid chars: [A-Za-z0-9\\(\\)\+\*\.\-_=,:;!~@%]

which says it doesn't like the '/'s in my ID. Adding a
getEntityReference() on my returned entity doesn't work either. Is
there anyway to correct these properties?

-- 
  Matthew Buckett
  VLE Developer, LTG, Oxford University Computing Services


More information about the sakai-dev mailing list