Element subscriptionIdNoContent = new Element(E_SUBSCRIPTION_ID, NNSP);
contentResponse.addContent(subscriptionIdContent);
noContentResponse.addContent(subscriptionIdNoContent);
for ( int i = 0; i < subscriptionID.length; i++ ) {
// sort subscribers by the occurance of events
Subscriber subscriber = NotificationTrigger.getInstance().getSubscriber(subscriptionID[i]);
if ( subscriber != null ) {
NotificationTrigger.getInstance().refreshSubscriber(subscriber, true);
List events = subscriber.getEvents();
if ( events.size() == 0 ) {
noContent = true;
Element listener = new Element(E_LISTENER);
listener.addContent(String.valueOf(subscriber.getId()));
subscriptionIdNoContent.addContent(listener);
} else {
content = true;
Element listener = new Element(E_LISTENER);
listener.addContent(String.valueOf(subscriber.getId()));
subscriptionIdContent.addContent(listener);
for ( Iterator j = events.iterator(); j.hasNext(); ) {
EventObject event = (EventObject)j.next();
if ( event instanceof RemoteInformation ) {
Element eventElement = new Element(E_EVENT, NNSP);
String[][] information = ((RemoteInformation)event).getInformation();
for ( int k = 0; k < information.length; k++ ) {
Element entry = new Element(E_INFORMATION, NNSP);
entry.setAttribute(A_INFORMATION_KEY, information[k][0]);
// FIXME: if the information value is a Slide URI, we
// have to add the slideContext
// FIXME: this should be generalized
if ("uri".equals(information[k][0])) {
entry.addContent(
getSlideContextPath() +
String.valueOf(information[k][1]));
} else {
entry.addContent(String.valueOf(information[k][1]));
}
eventElement.addContent(entry);
}
subscriptionIdContent.addContent(eventElement);
}
}
subscriber.clearEvents();
}
}
}
if ( content ) {
multistatus.addContent(contentResponse);