Package org.encuestame.persistence.domain.security

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


            final String email = this.convertSocialConnectedAccountToBean(social.getSocialUserProfile()).getEmail();
            log.info("sign in social account email -->"+email);
            String redirectPath =  "signin/provider/register";
            Assert.notNull(email);
            //user account by email
            final UserAccount accountEmail = getAccountDao().getUserByEmail(email);
            //if the user account is new, we create new account.
            if (accountEmail == null) {
                log.debug("This email ["+email+"] never has been used.");
                //create fist connection and social account.
                final SocialAccount accountConnection = this.signUpSocial(
View Full Code Here


    private SocialAccount signUpSocial(
            final SocialUserProfile profile,
            final AccessGrant accessGrant,
            final SocialProvider provider,
            final UserAccount account) throws EnMeNoResultsFoundException{
        UserAccount accountEmail;
        if (account == null) {
            //create new account.
            accountEmail = getSecurityOperations().singupUser(this.convertSocialConnectedAccountToBean(profile), false);
        } else {
            //use the current account.
View Full Code Here

    /**
     * Get {@link UserAccount}. Authentication.
     */
    public Authentication getUserAuthentication() {
        if (userAuthentication == null) {
            UserAccount account = this.accountDaoImp.getUserAccountById(connection.getAccount().getUid());
            log.debug("Get User Authentication "+account);
            return this.authenticationTokenFor(account);
        }
        return userAuthentication;
    }
View Full Code Here

            //filter data
            data = filterValue(data);
            if (type.equals(Profile.EMAIL.toString())) {
                //TODO: review pattern email format validator.
                log.debug("update email");
                final UserAccount account = getSecurityService().getUserAccount(getUserPrincipalUsername());
                if (operations.validateUserEmail(data, account)) {
                    security.updateAccountProfile(Profile.EMAIL, data);
                    setSuccesResponse();
                } else {
                    listError.put(type, getMessage("e_005", request, null));
                }
            } else if(type.equals(Profile.USERNAME.toString())) {
                log.debug("update username");
                final UserAccount account = getSecurityService().getUserAccount(getUserPrincipalUsername());
                if (operations.validateUsername(data, account)) {
                    security.updateAccountProfile(Profile.USERNAME, data);
                    setSuccesResponse(getMessage("settings_config_profile_success", request, null));
                } else {
                    listError.put(type, getMessage("e_018", request, null));
View Full Code Here

            HttpServletResponse response) throws JsonGenerationException,
            JsonMappingException, IOException {
        try {
            final SecurityOperations security = getSecurityService();
            // get the user account of previous user logged.
            final UserAccount account = getUserAccount();
            final ValidateOperations operations = new ValidateOperations(security);
            final HashMap<String, Object> listError = new HashMap<String, Object>();
            //filter values.
            log.debug("email " +email);
            log.debug("username " +username);
View Full Code Here

                model.put("url", EnMeUtils.createUrlPollAccess(domain, poll));
            } else if (TypeSearchResult.HASHTAG.equals(typeItem)) {
                //FUTURE:
                model.put("url", "");
            } else if (TypeSearchResult.PROFILE.equals(typeItem)) {
                final UserAccount user = getSecurityService().getUserbyId(itemId);
                model.put("url", domain + "/profile/" + user.getUsername());
            }
            text = VelocityEngineUtils.mergeTemplateIntoString(
                    velocityEngine, CODE_TEMPLATES  + embeddedType.toString().toLowerCase() +"_code.vm", "utf-8", model);
            String string = new String(text.getBytes("UTF-8"));
            embebedBody.setBody(string);
View Full Code Here

                // generate hashtag body
                model.put("hellow", "world");
                text = VelocityEngineUtils.mergeTemplateIntoString(
                        velocityEngine, HTML_TEMPLATES + "/hashtag.vm", "utf-8", model);
            } else if (TypeSearchResult.PROFILE.equals(typeItem)) {
                final UserAccount user = getSecurityService().getUserbyId(pollId);
                model.put("owner_picture", domain + "/picture/profile/" + user.getUsername() + "/thumbnail");
                model.put("editorOwner", user);
                model.put("profile", user.getUsername());
                model.put("owner_profile_url", domain + "/profile/" + user.getUsername());
                model.put("picture", getPictureService().getProfilePicture(user.getUsername(), PictureType.DEFAULT));
                model.put("total_tweets", getFrontService().getTotalItemsPublishedByType(user, Boolean.TRUE, TypeSearchResult.TWEETPOLL));
                model.put("total_poll",  getFrontService().getTotalItemsPublishedByType(user, Boolean.TRUE, TypeSearchResult.POLL));
                model.put("total_survey",  getFrontService().getTotalItemsPublishedByType(user, Boolean.TRUE, TypeSearchResult.SURVEY));
                final List<HomeBean> lastPublication = getFrontService().getLastItemsPublishedFromUserAccount(
                        user.getUsername(),
                        max_results,
                        Boolean.FALSE,
                        request);
                if (lastPublication.size() >= 1) {
                    model.put("last_publication", lastPublication.get(0));
View Full Code Here

    @RequestMapping(value = "/api/status-notifications.json", method = RequestMethod.GET)
    public @ResponseBody ModelMap status(
            HttpServletRequest request,
            HttpServletResponse response) throws JsonGenerationException, JsonMappingException, IOException {
        final Map<String, Object> responseJson = new HashMap<String, Object>();
        UserAccount userAccount;
        try {
            userAccount = getByUsername(getUserPrincipalUsername());
            if (userAccount != null) {
                final Long totalNot = getNotificationDao().retrieveTotalNotificationStatus(userAccount.getAccount());
                final Long totalNewNot = getNotificationDao().retrieveTotalNotReadedNotificationStatus(userAccount.getAccount());
                responseJson.put("t", totalNot);
                responseJson.put("n", totalNewNot);
                setItemResponse(responseJson);
            } else {
                setError("account not valid", response);
View Full Code Here

    @RequestMapping(value = "/api/notifications/list.json", method = RequestMethod.GET)
    public @ResponseBody ModelMap get(
            @RequestParam(value = "limit") Integer limit,
            HttpServletRequest request,
            HttpServletResponse response) throws JsonGenerationException, JsonMappingException, IOException {
         UserAccount secondary;
        try {
             secondary = getByUsername(getUserPrincipalUsername());
             if (secondary == null){
                 setError("account not valid", response);
             }
View Full Code Here

            } else {
                final SurveySection section = getSurveyService()
                        .retrieveSurveySectionById(sectionId);
                final QuestionPattern questionPattern = QuestionPattern
                        .getQuestionPattern(pattern);
                final UserAccount account = getUserAccount();
                final Question questionAdded = getSurveyService().addQuestionToSurveySection(question,
                        account, section,
                        questionPattern, null);
                final Map<String, Object> jsonResponse = new HashMap<String, Object>();
                jsonResponse.put("newQuestion", questionAdded);
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.