Package org.jayasoft.woj.common.model

Examples of org.jayasoft.woj.common.model.User


    public ActionForward orderGift(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        ActionsHelper.rememberPage(request, "/fidelity/orderGift");
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            return ActionsHelper.loginForwardName();
                        }

                        Long giftId = Long.valueOf(request.getParameter(Params.FIDELITY_OFFERS.ORDER_OFFER.PARAMS.OFFER_ID));
View Full Code Here


   
    public ActionForward spreadWOJ(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            return ActionsHelper.loginForwardName();
                        }
                       
                        if (!userLogged.isMailVerified()) {
                            addWOJMessages(request, RessourceBundleApplicationMessage.info("woj.page.user.points.email.not.verified", new Object[] {request.getContextPath()}));
                            return "show.user.points";
                        }
                       
                        ClearableDynaValidatorActionForm f = (ClearableDynaValidatorActionForm)form;
                        String email = (String)f.get(Params.FIDELITY_OFFERS.SHOW_USER_POINTS.SPREAD_WOJ.PARAMS.EMAILS);
                        String message = (String)f.get(Params.FIDELITY_OFFERS.SHOW_USER_POINTS.SPREAD_WOJ.PARAMS.MESSAGE);
                       
                        message = message.replaceAll(System.getProperty("line.separator"), "<br />");
                        Portal.getInstance().getMailService().asyncSendMail(Portal.getInstance().getMailFactory().createSpreadWOJMail(userLogged, email, message));
                        LOGGER.info("sent spread mail from " + userLogged.getEmail() + " to " + email);
                       
                        addWOJMessages(request, RessourceBundleApplicationMessage.info("woj.page.user.points.spread.woj.message-sent", new Object[] {email}));
                       
                        request.removeAttribute(Params.FIDELITY_OFFERS.SHOW_USER_POINTS.SPREAD_WOJ.PARAMS.EMAILS);
                        request.removeAttribute(Params.FIDELITY_OFFERS.SHOW_USER_POINTS.SPREAD_WOJ.PARAMS.MESSAGE);
View Full Code Here

        a.setObject("promotion");
       
        String userID = request.getParameter(Params.MODULES.PROMOTE.PARAMS.USER_ID);
        String module = request.getParameter(Params.MODULES.PROMOTE.PARAMS.MODULE);
       
        User u = ServiceFactory.getUserService().getUserById(userID);
        if (u != null) {
            ServiceFactory.getFidelityService().promotion(u, module);
        }

        XMLResponseHelper.writeXMLResponse(response, a);
View Full Code Here

        t.execute(
            new HibernateCallback() {
                public Object doInHibernate(Session s) throws HibernateException, SQLException {
                    for (Iterator itIds = userIds.iterator(); itIds.hasNext();) {
                        Long id = (Long)itIds.next();
                        User u = (User)s.get(getHandledClass(), id);
                        s.delete(u);
                    }
                    return null;
                }
            }
View Full Code Here

            Long since = Long.valueOf((sinceStr==null)?"-1":sinceStr);
           
            User[] foundUsers = DaoFactory.getUserDao().findUpdatedUsers(since);
            User[] uSend = new User[foundUsers.length];
            for (int i = 0; i < foundUsers.length; i++) {
                 uSend[i] = new User();
                 BeanHelper.copy(foundUsers[i], uSend[i], User.class);
                 if (foundUsers[i].getGroup() != null) {
                     Group g = new Group();
                     BeanHelper.copy(foundUsers[i].getGroup(), g, Group.class);
                     uSend[i].setGroup(g);
View Full Code Here

                            User[] users = searchUsers(newRequest, fromIdx, howMany);
                            request.setAttribute(Params.USER_ADMIN.EXECUTE_ACTION.REQUEST.USERS_LIST, users);
                            request.getSession().setAttribute(Params.USER_ADMIN.EXECUTE_ACTION.SESSION.USERS_ID_LIST, TransformerUtils.transform(Arrays.asList(users), new fr.jayasoft.commons.lang.Transformer() {
                                public Object transform(Object input) {
                                    if (input instanceof User) {
                                        User u = (User)input;
                                        return new Long(u.getId());
                                    }
                                    return null;
                                }
                            }));
                            request.getSession().setAttribute(Params.USER_ADMIN.EXECUTE_ACTION.SESSION.REQUEST, newRequest);
View Full Code Here

                        m.setContent((String)request.getParameter(Params.USER_ADMIN.MAIL_CONTENT));
                        m.setSubject((String)request.getParameter(Params.USER_ADMIN.MAIL_SUBJECT));
                       
                        for (Iterator iter = s.iterator(); iter.hasNext();) {
                            Long id = (Long)iter.next();
                            User u = ServiceFactory.getUserService().getUserById(id.toString());
                            m.setTo(new String[] {u.getEmail()});
                            Portal.getInstance().getMailService().silentSendMail(m);
                        }
                        return null;
                    }
                }
View Full Code Here

  public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    if(!ActionsHelper.isAdmin(request)) {
      return ActionsHelper.homepageForward();
    }
        String stUserLogin = (String)request.getParameter(Params.USER_ADMIN.EDITED_USER_LOGIN);
        User user = (User)Portal.getInstance().getUserService().getUser(stUserLogin);
        if (privateUpdate(user, request)) {
          Portal.getInstance().getUserService().update(user);
        }
        return users(mapping, form, request, response);
    }
View Full Code Here

        return new SecuredActionTemplate(mapping, form, request, response).execute(
                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                        ActionsHelper.rememberPage(request, "/showRepository");
                       
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                       
                        if (userLogged==null) {
                            LOGGER.debug("user try to access repository page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }
                       
                        UAK uak = null;
                        try {
                            uak = getUserUAK(userLogged, request);   
                        } catch (Exception e) {
                            LOGGER.warn("user cannot be connected due to", e);
                        }
                       
                        if (uak==null) {
                            // not identified on master
                            return "repository.show.error";
                        } else {
                            Visibility v = uak.getPublishVisibilityRight();
                            List visibilities = new ArrayList(Arrays.asList(Visibility.getVisibilitiesUpTo(v)));
                            if (userLogged.getGroup() == null) {
                                visibilities.remove(Visibility.PRIVATE);
                            }
                            request.setAttribute(Params.REPOSITORY.SHOW.REQUEST.VISIBILITIES, visibilities);
                           
                            DynaActionForm f = (DynaActionForm)form;
                            String choosenVisibilityString = f.getString(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY);
                            String compare = f.getString(Params.REPOSITORY.SHOW.FORM.COMPARE);
                            String order = f.getString(Params.REPOSITORY.SHOW.FORM.ORDER);
                            boolean desc = ORDER_DESC.equals(order);
                           
                            if (StringUtils.isBlank(compare)) {
                                compare = NO_COMPARATOR_NAME;
                            }
                           
                            Visibility choosenVisibility;
                            if (StringUtils.isBlank(choosenVisibilityString)) {
                                choosenVisibility = v;
                            } else {
                                choosenVisibility = Visibility.fromString(choosenVisibilityString);
                            }
                            f.set(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY, choosenVisibility.getName());
                            request.setAttribute(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY, choosenVisibility.getName());
                           
                            ServerServicesProvider userSSP = (ServerServicesProvider)request.getSession().getAttribute(Params.GENERAL.REQUEST.USER_SSP);
                           
                            AreaInfo info = new AreaInfoImpl();
                            AreaInfo[] orgInfos = null;
                            List orgs = Collections.EMPTY_LIST;
                            if (userLogged.getGroup() != null) {
                                try {
                                    info = userSSP.getModuleManagementService().getAreaInfo(new Long(userLogged.getGroup().getId()), choosenVisibility);
                                    orgInfos = userSSP.getModuleManagementService().getAllAreaInfo(new Long(userLogged.getGroup().getId()), choosenVisibility, null, null);
                                   
                                    orgs = Arrays.asList(orgInfos);
                                    Collections.sort(orgs, getComparator(compare, desc));
                                } catch (org.jayasoft.woj.common.services.ServiceException e) {
                                    LOGGER.warn("cannot retrieve organisations", e);
View Full Code Here

                new AbstractActionCall(){
                    public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                       
                        ActionsHelper.rememberPage(request, "/showRepository");
                       
                        User userLogged = (User)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
                        if (userLogged==null) {
                            LOGGER.debug("user try to access repository page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }
                       
                        DynaActionForm f = (DynaActionForm)form;
                        String organisation = request.getParameter(Params.REPOSITORY.SHOW_BY_ORG.PARAMS.ORGANISATION);
                        String visibility = request.getParameter(Params.REPOSITORY.SHOW_BY_ORG.PARAMS.CHOOSEN_VISIBILITY);
                       
                        f.set(Params.REPOSITORY.SHOW_BY_ORG.FORM.ORGANISATION, organisation);
                        f.set(Params.REPOSITORY.SHOW_BY_ORG.FORM.CHOOSEN_VISIBILITY, visibility);
                        request.setAttribute(Params.REPOSITORY.SHOW.FORM.CHOOSEN_VISIBILITY, visibility);
                       
                        String compare = f.getString(Params.REPOSITORY.SHOW.FORM.COMPARE);
                        String order = f.getString(Params.REPOSITORY.SHOW.FORM.ORDER);
                        boolean desc = ORDER_DESC.equals(order);
                       
                        if (StringUtils.isBlank(compare)) {
                            compare = NO_COMPARATOR_NAME;
                        }
                       
                        Visibility v = Visibility.fromString(visibility);
                       
                        ServerServicesProvider userSSP = (ServerServicesProvider)request.getSession().getAttribute(Params.GENERAL.REQUEST.USER_SSP);
                       
                        AreaInfo[] modInfos = null;
                        List mods = Collections.EMPTY_LIST;
                        try {
                            modInfos = userSSP.getModuleManagementService().getAllAreaInfo(new Long(userLogged.getGroup().getId()), v, organisation, null);

//                            orgs = Arrays.asList(userSSP.getContentService().getOrganisations(choosenVisibility, null));
                            mods = Arrays.asList(modInfos);
                            Collections.sort(mods, getComparator(compare, desc));
                        } catch (org.jayasoft.woj.common.services.ServiceException e) {
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.model.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.