Package org.jayasoft.woj.portal.model

Examples of org.jayasoft.woj.portal.model.UserImpl


            throw e;
        }
    }
   
   protected UserImpl refreshUser(HttpServletRequest request) {
       UserImpl u = (UserImpl)request.getSession().getAttribute(Params.LOGIN.SESSION.USER);
       if (u != null) {
           u = (UserImpl)Portal.getInstance().getUserService().getUser(u.getLogin());
           if (u!=null) {
               request.getSession().setAttribute(Params.LOGIN.SESSION.USER, u);
           }
       }
       return u;
View Full Code Here


                       
                        // If we have godfather in parameter we set it
                        f.set(Params.REGISTER.USER.VALIDATE.PARAMS.GODFATHER, request.getParameter(Params.REGISTER.USER.SHOW.PARAMS.GODFATHER));

                        if (r != null) {
                          UserImpl u = (UserImpl)r.getUser();
                         
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.LOGIN, u.getLogin());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.EMAIL, u.getEmail());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.CITY, u.getCity());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.POSTAL_CODE, u.getPostalCode());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.ADRESS, u.getAdress());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.COUNTRY, u.getCountry());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.FIRSTNAME, u.getFirstName());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.LASTNAME, u.getLastName());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.COMPANY, u.getCompany());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.COMPANY_HOMEPAGE, u.getCompanyHomepage());
                            f.set(Params.REGISTER.USER.VALIDATE.PARAMS.GODFATHER, u.getGodfather());
                        }
                       
                        // Forgot Password
                        f.set(Params.REGISTER.USER.VALIDATE.PARAMS.PASSWORD_1, "");
                        f.set(Params.REGISTER.USER.VALIDATE.PARAMS.PASSWORD_2, "");
View Full Code Here

                        // Transfer info from dorm to bean
                        // If an error occured, we do not loose informations.
                        org.jayasoft.woj.portal.model.registration.Registration reg = (org.jayasoft.woj.portal.model.registration.Registration)request.getSession().getAttribute(Params.REGISTER.SESSION.CURRENT_REGISTRATION);
                        InvitationInfo invitInfo = (InvitationInfo) request.getSession().getAttribute(Params.REGISTER.SESSION.INVITATION_INFORMATION);
                       
                        UserImpl user = null;
                        if (reg != null) {
                            // Modification mode
                            user = (UserImpl)reg.getUser();
                        } else {
                            // Creation mode
                            user = new UserImpl();
                            if (invitInfo == null) {
                              reg = new org.jayasoft.woj.portal.model.registration.Registration();
                              reg.setUser(user);
                              // We remember the user for final registration
                              request.getSession().setAttribute(Params.REGISTER.SESSION.CURRENT_REGISTRATION, reg);
                            } else {
                              invitInfo.setUser(user);
                            }
                        }
                        user.setLogin(login);
                        user.setPassword(pass1);
                        user.setEmail(email);
                        user.setCountry(country);
                        user.setFirstName(fName);
                        user.setLastName(lName);
                        user.setCity(city);
                        user.setPostalCode(postalCode);
                        user.setAdress(adress);
                        user.setCompany((company==null)?"":company);
                        user.setCompanyHomepage((companyHomepage==null)?"":companyHomepage);
                        user.setGodfather(godfather);
                       
                        // Check if godfather is different from login
                        if (login.equals(godfather)) {
                            LOGGER.warn("user " + login + " try to register himself as its own godfather");
                            addWOJMessages(request, RessourceBundleApplicationMessage.error("registration.user-form.error.godfather.same.login", null));
View Full Code Here

                       
                       
                        if ("1".equals(clufAccepted)) {
                            LOGGER.debug("user has accepted the license");
                            org.jayasoft.woj.portal.model.registration.Registration r = (org.jayasoft.woj.portal.model.registration.Registration)request.getSession().getAttribute(Params.REGISTER.SESSION.CURRENT_REGISTRATION);
                            UserImpl user = (UserImpl)r.getUser();
                            user.setLastAcceptedCluf(ServiceFactory.getLicenseService().getActiveCluf());
                            strForward = "account.register.showProductFormAction";
                        } else {
                            LOGGER.debug("user has refused the license");
                            request.getSession().removeAttribute(Params.REGISTER.SESSION.CURRENT_REGISTRATION);
                            strForward = ActionsHelper.homepageForwardName();
View Full Code Here

                request.setAttribute(Params.REGISTER.PRODUCT.VALIDATE.PARAMS.TRIAL_LICENSE_DISABLE, Boolean.FALSE);
            }
        }
       
        // we set up info on registering user for enterprise license information
        UserImpl u = (UserImpl)r.getUser();
        setFormValueIfNotSet(f, Params.REGISTER.PRODUCT.VALIDATE.ENTERPRISE_FORM.ENTERPRISE_USER_FIRST_NAME, u.getFirstName());
        setFormValueIfNotSet(f, Params.REGISTER.PRODUCT.VALIDATE.ENTERPRISE_FORM.ENTERPRISE_USER_LAST_NAME, u.getLastName());
        setFormValueIfNotSet(f, Params.REGISTER.PRODUCT.VALIDATE.ENTERPRISE_FORM.ENTERPRISE_MAIL, u.getEmail());
        setFormValueIfNotSet(f, Params.REGISTER.PRODUCT.VALIDATE.ENTERPRISE_FORM.ENTERPRISE_COMPANY_NAME, u.getCompany());
        setFormValueIfNotSet(f, Params.REGISTER.PRODUCT.VALIDATE.ENTERPRISE_FORM.ENTERPRISE_COMPANY_HOMEPAGE, u.getCompanyHomepage());
    }
View Full Code Here

                                    request.setAttribute(Params.GENERAL.REQUEST.ERROR_DETAIL, e.getMessage());
                                    forward = "woj.error";
                                }
                            } else {
                                // Modifying mode
                                UserImpl modifiedUser = (UserImpl) r.getUser();
                                LOGGER.debug("Updating user "+modifiedUser);
                                ServiceFactory.getLicenseService().addPersonalLicense(modifiedUser);
                            }
                        } else if (Params.REGISTER.PRODUCT.LICENSES.COMMUNITY_LICENSE.equals(productType)) {
                            // The user chose a community license
                            if (!"true".equals(request.getParameter(Params.REGISTER.PRODUCT.VALIDATE.PARAMS.CONFIRM_COMMUNITY))) {
                                request.setAttribute(Params.REGISTER.PRODUCT.SHOW.REQUEST.ERROR, "registration.product-form.error.accept.community.conditions.required");
                                return "account.register.showProductFormAction";                                
                            }

                            String projectHome = f.getString(Params.REGISTER.PRODUCT.VALIDATE.PARAMS.COMMUNITY_PROJECT_HOME);
                            if (StringUtils.isBlank(projectHome)) {
                                request.setAttribute(Params.REGISTER.PRODUCT.SHOW.REQUEST.ERROR, "registration.product-form.error.project.home.page.required");
                                return "account.register.showProductFormAction";
                            }


                            String userId = (String)request.getSession().getAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID);
                            if (userId == null) {
                                // Creating mode
                                try {
                                    LOGGER.debug("adding user "+r.getUser()+" in DB");
                                    User newUser = ServiceFactory.getRegistrationService().registerCommunityUser(r.getUser(), projectHome);
                                    LOGGER.debug("user "+newUser+" has been registered send mail to check mail");
                                    ServiceFactory.getRegistrationService().sendEmailVerification(newUser);
                                    request.setAttribute(Params.REGISTER.FINISH.REQUEST.FINISH_OK, Boolean.TRUE);
                                    forward = "account.register.showFinishForm";
                                    request.getSession().setAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID, String.valueOf(newUser.getId()));          
                                } catch (RegistrationException e) {
                                    // Ajout de license impossible
                                    request.setAttribute(Params.GENERAL.REQUEST.ERROR_TITLE, "Community license Error");
                                    request.setAttribute(Params.GENERAL.REQUEST.ERROR_DETAIL, e.getMessage());
                                    forward = "woj.error";
                                }
                            } else {
                                // Modifying mode
                                UserImpl modifiedUser = (UserImpl) r.getUser();
                                LOGGER.debug("Updating user "+modifiedUser);
                                ServiceFactory.getLicenseService().addCommunityLicense(modifiedUser, projectHome);
                            }
                        } else {
                            LOGGER.debug("user choose a payable product");
View Full Code Here

                public String doInAction(ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServiceException {
                    DynaActionForm f = (DynaActionForm)form;
                   
                   
                    org.jayasoft.woj.portal.model.registration.Registration r = (org.jayasoft.woj.portal.model.registration.Registration)request.getSession().getAttribute(Params.REGISTER.SESSION.CURRENT_REGISTRATION);
                    UserImpl u = (UserImpl)r.getUser();
                    Purchaser p = r.getPurchaser();
                   
                    // Set Form attributes
                    if (p != null) {
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.PURCHASER_TYPE, p.getType());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.COMPANY_EEC_IDENT, p.getEECIdent());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.COMPANY_NAME, p.getCompany());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.FIRST_NAME, p.getFirstName());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.LAST_NAME, p.getLastName());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.ADRESS, p.getAdress());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.POSTAL_CODE, p.getPostalCode());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.CITY, p.getCity());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.COUNTRY, p.getCountry());
                    } else {
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.PURCHASER_TYPE, Purchaser.COMPANY);
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.COMPANY_NAME, u.getCompany());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.FIRST_NAME, u.getFirstName());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.LAST_NAME, u.getLastName());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.ADRESS, u.getAdress());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.POSTAL_CODE, u.getPostalCode());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.CITY, u.getCity());
                      ActionsHelper.setIfNotSet(f, Params.REGISTER.PURCHASER.VALIDATE.PARAMS.COUNTRY, u.getCountry());
                    }
                   
                    // Set request Attribute
                    request.setAttribute("countries", Portal.getInstance().getGeographyService().getCountries());
View Full Code Here

    Map params = new LinkedHashMap();
    params.put("login", user.getLogin());
    params.put("mail", user.getEmail());
    String license = "";
    if (user instanceof UserImpl) {
      UserImpl userImpl = (UserImpl) user;
      Set ls = userImpl.getBuyedLicenses();
      if(ls != null) {
        for (Iterator iter = ls.iterator(); iter.hasNext();) {
          License l = (License) iter.next();
          license += l.toString()+",";
        }
View Full Code Here

                            request.setAttribute("tax", PricingService.formatPrice(new Double(tax)));
                        }
                       
                        // Handle User
                        String userId = (String)request.getSession().getAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID);
                        UserImpl modifiedUser = (UserImpl) r.getUser();
                        if (userId == null) {
                            // Creating mode
                            LOGGER.debug("Creating user "+modifiedUser);
                            try {
                                modifiedUser = (UserImpl) ServiceFactory.getRegistrationService().register(modifiedUser);
                            } catch (RegistrationException e) {
                                throw new ServiceException("registration failed", e);
                            }
                            request.getSession().setAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID, String.valueOf(modifiedUser.getId()));          
                        } else {
                            // Modifying mode
                            LOGGER.debug("Updating user "+modifiedUser);
                            ServiceFactory.getUserService().update(modifiedUser);
                        }
View Full Code Here

                , ActionsHelper.downloadForwardName()
        );
    }
   
    public ActionForward registerTrialUser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
      UserImpl u = (UserImpl)DaoFactory.getUserDao().newHandledObject();
        u.setLogin(request.getParameter(PortalConstant.REGISTER.P_USER));
        u.setPassword(request.getParameter(PortalConstant.REGISTER.P_PASS));
        u.setEmail(request.getParameter(PortalConstant.REGISTER.P_EMAIL));
        u.setFirstName(request.getParameter(PortalConstant.REGISTER.P_FNAME));
        u.setLastName(request.getParameter(PortalConstant.REGISTER.P_LNAME));
        u.setCountry(request.getParameter(PortalConstant.REGISTER.P_COUNTRY));
        String hostId = request.getParameter(PortalConstant.REGISTER.P_HOSTID);
       
        Registration r = null;
        try {
            if ( StringUtils.isBlank(u.getLogin())
                    || StringUtils.isBlank(u.getPassword())
                    || StringUtils.isBlank(u.getEmail())
                    || StringUtils.isBlank(u.getFirstName())
                    || StringUtils.isBlank(u.getLastName())
                    || StringUtils.isBlank(u.getCountry())
                ) {
                r = new RegistrationError();
                ((RegistrationError)r).setCause(new RegistrationException("missing required fields or fields contain only spaces"));
            } else if (!EmailHelper.doEmailSeemsValid(u.getEmail())) {
                r = new RegistrationError();
                ((RegistrationError)r).setCause(new RegistrationException("your email seems to be invalid"));
            } else {
                User registeredUser = ServiceFactory.getRegistrationService().registerTrialUser(u, hostId);
                ServiceFactory.getRegistrationService().sendEmailVerification(registeredUser);
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.portal.model.UserImpl

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.