Package org.encuestame.persistence.domain.security

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


     * @param request
     * @return
     */
    @RequestMapping(value = "/feed/{username}/project.atom", method = RequestMethod.GET)
    public String projectAtom(@PathVariable String username, Model model, HttpServletRequest request) {
        final UserAccount secUserSecondary = findByUsername(username);
        if(secUserSecondary != null){
            try {
                model.addAttribute("items", this.getEntryAtomFeed(username, request, "projects", rssDisplayItems));
            } catch (EnMeExpcetion e) {
                log.error(e);
View Full Code Here


     * @param request request
     * @return
     */
    @RequestMapping(value = "/feed/{username}/project.rss", method = RequestMethod.GET)
    public String projectRss(@PathVariable String username, Model model, HttpServletRequest request) {
        final UserAccount secUserSecondary = findByUsername(username);
        if(secUserSecondary != null){
             try {
                model.addAttribute("items", this.getItemRssFeed(username, request, "projects", rssDisplayItems));
             } catch (EnMeNoResultsFoundException e) {
                 log.error(e);
View Full Code Here

     * Fetch user account currently logged.
     * @return
     * @throws EnMeNoResultsFoundException
     */
    public UserAccount getUserAccount() throws EnMeNoResultsFoundException{
        final UserAccount account = this.getByUsername(this.getUserPrincipalUsername());
        if (account == null) {
            log.fatal("user session not found ");
            throw new EnMeNoResultsFoundException("user not found");
        }
        return account;
View Full Code Here

    /**
     * Get logged {@link UserAccount}.
     * @return {@link UserAccount}.
     */
    public UserAccount getUserAccountonSecurityContext(){
        UserAccount account = null;
        final EnMeUserAccountDetails details = getSecurityDetails();
        if (details != null) {
            account = details.getUserAccount();
            if (log.isDebugEnabled()) {
                log.debug("info logged user account: "+account);
                if (account != null) {
                    log.debug("info logged user account: "+ account.getUserEmail());
                    log.debug("info logged user account: "+ account.getUsername());
                    log.debug("info logged user account: "+ account.getUid());
                }
            }
        }
        return account;
    }
View Full Code Here

     * @throws ServletException
     * @throws IOException
     */
    //@Test
    public void testGetHashTagButtonStats() throws ServletException, IOException{
        UserAccount userAcc= getSpringSecurityLoggedUserAccount();
        //1-  Create Tag, Question and TweetPoll
        final Date creationDate = new Date();

        /* HashTag **/
        final HashTag hashtag1 = createHashTag("romantic");

        /* Question **/
        final Question question = createQuestion("What is your favorite type of movies?", "");

        /* TweetPoll **/
        final TweetPoll myTweetPoll = createPublishedTweetPoll(question, userAcc);

        /* Poll **/
        final Poll myPoll = createPoll(creationDate, question, userAcc, Boolean.TRUE, Boolean.TRUE);

        /* Survey **/
        final Survey mySurvey = createDefaultSurvey(userAcc.getAccount(), "My First Encuestame Survey", creationDate);

        // 2- Add HashTag to TweetPoll, Poll or Survey
        myTweetPoll.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(myTweetPoll);

View Full Code Here

        private TweetPollSwitch tpswitch;

        @Before
        public void initMVc() {
            final UserAccount userAccount = createUserAccount("jota", createAccount());
            createFakesTweetPoll(userAccount);
            final TweetPoll tp1 = (TweetPoll) getHibernateTemplate().find("from TweetPoll").get(0);
            final Question q1 = tp1.getQuestion();
            final QuestionAnswer a1 = createQuestionAnswer("yes", q1, "12345");
            final QuestionAnswer a2 = createQuestionAnswer("no", q1, "12346");
View Full Code Here

     * Test confirmation account
     * @throws Exception
     */
    @Test
    public void testConfirmAccountController() throws Exception {
        final UserAccount userAcc = createUserAccount("jhonsmith", createAccount());
        userAcc.setInviteCode("15D27P495M");
        getAccountDao().saveOrUpdate(userAcc);
        request = new MockHttpServletRequest(MethodJson.GET.toString(),
                "/user/confirm/email/"+userAcc.getInviteCode());
        final ModelAndView mav = handlerAdapter.handle(request, response,
                signupController);
        assertViewName(mav, "user/confirm/");
    }
View Full Code Here

     * Test confirm account with bad invitation code.
     * @throws Exception
     */
    @Test
    public void testAccountWithBadInvitationCodeController() throws Exception {
        final UserAccount userAcc = createUserAccount("jhonsmith", createAccount());
        userAcc.setInviteCode("15D27P495M34U");
        getAccountDao().saveOrUpdate(userAcc);
        final String badInvitationCode = "2905JP";
        request = new MockHttpServletRequest(MethodJson.GET.toString(),
                "/user/confirm/email/"+ badInvitationCode);
        final ModelAndView mav = handlerAdapter.handle(request, response,
View Full Code Here

     * Test {@link HomeController}.
     * @throws Exception
     */
    @Test
    public void testUserProfileController() throws Exception {
        final UserAccount userAcc = createUserAccount("jhonsmith", createAccount());
        request = new MockHttpServletRequest(MethodJson.GET.toString(),
                "/profile/"+ userAcc.getUsername());
        final ModelAndView mav = handlerAdapter.handle(request, response, homeController);
        assertViewName(mav, "profile/view");

        // Username  not found.
        final String badUsername = "badUser";
View Full Code Here

    /*
     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.IPollService#createPoll(java.lang.String, java.lang.String[], java.lang.Boolean, java.lang.String, java.lang.Boolean, java.util.List)
     */
    public Poll createPoll(final CreatePollBean createPollBean ) throws EnMeExpcetion {
        final UserAccount user = getUserAccount(getUserPrincipalUsername());
        final Poll pollDomain = new Poll();
        try {
            final QuestionBean questionBean = new QuestionBean();
            questionBean.setQuestionName(createPollBean.getQuestionName());
            final Question question = createQuestion(questionBean, user, QuestionPattern.CUSTOMIZABLE_SELECTION);
            if (question == null) {
                throw new EnMeNoResultsFoundException("Question not valid");
            } else if (createPollBean.getAnswers().length  == 0 ) {
                  throw new EnMeNoResultsFoundException("answers are required to create Poll");
            }
            else{
            final String hashPoll = MD5Utils.md5(RandomStringUtils.randomAlphanumeric(500));
            final CommentOptions commentOpt = CommentOptions.getCommentOption(createPollBean.getShowComments());
            final ShowResultsOptions showResultsOptions = ShowResultsOptions.getShowResults(createPollBean.getShowComments());
            pollDomain.setEditorOwner(user);
            pollDomain.setCreateDate(Calendar.getInstance().getTime());
            pollDomain.setPollHash(hashPoll);
            pollDomain.setQuestion(question);
            pollDomain.setPollCompleted(Boolean.FALSE);
            pollDomain.setHits(EnMeUtils.HIT_DEFAULT);
            pollDomain.setRelevance(EnMeUtils.RATE_DEFAULT);
            pollDomain.setLikeVote(EnMeUtils.LIKE_DEFAULT);
            pollDomain.setDislikeVote(EnMeUtils.DISLIKE_DEFAULT);
            pollDomain.setNumbervotes(EnMeUtils.VOTE_MIN);
            pollDomain.setEditorOwner(user);
            pollDomain.setOwner(user.getAccount());
            // Type of results display
            pollDomain.setShowResults(showResultsOptions);
            // Comments restrictions
            pollDomain.setShowComments(commentOpt);
            pollDomain.setPublish(Boolean.TRUE);
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.