Package com.apress.progwt.client.domain

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


        executeWithToken(comm, false);

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

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

        Application harvardApplication = savedUser.getSchoolRankings()
                .get(1);

        assertEquals(harvard, harvardApplication.getSchool());
        assertEquals(1, harvardApplication.getSortOrder());

        // save pro/con and notes to the application
        harvardApplication.setNotes(TEXT);
        harvardApplication.getPros().add(A);
        harvardApplication.getPros().add(B);
        harvardApplication.getCons().add(C);

        SaveApplicationCommand command = new SaveApplicationCommand(
                harvardApplication);

        executeWithToken(command, false);

        User savedUser2 = getUser();

        Application savedHarvard = savedUser2.getSchoolRankings().get(1);

        assertEquals(1, savedHarvard.getSortOrder());
        assertEquals(harvard, savedHarvard.getSchool());

        assertEquals(TEXT, savedHarvard.getNotes());
        assertEquals(A, savedHarvard.getPros().get(0));
        assertEquals(B, savedHarvard.getPros().get(1));
        assertEquals(C, savedHarvard.getCons().get(0));

        // edit the original application and save again
        harvardApplication.getPros().clear();
        harvardApplication.getCons().add(B);
        harvardApplication.setNotes(C);

        SaveApplicationCommand command2 = new SaveApplicationCommand(
                harvardApplication);
        executeWithToken(command2, false);

        User savedUser3 = getUser();

        Application savedHarvard2 = savedUser3.getSchoolRankings().get(1);

        assertEquals(1, savedHarvard2.getSortOrder());
        assertEquals(harvard, savedHarvard2.getSchool());

        assertEquals(C, savedHarvard2.getNotes());
View Full Code Here


                log.debug("\n\nSave Again\n\n");
                School sc = schoolService
                        .getSchoolDetails("Adrian College");
                assertNotNull(sc);

                User currentUser = getUser();
                assertNotNull(currentUser);

                ForumPost fp = new SchoolForumPost(sc, currentUser,
                        TITLE, TEXT, null);
View Full Code Here

    public void testForumPostSaving() throws SiteException {
        log.debug("\n\nSave Again\n\n");
        School sc = schoolService.getSchoolDetails("Adrian College");
        assertNotNull(sc);

        User currentUser = getUser();
        assertNotNull(currentUser);

        ForumPost fp = new SchoolForumPost(sc, currentUser, TITLE, TEXT,
                null);
View Full Code Here

        executeWithToken(comm, false);

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

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

        List<User> users = schoolService.getUsersInterestedIn(jarv);
        assertEquals(1, users.size());
        assertEquals(getUser(), users.get(0));
View Full Code Here

            return new ModelAndView(getNotFoundView());
        }

        String nickname = pathParts[1];

        User fetchedUser = userService
                .getUserByNicknameFullFetch(nickname);

        if(log.isDebugEnabled()){
            log.debug("user u: " + fetchedUser);
            log.debug("isinit user " + Hibernate.isInitialized(fetchedUser));
            log.debug("isinit schools "
                    + Hibernate
                    .isInitialized(fetchedUser.getSchoolRankings()));
            for (Application sap : fetchedUser.getSchoolRankings()) {
                if(!Hibernate.isInitialized(sap)){
                    log.debug("Not initialized");
                }           
            }
        }
View Full Code Here

    }

    public void testToken() throws SiteException {
        String nullT = userService.getToken(null);

        User fetched2 = userService.getUserByNicknameFullFetch("test");
        String userT = userService.getToken(fetched2);

        assertNotNull(nullT);
        assertNotNull(userT);
        assertNotSame(nullT, userT);
View Full Code Here

        FriendsGetResponse response = (FriendsGetResponse)client.getResponsePOJO();
        List<Long> friends = response.getUid();
       
        ModelMap rtn = ControllerUtil.getModelMap(req, userService);

        User user = userService.getUserByNicknameFullFetch("test");

        rtn.addAttribute("viewUser", user);
        rtn.addAttribute("friends", friends);

        return new ModelAndView("facebook/canvas",rtn);
View Full Code Here

    }

    public void execute(CommandService commandService) {
        // Log.debug("Execute Command");

        User currentUser = commandService.get(User.class, userID);

        assertUserIsAuthenticated(currentUser);

        List<Application> rankings = currentUser.getSchoolRankings();

        // Utilities.reOrder(rankings, currentUser, rank)

        Application sap = null;

        School school = commandService.get(School.class, schoolID);

        for (Iterator iterator = rankings.iterator(); iterator.hasNext();) {
            Application scAndApp = (Application) iterator.next();

            if (scAndApp.getSchool().equals(school)) {
                sap = scAndApp;
            }
        }

        if (null == sap) {
            // Log.debug("\n----B-CREATE-NEW-SAP----\n");
            sap = new Application(school);
            commandService.save(sap);
            currentUser.addRanked(rank, sap);
        }

        // use this to set the orderProperty, since the list
        // implementation didn't work
        Utilities.reOrder(rankings, sap, rank);

        // Log.debug("Command Executed");
        // Log.debug("User " + currentUser);

        for (Application ranked : currentUser.getSchoolRankings()) {
            Log.debug("Command.Ranks To Save: Rank: " + ranked);
        }
        commandService.save(currentUser);

        this.savedApplicationID = sap.getId();
View Full Code Here

        save(inviter);
    }

    public void changePassword(String oldPassword, String newPassword) {

        User user = getCurrentUser();

        Authentication oldAuth = new UsernamePasswordAuthenticationToken(
                user.getUsername(), oldPassword);
        authMgr.authenticate(oldAuth);

        createPassWord(user, newPassword);

        log.debug("password changed, saving");
        save(user);

        log.debug("remove from cache");
        userCache.removeUserFromCache(user.getUsername());

        log.debug("change security context");
        Authentication newAuthentication = new UsernamePasswordAuthenticationToken(
                user.getUsername(), newPassword);
        authMgr.authenticate(newAuthentication);
        SecurityContextHolder.getContext().setAuthentication(
                newAuthentication);

    }
View Full Code Here

    }

    public void execute(CommandService commandService)
            throws SiteException {

        User author = commandService.get(User.class, authorID);

        commandService.assertUserIsAuthenticated(author);

        ForumTopic loadedTopic = commandService.get(forumPost
                .getTopicClass(), topicID);
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.