Package cz.muni.fi.pa165.ddtroops.entities

Examples of cz.muni.fi.pa165.ddtroops.entities.Skill


    public Squad getSquad(){

        Race race = getRace();
        raceDao.create(race);

        Skill skill = getSkill();
        skillDao.create(skill);

        Hero leader = getHero(race, skill);
        heroDao.create(leader);
View Full Code Here


        return leader;
    }

    public Skill getSkill(){
    Skill skill = new Skill();
        skill.setDescription("Skillerx");
        skill.setName("DescSkillerx");
        skill.setMinXP(50L);
        skill.setProfession("Proff");
        return skill;
    }
View Full Code Here

    public void testGetAll(){
        squad = getSquad();
        Race race = getRace();
        raceDao.create(race);

        Skill skill = getSkill();
        skillDao.create(skill);

        Hero leader = getHero(race, skill);
        heroDao.create(leader);
View Full Code Here

    @Test
    public void testAddMember(){
        Race race = getRace();
        Squad squadS = getSquad();
        Skill skill = getSkill();
        Hero leader = getHero(race, skill);

        raceDao.create(race);
        skillDao.create(skill);;
        squadDAO.create(squadS);
View Full Code Here

    }

    @Test
    public void testRemoveMember(){
        Race race = getRace();
        Skill skill = getSkill();
        Hero leader = getHero(race, skill);

        squad = new Squad();
        squad.getMembers().add(leader);
        squad.setLeader(leader);
View Full Code Here

        return leader;
    }

    public Skill getSkill(){
    Skill skill = new Skill();
        skill.setDescription("Skillerx");
        skill.setName("DescSkillerx");
        skill.setMinXP(50L);
        skill.setProfession("Proff");
        return skill;
    }
View Full Code Here

        verify(mockDao).getById(skill.getId());
    }

    @Test
    public void testGetAll(){
        Skill skill2 = new EntityBuilder<Skill>(Skill.class)
                .withProperty("Name", "Umeni ohne")
                .withProperty("Description", "druhe nejsilnejsi kouzlisko")
                .withProperty("Profession", "RUMburak")
                .withProperty("minXP", 0L)
                .Build();
View Full Code Here

    private List<BookTO> listSelectedBook = new ArrayList();

    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() {
                BorrowService borrowService = (BorrowService) ApplicationContextProvider.getApplicationContext().getBean("borrowService");
                if (borrow.getBorrowID() == null) {
                    borrow.setBorrowDate(new Date(System.currentTimeMillis()));
                    Calendar cal = Calendar.getInstance();
                    cal.setTime(new Date(System.currentTimeMillis()));
                    cal.add(Calendar.MONTH, 1); // add 1 month 
                    borrow.setExpirationDate(cal.getTime());
                    if (selectedBook != null) {
                        listSelectedBook.add(selectedBook);
                    }
                    if (selectedBook2 != null) {
                        listSelectedBook.add(selectedBook2);
                    }
                    if (selectedBook3 != null) {
                        listSelectedBook.add(selectedBook3);
                    }
                    if (selectedBook4 != null) {
                        listSelectedBook.add(selectedBook4);
                    }
                    if (selectedBook5 != null) {
                        listSelectedBook.add(selectedBook5);
                    }
                    if (selectedBook6 != null) {
                        listSelectedBook.add(selectedBook6);
                    }
                    for (int i = 0; i < listSelectedBook.size(); i++) {
                        for (int j = i + 1; j < listSelectedBook.size(); j++) {
                            if (listSelectedBook.get(i).equals(listSelectedBook.get(j))) {
                                listSelectedBook.remove(listSelectedBook.get(j));
                                j--;
                            }
                        }
                    }
                    borrow.setTitlesTO(listSelectedBook);
                    borrowService.createBorrow(borrow);
                }
                setResponsePage(ShowAllBorrow.class);
            }
        };
        add(form);

        List<ReaderTO> readers = readerService.findAllReaders();
        DropDownChoice choiceReaders = new DropDownChoice("reader", new PropertyModel(borrow, "readerTO"), readers);
        form.add(choiceReaders);

        List<BookTO> books = bookService.findAllAvailableBooks();

        DropDownChoice choiceBooks = new DropDownChoice("title", new PropertyModel(this, "selectedBook"), books);
        form.add(choiceBooks);
        DropDownChoice choiceBooks2 = new DropDownChoice("title2", new PropertyModel(this, "selectedBook2"), books);
        form.add(choiceBooks2);
View Full Code Here

    private static final List<State> STATES = Arrays.asList(State.values());
    private static final List<Genre> GENRES = Arrays.asList(Genre.values());
   
    public EditBook(final PageParameters parameters) {
  super(parameters);
        BookService bookService = (BookService) ApplicationContextProvider.getApplicationContext().getBean("bookService");
        StringValue bookId = parameters.get("bookId");
        if (bookId.isEmpty()) {
           book = new BookTO();
           add(new Label("titleMessage", new Model("Create book")));
        } else {
            book = bookService.findBookById(bookId.toLong());
            add(new Label("titleMessage", new Model("Edit book")));
        }
       
        Form<?> form = new Form("form") {
            @Override
            protected void onSubmit() {
                BookService bookService = (BookService) ApplicationContextProvider.getApplicationContext().getBean("bookService");
                if (book.getId() == null) {
                    book.setAvailability(Available.AVAILABLE);
                    bookService.createBook(book);
                } else {
                    bookService.updateBook(book);
                }
                setResponsePage(ShowAllBook.class);
            }
        };
        add(form);
View Full Code Here

  super(parameters);
       
        // DELETE ITEM
        StringValue bookId = parameters.get("bookId");
        if (!bookId.isEmpty()) {
            BookService bookService = (BookService) ApplicationContextProvider.getApplicationContext().getBean("bookService");
            bookService.deleteBook(bookService.findBookById(bookId.toLong()));
            setResponsePage(ShowAllBook.class);
        }
       
       BookService bookService = (BookService) ApplicationContextProvider.getApplicationContext().getBean("bookService");
       RepeatingView repeating = new RepeatingView("repeating");
       add(repeating);      
      
       for (BookTO book : bookService.findAllBooks()) {
            AbstractItem item = new AbstractItem(repeating.newChildId());
            PageParameters pageParameters = new PageParameters();
            pageParameters.add("bookId", book.getId());
            item.add(new BookmarkablePageLink<Void>("edit", EditBook.class, pageParameters));
            item.add(new BookmarkablePageLink<Void>("delete", ShowAllBook.class, pageParameters));
View Full Code Here

TOP

Related Classes of cz.muni.fi.pa165.ddtroops.entities.Skill

Copyright © 2018 www.massapicom. 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.