item.removeBundle(bundle);
@Override public void delete(Context context, Bundle bundle) throws SQLException, AuthorizeException, IOException { log.info(LogManager.getHeader(context, "delete_bundle", "bundle_id=" + bundle.getID())); authorizeService.authorizeAction(context, bundle, Constants.DELETE); context.addEvent(new Event(Event.DELETE, Constants.BUNDLE, bundle.getID(), bundle.getName(), getIdentifiers(context, bundle))); // Remove bitstreams List<Bitstream> bitstreams = bundle.getBitstreams(); bundle.clearBitstreams(); for (Bitstream bitstream : bitstreams) { removeBitstream(context, bundle, bitstream); } List<Item> items = new LinkedList<>(bundle.getItems()); bundle.getItems().clear(); for (Item item : items) { item.removeBundle(bundle); } // Remove ourself bundleDAO.delete(context, bundle); }
item.removeBundle(bundle);