Package org.hoteia.qalingo.core.domain

Examples of org.hoteia.qalingo.core.domain.User


   
    public User getUserById(final Long userId, Object... params) {
        Criteria criteria = createDefaultCriteria(User.class);
        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);
        criteria.add(Restrictions.eq("id", userId));
        User user = (User) criteria.uniqueResult();
        if(user != null){
            user.setFetchPlan(fetchPlan);
        }
        return user;
    }
View Full Code Here


   
    public User getUserByCode(final String userCode, Object... params) {
        Criteria criteria = createDefaultCriteria(User.class);
        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);
        criteria.add(Restrictions.eq("code", handleCodeValue(userCode)));
        User user = (User) criteria.uniqueResult();
        if(user != null){
            user.setFetchPlan(fetchPlan);
        }
        return user;
    }
View Full Code Here

    public User getUserByLoginOrEmail(final String usernameOrEmail, Object... params) {
        Criteria criteria = createDefaultCriteria(User.class);
        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);
        criteria.add(Restrictions.or(Restrictions.eq("login", usernameOrEmail), Restrictions.eq("email", usernameOrEmail)));
        criteria.add(Restrictions.eq("active", true));
        User user = (User) criteria.uniqueResult();
        if(user != null){
            user.setFetchPlan(fetchPlan);
        }
        return user;
    }
View Full Code Here

        if (user.getId() != null) {
            if(em.contains(user)){
                em.refresh(user);
            }
            User mergedUser = em.merge(user);
            em.flush();
            return mergedUser;
        } else {
            em.persist(user);
            return user;
View Full Code Here

        requestData.setMarketAreaRetailer(getCurrentMarketAreaRetailer(requestData));
        requestData.setMarketAreaCurrency(getCurrentMarketAreaCurrency(requestData));
       
        // SPECIFIC BACKOFFICE
        if (requestData.isBackoffice()) {
            User user = getCurrentUser(request);
            if (user != null) {
                requestData.setUser(user);
            }

            Company company = getCurrentCompany(request);
View Full Code Here

    public ModelAndView userDetails(final HttpServletRequest request, final Model model) throws Exception {
        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.USER_DETAILS.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
       
        final String userCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_USER_CODE);
        final User user = userService.getUserByCode(userCode);
       
        UserViewBean userViewBean = backofficeViewBeanFactory.buildViewBeanUser(requestData, user);

        if(userViewBean == null){
            final String url = requestUtil.getLastRequestUrl(request);
            return new ModelAndView(new RedirectView(url));
        }
       
        model.addAttribute(ModelConstants.URL_BACK, backofficeUrlService.generateUrl(BoUrls.USER_LIST, requestData));
       
        request.setAttribute(ModelConstants.USER_VIEW_BEAN, userViewBean);
       
        Object[] params = {user.getLastname() + " " + user.getFirstname() + " (" + user.getLogin() + ")"};
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView,  BoUrls.USER_DETAILS.getKey(), params);

        return modelAndView;
    }
View Full Code Here

    public ModelAndView userEdit(final HttpServletRequest request, final Model model, @ModelAttribute(ModelConstants.USER_FORM) UserForm userForm) throws Exception {
        ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), BoUrls.USER_EDIT.getVelocityPage());
        final RequestData requestData = requestUtil.getRequestData(request);
       
        final String userCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_USER_CODE);
        final User user = userService.getUserByCode(userCode);
       
        UserViewBean userViewBean = backofficeViewBeanFactory.buildViewBeanUser(requestData, user);
       
        if(userViewBean == null){
            final String url = requestUtil.getLastRequestUrl(request);
            return new ModelAndView(new RedirectView(url));
        }
       
        model.addAttribute(ModelConstants.URL_BACK, backofficeUrlService.generateUrl(BoUrls.USER_DETAILS, requestData, user));
       
        request.setAttribute(ModelConstants.USER_VIEW_BEAN, userViewBean);
       
        Object[] params = {user.getLastname() + " " + user.getFirstname() + " (" + user.getLogin() + ")"};
        overrideDefaultSeoPageTitleAndMainContentTitle(request, modelAndView,  BoUrls.USER_DETAILS.getKey(), params);

        return modelAndView;
    }
View Full Code Here

        if (result.hasErrors()) {
            return userEdit(request, model, userForm);
        }
       
        final String userCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_USER_CODE);
        final User user = userService.getUserByCode(userCode);

        // Update the user
        webBackofficeService.createOrUpdateUser(user, userForm);
       
        final String urlRedirect = backofficeUrlService.generateUrl(BoUrls.USER_DETAILS, requestUtil.getRequestData(request), user);
View Full Code Here

    protected UserForm initUserForm(final HttpServletRequest request, final Model model) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
       
        final String userCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_USER_CODE);
        if(StringUtils.isNotEmpty(userCode)){
            final User userEdit = userService.getUserByCode(userCode);
            return backofficeFormFactory.buildUserForm(requestData, userEdit);
        }

        return backofficeFormFactory.buildUserForm(requestData, null);
    }
View Full Code Here

        logger.debug("Found {} users", users.size());
        return PojoUtil.mapAll(dozerBeanMapper, users, UserPojo.class);
    }

    public UserPojo getUserById(final String id) {
        User user = userService.getUserById(id);
        logger.debug("Found user {} for id {}", user, id);
        return user == null ? null : dozerBeanMapper.map(user, UserPojo.class);
    }
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.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.