Package com.apress.progwt.client.domain

Examples of com.apress.progwt.client.domain.User


        } else if (fc.getType().equals("SchoolForumPost")) {
            ForumPost fp = new SchoolForumPost();
            fp.setId(fc.getId());
            gotoThread(fp, fc.getStart(), fc.isCreate());
        } else if (fc.getType().equals("User")) {
            User u = new User();
            u.setId(fc.getId());
            gotoUser(u, fc.getStart(), fc.isCreate());
        } else if (fc.getType().equals("UserForumPost")) {
            ForumPost fp = new UserForumPost();
            fp.setId(fc.getId());
            gotoThread(fp, fc.getStart(), fc.isCreate());
View Full Code Here


        String email = req.getParameter("email");

        Map model = getDefaultModel(req);

        User u = (User) model.get("user");
        invitationService.createAndSendInvitation(email, u);

        // userService.getCurrentUser()

        model
View Full Code Here

        CreateUserRequestCommand comm = (CreateUserRequestCommand) command;

        log.debug("SUBMIT " + comm.isOpenID());

        User u = userService.createUser(comm);

        invitationService.saveSignedUpUser(comm.getRandomkey(), u);

        String successStr = "Thanks " + u.getUsername()
                + " your account is setup and you're ready to login!";

        log.info("returning message " + successStr + " to "
                + getSuccessView());
View Full Code Here

    public void testBigSave() {

        School sc = schoolService.getSchoolDetails("Dartmouth College");
        assertNotNull(sc);

        User currentUser = getUser();

        assertEquals(0, currentUser.getSchoolRankings().size());

        System.out.println("currentUser " + currentUser);

        Application sap = new Application(sc);
        currentUser.addRanked(sap);

        String NAME = "Mailed";
        ProcessType processType = new ProcessType(NAME);
        currentUser.getProcessTypes().add(processType);

        ProcessValue processValue = new ProcessValue();
        sap.getProcess().put(processType, processValue);

        schoolDAO.save(currentUser);

        User savedUser = userDAO.getUserByUsername(currentUser
                .getUsername());
        assertEquals(1, savedUser.getSchoolRankings().size());

        assertEquals(9, savedUser.getProcessTypes().size());

        ProcessType savedPT = null;
        // iterate to the last one
        Iterator i = currentUser.getProcessTypes().iterator();
        while (i.hasNext()) {
            savedPT = (ProcessType) i.next();
        }
        assertEquals(NAME, savedPT.getName());

        Application savedSAP = savedUser.getSchoolRankings().get(0);

        ProcessValue savedPValue = savedSAP.getProcess().get(savedPT);

        assertNotNull(savedPValue);
        assertEquals(0.0, savedPValue.getPctComplete());
View Full Code Here

     * save instances between transactions
     *
     * @return
     */
    private User getUser() {
        User currentUser = userService.getCurrentUser();
        User savedUser = userDAO.getUserByUsernameFetchAll(currentUser
                .getUsername());
        return savedUser;
    }
View Full Code Here

    public void testBigSaveAgain() {
        log.debug("\n\nSave Again\n\n");
        School sc = schoolService.getSchoolDetails("Dartmouth College");
        assertNotNull(sc);

        User currentUser = getUser();
        assertEquals(0, currentUser.getSchoolRankings().size());

        currentUser.addRanked(new Application(sc));

        schoolDAO.save(currentUser);

        User savedUser = userDAO.getUserByUsername(currentUser
                .getUsername());
        assertEquals(1, savedUser.getSchoolRankings().size());

    }
View Full Code Here

        executeWithToken(comm, false);

        comm = new SaveSchoolRankCommand(yale, getUser(), 2);
        executeWithToken(comm, false);

        User savedUser = getUser();
        assertEquals(3, savedUser.getSchoolRankings().size());

        assertEquals(dart, savedUser.getSchoolRankings().get(0)
                .getSchool());
        assertEquals(harvard, savedUser.getSchoolRankings().get(1)
                .getSchool());
        assertEquals(yale, savedUser.getSchoolRankings().get(2)
                .getSchool());

        log.debug("\n------Re-Order--------");

        // re-order to Dart,Yale,Harvard
        comm = new SaveSchoolRankCommand(harvard, getUser(), 2);
        executeWithToken(comm, false);

        savedUser = getUser();
        assertEquals(3, savedUser.getSchoolRankings().size());

        assertEquals(dart, savedUser.getSchoolRankings().get(0)
                .getSchool());
        assertEquals(yale, savedUser.getSchoolRankings().get(1)
                .getSchool());
        assertEquals(harvard, savedUser.getSchoolRankings().get(2)
                .getSchool());

        // re-order to Harvard,Dart,Yale
        comm = new SaveSchoolRankCommand(harvard, getUser(), 0);
        executeWithToken(comm, false);

        savedUser = getUser();
        assertEquals(3, savedUser.getSchoolRankings().size());

        assertEquals(harvard, savedUser.getSchoolRankings().get(0)
                .getSchool());
        assertEquals(dart, savedUser.getSchoolRankings().get(1)
                .getSchool());
        assertEquals(yale, savedUser.getSchoolRankings().get(2)
                .getSchool());

    }
View Full Code Here

        executeWithToken(comm, false);

        comm = new SaveSchoolRankCommand(yale, getUser(), 2);
        executeWithToken(comm, false);

        User currentUser = userService.getCurrentUser();
        User savedUser = userDAO.getUserByUsername(currentUser
                .getUsername());
        assertEquals(3, savedUser.getSchoolRankings().size());

        assertEquals(dart, savedUser.getSchoolRankings().get(0)
                .getSchool());
        assertEquals(harvard, savedUser.getSchoolRankings().get(1)
                .getSchool());
        assertEquals(yale, savedUser.getSchoolRankings().get(2)
                .getSchool());

        log.debug("\n\nDo Remove\n");
        // remove middle to Dart/Yale
        RemoveSchoolFromRankCommand comm2 = new RemoveSchoolFromRankCommand(
                harvard, getUser());
        executeWithToken(comm2, false);

        savedUser = userDAO.getUserByUsername(currentUser.getUsername());
        assertEquals(2, savedUser.getSchoolRankings().size());

        assertEquals(dart, savedUser.getSchoolRankings().get(0)
                .getSchool());
        assertEquals(yale, savedUser.getSchoolRankings().get(1)
                .getSchool());

        assertEquals(0, savedUser.getSchoolRankings().get(0)
                .getSortOrder());
        assertEquals(1, savedUser.getSchoolRankings().get(1)
                .getSortOrder());
    }
View Full Code Here

        executeWithToken(comm, false);

        comm = new SaveSchoolRankCommand(yale, getUser(), 2);
        executeWithToken(comm, false);

        User savedUser = getUser();
        assertEquals(3, savedUser.getSchoolRankings().size());

        Application dartApplication = savedUser.getSchoolRankings()
                .get(0);

        assertEquals(dart, dartApplication.getSchool());

        ProcessType considering = getUser().getProcessTypes().get(0);

        ProcessValue processValue = new ProcessValue();
        Calendar d = Calendar.getInstance();
        d.set(2005, 3, 10);
        processValue.setDueDate(d.getTime());
        processValue.setPctComplete(.34);

        // re-order to Harvard,Dart,Yale
        SaveProcessCommand processComm = new SaveProcessCommand(
                dartApplication, considering, processValue);
        executeWithToken(processComm, false);

        User savedUser2 = getUser();

        Application savedDart = savedUser2.getSchoolRankings().get(0);
        ProcessValue savedValue = savedDart.getProcess().get(considering);

        assertEquals(.34, savedValue.getPctComplete());
        assertEquals(2005, savedValue.getDueDate().getYear() + 1900);
View Full Code Here

        executeWithToken(comm, false);

        comm = new SaveSchoolRankCommand(yale, getUser(), 2);
        executeWithToken(comm, false);

        User savedUser = getUser();
        assertEquals(3, savedUser.getSchoolRankings().size());

        Application dartApplication = savedUser.getSchoolRankings()
                .get(0);

        assertEquals(dart, dartApplication.getSchool());

        RatingType ratingOne = getUser().getRatingTypes().get(0);
        RatingType ratingTwo = getUser().getRatingTypes().get(1);

        SaveRatingCommand command = new SaveRatingCommand(ratingOne, 3,
                dartApplication);

        executeWithToken(command, false);

        User savedUser2 = getUser();

        Application savedDart = savedUser2.getSchoolRankings().get(0);

        assertEquals(3, savedDart.getRating(ratingOne));
        assertEquals(5, savedDart.getRating(ratingTwo));

    }
View Full Code Here

TOP

Related Classes of com.apress.progwt.client.domain.User

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.