Package org.encuestame.persistence.domain.security

Examples of org.encuestame.persistence.domain.security.UserAccount


        tweetPollDomain.setCompleted(Boolean.FALSE);
        tweetPollDomain.setCaptcha(tweetPollBean.getCaptcha());
        tweetPollDomain.setAllowLiveResults(tweetPollBean.getAllowLiveResults());
        tweetPollDomain.setLimitVotes(tweetPollBean.getLimitVotes());
        tweetPollDomain.setLimitVotesEnabled((tweetPollBean.getLimitVotesEnabled()));
        UserAccount acc = null;
        try {
            acc = getUserAccount(getUserPrincipalUsername());
        } catch (EnMeNoResultsFoundException e) {
           log.error("User not found");
        }
        tweetPollDomain.setTweetOwner(acc.getAccount());
        tweetPollDomain.setEditorOwner(getUserAccountonSecurityContext());
        tweetPollDomain.setResultNotification(tweetPollBean.getResultNotification());
        tweetPollDomain.setPublishTweetPoll(Boolean.FALSE);
        tweetPollDomain.setRelevance(EnMeUtils.RATE_DEFAULT);
        tweetPollDomain.setHits(EnMeUtils.VOTE_DEFAULT);
View Full Code Here


        log.debug("new Project createProject "+projectBean);
        log.debug("new Project username "+username);
        if (projectBean != null) {
            try {
                final Project projectDomain = new Project();
                final UserAccount secondary = getAccountDao().getUserAccountById(projectBean.getLeader());
                final Account user = getUserAccount(username).getAccount();
                projectDomain.setProjectDateFinish(projectBean.getDateFinish());
                projectDomain.setProjectDateStart(projectBean.getDateInit());
                log.debug("new Project Leader "+projectBean.getName());
                projectDomain.setProjectDescription(projectBean.getDescription());
                projectDomain.setProjectName(projectBean.getName());
                projectDomain.setProjectInfo(projectBean.getProjectInfo());
                projectDomain.setHideProject(projectBean.getHide());
                projectDomain.setNotifyMembers(projectBean.getNotify());
                log.debug("Project Leader "+projectBean.getLeader());
                if(projectBean.getLeader() != null){
                    projectDomain.setLead(secondary);
                }
                projectDomain.setUsers(user);
                getProjectDaoImp().saveOrUpdate(projectDomain);
                projectBean.setId(projectDomain.getProyectId());
                log.debug("created domain project");
                createNotification(NotificationEnum.PROJECT_CREATED, secondary.getUsername() +" is the leader of this project.", user);
            }
            catch (Exception e) {
                log.error(e.getMessage());
                throw new EnMeExpcetion(e);
            }
View Full Code Here

        final Project project = getProjectDaoImp().getProjectbyId(projectBean.getId());
        if(project == null){
            throw new EnMeExpcetion("project not found");
        }
        else{
            final UserAccount secondary = getAccountDao().getUserAccountById(projectBean.getLeader());
            final Account user = getUserAccount(username).getAccount();
            project.setProjectName(projectBean.getName());
            project.setHideProject(projectBean.getHide());
            project.setLead(secondary);
            project.setNotifyMembers(projectBean.getNotify());
            project.setProjectDateFinish(projectBean.getDateFinish());
            project.setProjectDateStart(projectBean.getDateInit());
            project.setProjectDescription(projectBean.getDescription());
            project.setProjectInfo(projectBean.getProjectInfo());
            //project.setProjectStatus(projectBean.get)
            project.setPriority(Priority.valueOf(projectBean.getPriority()));
            project.setPublished(projectBean.getPublished());
            getProjectDaoImp().saveOrUpdate(project);
            createNotification(NotificationEnum.PROJECT_UPDATED, secondary.getUsername() +" is the leader of "+projectBean.getName(), user);
        }
    }
View Full Code Here

     * @throws EnMeGenericException
     */
    public byte[] getProfilePicture(final String username, final PictureType pictureType) throws IOException, EnMeGenericException {
        log.trace("getProfilePicture "+username);
        log.trace("getProfilePicture "+pictureType.toString());
        final UserAccount user = getUserAccount(username);
        if (user.getPictureSource().equals(PictureSource.UPLOADED)) {
            return this.getProfilePicture(pictureType, user);
        } else if (user.getPictureSource().equals(PictureSource.GRAVATAR)) {
            return this.getGravatarPicture(user.getUserEmail(), pictureType);
        } else {
            return this.getGravatarPicture(user.getUserEmail(), pictureType);
        }
    }
View Full Code Here

     * Test findUserByUserName.
     */
    @Category(DefaultTest.class)
    @Test
    public void testfindUserByUserName() {
        final UserAccount secondary = this.securityService
                .findUserByUserName(this.userAccount.getUsername());
        assertEquals(this.userAccount.getUid(), secondary.getUid());
        assertEquals(this.userAccount.getPassword(),
                secondary.getPassword());
        assertEquals(this.userAccount.getCompleteName(),
                secondary.getCompleteName());
    }
View Full Code Here

     * @throws EnMeNoResultsFoundException
     */
    @Category(SlowTest.class)
    @Test(timeout = 30000)
    public void testdeleteUser() throws EnMeNoResultsFoundException {
        final UserAccount tempUser = createUserAccount("second user",
                this.userPrimary);
        final Long id = tempUser.getUid();
        this.securityService.deleteUser(ConvertDomainBean
                .convertSecondaryUserToUserBean(tempUser));
        final UserAccount tempUser2 = createUserAccount("second user",
                getProperty("mail.test.email"), this.userPrimary);
        this.securityService.deleteUser(ConvertDomainBean
                .convertSecondaryUserToUserBean(tempUser2));
        assertNull(getAccountDao().getUserAccountById(id));
    }
View Full Code Here

     */
    @Category(DefaultTest.class)
    @Test(expected = EnMeNoResultsFoundException.class)
    public void testdeleteUserNotFound() throws EnMeNoResultsFoundException {
        this.securityService.deleteUser(ConvertDomainBean
                .convertSecondaryUserToUserBean(new UserAccount()));
    }
View Full Code Here

     * @throws Exception
     */
    @Category(DefaultTest.class)
    @Test
    public void testretrieveListUserUnconfirmedByAccount() throws Exception {
        final UserAccount user = createUserAccount("demoUn1", getSpringSecurityLoggedUserAccount().getAccount());
        final UserAccount user1 = createUserAccount("demoUn2", getSpringSecurityLoggedUserAccount().getAccount());
        final UserAccount user2 = createUserAccount("demoUn3", getSpringSecurityLoggedUserAccount().getAccount());
        user.setInviteCode(null);
        user1.setInviteCode(null);
        getAccountDao().saveOrUpdate(user);
        getAccountDao().saveOrUpdate(user1);
        final Integer total = securityService.retrieveListUserUnconfirmedByAccount();
        assertEquals("Should be equals", 3, total.intValue());
        user2.setInviteCode(null);
        getAccountDao().saveOrUpdate(user2);
        final Integer total2 = securityService.retrieveListUserUnconfirmedByAccount();
        assertEquals("Should be equals", 2, total2.intValue());
    }
View Full Code Here

     *             EnMeExpcetion
     */
    @Category(DefaultTest.class)
    @Test
    public void testSearchUserByUsername() throws EnMeExpcetion {
        final UserAccount userDomain = createUserAccount("user 1",
                this.userPrimary);
        createUserAccount("user 2", this.userPrimary);
        final UserAccountBean userBean = securityService
                .searchUserByUsername(userDomain.getUsername());
        assertEquals("Should be equals", userDomain.getUsername(),
                userBean.getUsername());
    }
View Full Code Here

     *             exception
     */
    @Category(DefaultTest.class)
    @Test
    public void testDeleteUser() throws EnMeExpcetion {
        final UserAccount secUsers = createUserAccount("administrator",
                this.userPrimary);
        final Long idUser = secUsers.getUid();
        // final String username = secUsers.getUsername();
        final UserAccountBean user = ConvertDomainBean
                .convertSecondaryUserToUserBean(secUsers);
        securityService.deleteUser(user);
        final Account userRetrieve = getAccountDao().getUserById(idUser);
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.security.UserAccount

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.