public boolean saveCheckOutRecord() { // save data into stream this.member.checkout(copy, LocalDate.now(), dateDue); DataAccess da = new DataAccessFacade(); da.updateMember(this.member); return true; }
/** Looks up book by isbn to see if it exists, throw exceptioni. Else add the book to storage */ @Override public boolean addBook(String isbn, String title, int maxCheckoutLength, List<Author> authors) throws LibrarySystemException { Book book = new Book(isbn, title, maxCheckoutLength, authors); DataAccess da = new DataAccessFacade(); da.saveNewBook(book); return false; }
@Override public List<Author> getAllAuthors() { DataAccess da = new DataAccessFacade(); HashMap<String, Author> authors = da.readAuthorMap(); List<Author> authorList = new ArrayList<>(); for (Author a : authors.values()) { authorList.add(a); } return authorList; }
/** * This method checks if memberId already exists -- if so, it cannot be added as a new member, and * an exception is thrown. If new, creates a new LibraryMember based on input data and uses * DataAccess to store it. */ @Override public void addNewMember( String memberId, String firstName, String lastName, String telNumber, Address addr) throws LibrarySystemException { DataAccess dataAccess = new DataAccessFacade(); HashMap<String, LibraryMember> map = dataAccess.readMemberMap(); if (map.containsKey(memberId)) { throw new LibrarySystemException("Member already exists"); } dataAccess.saveNewMember(new LibraryMember(firstName, lastName, telNumber, addr, memberId)); }
@Override public void login(String id, String password) throws LoginException { DataAccess da = new DataAccessFacade(); HashMap<String, User> map = da.readUserMap(); if (!map.containsKey(id)) { throw new LoginException("ID " + id + " not found"); } String passwordFound = map.get(id).getPassword(); if (!passwordFound.equals(password)) { throw new LoginException("Passord does not match password on record"); } currentAuth = map.get(id).getAuthorization(); }
@Override public boolean addBookCopy(String isbn) throws LibrarySystemException { Book book = searchBook(isbn); if (book == null) throw new LibrarySystemException( "No book with isbn " + isbn + " is in the library collection!"); book.addCopy(); DataAccess da = new DataAccessFacade(); da.saveNewBook(book); return true; }
public void searchBook() { // System.out.println("Books "); DataAccess access = new DataAccessFacade(); Book b = access.searchBook(txtSearch.getText()); List<Book> bookList = new ArrayList<Book>(); bookList.add(b); if (b != null) { // System.out.println(b.getIsbn()); // tblDataView.setItems(FXCollections.observableArrayList(b)); isbn.setCellValueFactory(new PropertyValueFactory<>("isbn")); title.setCellValueFactory(new PropertyValueFactory<>("title")); tblDataView.getItems().setAll(bookList); } }
@Override public Author searchAuthor(String author) { DataAccess da = new DataAccessFacade(); return da.searchAuthor(author); }
@Override public Book searchBook(String isbn) { DataAccess da = new DataAccessFacade(); return da.searchBook(isbn); }
/** * Reads data store for a library member with specified id. Ids begin at 1001... Returns a * LibraryMember if found, null otherwise * * @throws LibrarySystemException */ @Override public LibraryMember search(String memberId) throws LibrarySystemException { DataAccess da = new DataAccessFacade(); return da.searchMember(memberId); }
@Override public HashMap<String, LibraryMember> getAllCheckoutEntries() { DataAccess data = new DataAccessFacade(); return data.readMemberMap(); }
public void setPublication(String pubTitle, String issueNumber) { this.pub = dataAccess.getPeriodical(issueNumber, pubTitle); }
public void setPublication(String bookISBN) { this.pub = dataAccess.getBookByISBN(bookISBN); }