Xpages: most efficient way to recalculate application scope variables -
i have app in need display counts, ticket totals, number of tickets open/closed, number of tickets of type x,y,z.
would use application.scope calculate , store these totals, update them when changes (like new or changed doc).
how go doing this?
here link related question posted: xpages: count of values in multi-value field in view. looks need. clarification, however.
the api has listeners database , document. confused, wouldn't want use document listener? want capture changes 1 type document.
i not sure why have produce functionality, must not understanding something. add 2 listeners have in post.
public list<enumevent> geteventtypes() { arraylist<enumevent> eventlist = new arraylist<enumevent>(); eventlist.add(events.after_create_document); eventlist.add(events.after_update_document); return eventlist; }
then add code:
public boolean eventhappened(idominoevent event) { try { if (event.getevent().equals(events.after_create_document)) { // , return true if successful; } if (event.getevent().equals(events.after_update_document)) { // , return true if successful; } return false; // went wrong, maybe enumevent not implemented } catch (exception e) { return false; } }
and in //do call method java class (initapp) called computetotals, , method loads applicationscope.whatever variables.
what missing?
openntf domino api has concept of databaselisteners
can assigned database
, hook save()
, createdocument()
methods. so, basically, when createdocument()
or save()
called, runs custom code in listener.
you'll need reproduce functionality. however, because applicationscope
available xpages code, work xpages code.
for backend code, update "profile" document and, on each of xpages pages, check if last modified time document later last time applicationscope
retrieved values it. way include backend creates / saves. however, you'll need update everywhere creates / saves relevant documents.
Comments
Post a Comment