List baskets = this.basketManager.getBaskets();
PortalService service = null;
try {
service = (PortalService)this.manager.lookup(PortalService.ROLE);
LinkService linkService = service.getComponentManager().getLinkService();
XMLUtils.startElement(this.xmlConsumer, "basket-admin");
if ( baskets.size() > 0 ) {
XMLUtils.startElement(this.xmlConsumer, "baskets");
for(int i=0; i<baskets.size();i++) {
BasketManager.BasketDescription item = (BasketManager.BasketDescription)baskets.get(i);
XMLUtils.startElement(this.xmlConsumer, "basket");
XMLUtils.startElement(this.xmlConsumer, "id");
XMLUtils.data(this.xmlConsumer, item.id);
XMLUtils.endElement(this.xmlConsumer, "id");
XMLUtils.startElement(this.xmlConsumer, "size");
XMLUtils.data(this.xmlConsumer, String.valueOf(item.size));
XMLUtils.endElement(this.xmlConsumer, "size");
Event event = new CleanBasketEvent(item.id);
XMLUtils.startElement(this.xmlConsumer, "remove-url");
XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(event));
XMLUtils.endElement(this.xmlConsumer, "remove-url");
event = new ShowBasketEvent(item.id);
XMLUtils.startElement(this.xmlConsumer, "show-url");
XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(event));
XMLUtils.endElement(this.xmlConsumer, "show-url");
XMLUtils.endElement(this.xmlConsumer, "basket");
}
XMLUtils.endElement(this.xmlConsumer, "baskets");
}
Event e;
e = new RefreshBasketEvent();
XMLUtils.startElement(this.xmlConsumer, "refresh-url");
XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(e));
XMLUtils.endElement(this.xmlConsumer, "refresh-url");
e = new CleanBasketEvent();
XMLUtils.startElement(this.xmlConsumer, "clean-url");
XMLUtils.data(this.xmlConsumer, linkService.getLinkURI(e));
XMLUtils.endElement(this.xmlConsumer, "clean-url");
XMLUtils.endElement(this.xmlConsumer, "basket-admin");
} catch (ServiceException se) {
throw new SAXException("Unable to lookup portal service.", se);