Examples of BorrowTO


Examples of cz.muni.fi.pa165.library.api.BorrowTO

        BorrowService borrowService = (BorrowService) ApplicationContextProvider.getApplicationContext().getBean("borrowService");
       
        // RETURN BORROW
        StringValue borrowId = parameters.get("borrowId");
        if (!borrowId.isEmpty()) {
            BorrowTO borrow = borrowService.findBorrowByID(borrowId.toLong());
            borrowService.returnBooks(borrow, borrow.getTitlesTO());
            setResponsePage(ShowAllBorrow.class);
        }
       
        // EXTEND BORROW
        StringValue extend = parameters.get("extend");
        if (!extend.isEmpty()) {
            BorrowTO borrow = borrowService.findBorrowByID(extend.toLong());
           
            Calendar cal = Calendar.getInstance()
            cal.setTime(borrow.getExpirationDate())
            cal.add(Calendar.MONTH, 1); // add 1 month 

            borrow.setExpirationDate(cal.getTime());            
            borrowService.updateExpirationDate(borrow, borrow.getExpirationDate());
            setResponsePage(ShowAllBorrow.class);
        }

        RepeatingView repeating = new RepeatingView("repeating");
       
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
       
        for (BorrowTO borrow : borrowService.findAllBorrows()) {
            AbstractItem item = new AbstractItem(repeating.newChildId());
            PageParameters pageParameters = new PageParameters();
            pageParameters.add("borrowId", borrow.getBorrowID());
            PageParameters pageParameters2 = new PageParameters();
            pageParameters2.add("extend", borrow.getBorrowID());
            item.add(new BookmarkablePageLink<Void>("extend", ShowAllBorrow.class, pageParameters2));
            item.add(new BookmarkablePageLink<Void>("return", ShowAllBorrow.class, pageParameters));
            item.add(new Label("reader", borrow.getReaderTO().toString()));
            if (borrow.getTitlesTO().size() > 0) {
                item.add(new Label("title", borrow.getTitlesTO().toString()));     
            } else {
                item.add(new Label("title", new Model("[RETURNED]")));
            }
            item.add(new Label("borrowdate", dateFormat.format(borrow.getBorrowDate())));
            item.add(new Label("expirationdate", dateFormat.format(borrow.getExpirationDate())));
            repeating.add(item);
       }
       
       add(repeating);
      
View Full Code Here

Examples of cz.muni.fi.pa165.library.api.BorrowTO

    public AddBorrow(final PageParameters parameters) {
        super(parameters);
        ReaderService readerService = (ReaderService) ApplicationContextProvider.getApplicationContext().getBean("readerService");
        final BookService bookService = (BookService) ApplicationContextProvider.getApplicationContext().getBean("bookService");

        borrow = new BorrowTO();

        Form<?> form;
        form = new Form("form") {
            @Override
            protected void onSubmit() {
View Full Code Here

Examples of cz.muni.fi.pa165.library.api.BorrowTO

        if (borrow.getTitles() != null) {
            for (Book book : borrow.getTitles()) {
                titleTOList.add(DTOConvertor.convertBookEntityToTO(book));
            }
        }
        BorrowTO borrowTO = new BorrowTO(DTOConvertor.convertReaderEntityToTO(borrow.getReader()),
                titleTOList, borrow.getBorrowDate(), borrow.getExpirationDate());
        borrowTO.setBorrowID(borrow.getBorrowID());
        return borrowTO;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.