}
private List<Event> buildEventList(Element bundleElement, SessionInfoImpl sessionInfo, String baseUri)
throws IllegalNameException, NamespaceException, RepositoryException {
List<Event> events = new ArrayList<Event>();
ElementIterator eventElementIterator = DomUtil.getChildren(bundleElement, ObservationConstants.N_EVENT);
String userId = null;
// get user id from enclosing Atom entry element in case this was a feed
if (DomUtil.matches(bundleElement, AtomFeedConstants.N_ENTRY)) {
Element authorEl = DomUtil.getChildElement(bundleElement, AtomFeedConstants.N_AUTHOR);
Element nameEl = authorEl != null ? DomUtil.getChildElement(authorEl, AtomFeedConstants.N_NAME) : null;
if (nameEl != null) {
userId = DomUtil.getTextTrim(nameEl);
}
}
while (eventElementIterator.hasNext()) {
Element evElem = eventElementIterator.nextElement();
Element typeEl = DomUtil.getChildElement(evElem, ObservationConstants.N_EVENTTYPE);
EventType[] et = DefaultEventType.createFromXml(typeEl);
if (et.length == 0 || et.length > 1) {
// should not occur.
log.error("Ambiguous event type definition: expected one single event type.");