@DELETE @Path("event") public Report deleteAllEvent() { int previousRows = eventFacade.count(); eventFacade.removeAll(); int currentRows = eventFacade.count(); int affectedRows = previousRows - currentRows; Report stat = new Report(currentRows); stat.setAffectedRows(affectedRows); stat.setPreviousRows(previousRows); return stat; }
/** * For test purpose only * * @return * @throws org.tmf.dsmapi.commons.exceptions.UnknownResourceException */ @DELETE public Report deleteAll() throws UnknownResourceException { eventFacade.removeAll(); int previousRows = productInventoryFacade.count(); productInventoryFacade.removeAll(); List<Product> pis = productInventoryFacade.findAll(); for (Product pi : pis) { delete(pi.getId()); } int currentRows = productInventoryFacade.count(); int affectedRows = previousRows - currentRows; Report stat = new Report(currentRows); stat.setAffectedRows(affectedRows); stat.setPreviousRows(previousRows); return stat; }