Package com.dotmarketing.cms.myaccount.struts

Examples of com.dotmarketing.cms.myaccount.struts.MyAccountForm


      af.setRedirect(true);
      return af;
    }

    // HttpSession session = request.getSession();
    MyAccountForm form = (MyAccountForm) lf;

    // Getting the user from the session
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();
View Full Code Here


    if (request.getSession().getAttribute(WebKeys.CMS_USER) == null) {
      return new ActionForward("/dotCMS/login");
    }

    MyAccountForm form = (MyAccountForm) lf;
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();

    if (!Validator.validate(request, lf, mapping))
      return mapping.findForward("myAccountPage");

    // Saving Personal Information

    HibernateUtil.startTransaction();

    // User user = PublicUserFactory.getUserByEmail(userEmail);
   
    UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);

    user.setFirstName(form.getFirstName());
    user.setLastName(form.getLastName());

    userProxy.setOrganization(form.getOrganization());
    userProxy.setWebsite(form.getWebsite());
    userProxy.setMailSubscription(form.isMailSubscription());
    userProxy.setPrefix(form.getPrefix());
    userProxy.setSuffix(form.getSuffix());
    userProxy.setTitle(form.getTitle());

    // User Name and password
    if (!form.getNewPassword().equals("")
        || !user.getEmailAddress().equals(form.getEmailAddress())

    ) {
      if (!user.getPassword().equals(
          PublicEncryptionFactory.digestString(form.getPassword()))) {
        ActionErrors errors = new ActionErrors();
        errors.add("password", new ActionMessage(
            "current.usermanager.password.incorrect"));
        saveMessages(request, errors);
        return mapping.findForward("myAccountPage");
      }
      user.setPassword(PublicEncryptionFactory.digestString(form
          .getNewPassword()));
      user.setPasswordEncrypted(true);
      user.setEmailAddress(form.getEmailAddress().trim().toLowerCase());
    }

    APILocator.getUserAPI().save(user,APILocator.getUserAPI().getSystemUser(),false);
    HibernateUtil.saveOrUpdate(userProxy);

    List<TagInode> tags = TagFactory.getTagInodeByInode(userProxy.getInode());
    for (TagInode tag: tags) {
      Tag tempTag = TagFactory.getTagByTagId(tag.getTagId());
      TagFactory.deleteTagInode(tempTag.getTagName(), userProxy.getInode());
    }
    if(tags.size() > 0){
      TagFactory.addTag(form.getTags(), userProxy.getUserId(), userProxy.getInode());
    }
   
    CategoryAPI categoryAPI = APILocator.getCategoryAPI();
    List<Category> myUserCategories = categoryAPI.getChildren(userProxy, APILocator.getUserAPI().getSystemUser(), false);
    for (Object object: myUserCategories) {
      if ((object instanceof Category) && categoryAPI.canUseCategory((Category) object, APILocator.getUserAPI().getSystemUser(), false)) {
        categoryAPI.removeChild(userProxy, (Category) object, APILocator.getUserAPI().getSystemUser(), false);
      }
    }

    if (UtilMethods.isSet(form.getCategory())) {
      Category category;
      for (String categoryId: form.getCategory()) {
        category = categoryAPI.find(categoryId, APILocator.getUserAPI().getSystemUser(), false);
        if(InodeUtils.isSet(category.getInode())) {
          categoryAPI.addChild(userProxy, category, APILocator.getUserAPI().getSystemUser(), false);
        }
      }
View Full Code Here

    if (request.getSession().getAttribute(WebKeys.CMS_USER) == null) {
      return new ActionForward("/dotCMS/login");
    }

    // HttpSession session = request.getSession();
    MyAccountForm form = (MyAccountForm) lf;

    // Getting the user from the session
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();
View Full Code Here

    // Getting the user from the session
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();

    MyAccountForm form = (MyAccountForm) lf;
    loadUserInfoInRequest(form, userId, request);
    return mapping.findForward("editUserCategoriesPage");
  }
View Full Code Here

    // Getting the user from the session
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();

    MyAccountForm form = (MyAccountForm) lf;

    loadUserInfoInRequest(form, userId, request);
    return mapping.findForward("editUserAddressPage");
  }
View Full Code Here

    // Getting the user from the session
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();

    MyAccountForm form = (MyAccountForm) lf;
    loadUserInfoInRequest(form, userId, request);
    return mapping.findForward("editUserInfoPage");
  }
View Full Code Here

    // Getting the user from the session
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();

    MyAccountForm form = (MyAccountForm) lf;
    loadUserInfoInRequest(form, userId, request);
    return mapping.findForward("editUserOrganizationPage");
  }
View Full Code Here

    if (request.getSession().getAttribute(WebKeys.CMS_USER) == null) {
      return new ActionForward("/dotCMS/login");
    }

    MyAccountForm form = (MyAccountForm) lf;
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();

    if (!Validator.validate(request, lf, mapping))
      return mapping.findForward("editUserAddressPage");

    // Saving Address Information
    Address address = null;
    int addrId = 0;
    try{
      addrId = Integer.parseInt(form.getAddressID());
    }
    catch(Exception e){}

    if (addrId > 0) {
      address = PublicAddressFactory.getAddressById(form.getAddressID());
      if(address != null && address.getUserId() != null && !address.getUserId().equals(userId)){
        address = null;
      }
    }
    if (address == null) {
      address = PublicAddressFactory.getInstance();
      address.setUserId(userId);
      address.setCompanyId(PublicCompanyFactory.getDefaultCompanyId());
    }

    address.setDescription(form.getDescription());
    address.setStreet1(form.getStreet1());
    address.setStreet2(form.getStreet2());
    address.setCity(form.getCity());
    address.setCountry(form.getCountry());
    address.setState(form.getState());
    address.setZip(form.getZip());
    address.setPhone(form.getPhone());
    address.setFax(form.getFax());

    PublicAddressFactory.save(address);

    loadUserInfoInRequest(form, userId, request);
View Full Code Here

    if (request.getSession().getAttribute(WebKeys.CMS_USER) == null) {
      return new ActionForward("/dotCMS/login");
    }

    MyAccountForm form = (MyAccountForm) lf;
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();
    String companyId = Config.getStringProperty("COMPANY_ID");
    UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);

    if (!Validator.validate(request, lf, mapping))
      return mapping.findForward("editUserCategoriesPage");

    // Saving User Categories
    // Delete the old categories
    if (!InodeUtils.isSet(userProxy.getInode())) {
      List<Category> categories = InodeFactory.getParentsOfClass(
          userProxy, Category.class);
      for (int i = 0; i < categories.size(); i++) {
        categories.get(i).deleteChild(userProxy);
      }
    }

    // Save the new categories
    String[] arr = form.getCategory();
    if (arr != null) {
      for (int i = 0; i < arr.length; i++) {
        Category node = (Category) InodeFactory.getInode(arr[i],
            Category.class);
        node.addChild(userProxy);
View Full Code Here

    if (request.getSession().getAttribute(WebKeys.CMS_USER) == null) {
      return new ActionForward("/dotCMS/login");
    }

    MyAccountForm form = (MyAccountForm) lf;
    User user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);
    String userId = user.getUserId();
    String companyId = Config.getStringProperty("COMPANY_ID");
    UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);
    // ExtUser extUser = (ExtUser) InodeFactory.getChildOfClass(userProxy,
View Full Code Here

TOP

Related Classes of com.dotmarketing.cms.myaccount.struts.MyAccountForm

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.