/** * Updates an entry * * @param id The ID of the Entry to update */ public static void editEntry(long id) throws EntryDoesNotExistException { Entry ent = null; try { ent = WinebookDAO.getEntry(id); WinebookDAO.editEntry(ent); } catch (DAException e) { throw new EntryDoesNotExistException(e); } }
/** * Adds a photo to an entry * * @param id The ID of the entry to add the photo to * @param p The Photo to add to the entry */ public static void addPhoto(long id, Photo p) { Entry ent = null; try { ent = WinebookDAO.getEntry(id); ent.addPhoto(p); WinebookDAO.editEntry(ent); } catch (DAException e) { // TODO } }
/** * Removes a wine from an entry * * @param entryid The ID of the entry to remove the wine from * @param w The wine to remove from the entry */ public static void removeWine(long entryid, Wine w) { Entry ent = null; try { ent = WinebookDAO.getEntry(entryid); ent.removeWine(w); WinebookDAO.editEntry(ent); } catch (DAException e) { // TODO } }
/** * Add an entry to a Winebook * * @param id The ID of the wine */ public static void addEntry(Entry ent) throws EntryDoesExistException { try { WinebookDAO.addEntry(ent); } catch (DAException e) { throw new EntryDoesExistException(e); } }
public static Vector<Entry> getAllEntries(long userID) { try { return WinebookDAO.getAllEntries(userID); } catch (DAException e) { // TODO return new Vector<Entry>(); } }
/** * Returns an entry by ID * * @param id The ID of the entry * @return The entry corresponding to the id */ public static Entry getEntry(long id) throws EntryDoesNotExistException { Entry ent = null; try { ent = WinebookDAO.getEntry(id); } catch (DAException e) { throw new EntryDoesNotExistException(e); } return ent; }
/** * Removes an entry from the database * * @param id The ID of the entry to remove * @return True if the remove operation was successful */ public static boolean removeEntry(long id) { return WinebookDAO.deleteEntry(id); }