No, there is no event like this. The only way to have exactly the
behavior you describe would be to write a custom store which simply
extend XWikiHibernateStore and overwrite loadDocument to add whatever
values you want in it. You then declare your custom store with the
property xwiki.store.main.hint in xwiki.cfg file.

If you don't control the server side (you write some extension) other
possibilities I can think of are:

* listen to ActionExecutedEvent("view") event if that document is the
one in the request (and not some include or macro or other second
level document)
* actually store those values in the document in some scheduler or
even call XWiki REST API (or some wiki page) to update the document
from that other service which actually update these external data

On Thu, Aug 11, 2016 at 3:52 PM, Vincent Telleria
<[email protected]> wrote:
> Hello XWiki devs,
>
> I was wondering if there is an Event which gets published when an
> XWikiDocument first gets loaded, or a good way of adding such an event? I
> have been looking for such an event, but one does not appear to exist and
> to add one looks like it would require making changes to the
> XWikiHibernateStore to have it fire events on load.
>
> I am looking for a way to intercept documents when they are first being
> loaded so I can populate some of their objects from an external source and
> avoid the issue of having many joins when working with documents with a
> large number of objects. My other thought is to use a custom hibernate
> mapping to get this data for a custom table I can populate in other ways,
> but I would prefer the event driven approach.
>
> Thanks!
>
> ~Vincent
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs



-- 
Thomas Mortagne
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to