Package net.naijatek.myalumni.modules.common.domain

Examples of net.naijatek.myalumni.modules.common.domain.MemberVO


  protected boolean processPreprocess(HttpServletRequest request,
      HttpServletResponse response) {

    boolean continueProcessing = true;

    MemberVO token = null;
    MyAlumniUserContainer container = null;

    //String requestedPath = request.getPathInfo();

    // We check to see if the user is loggin in
    // String actionTok =
    // requestedPath.substring(requestedPath.lastIndexOf("/")+1);

    // Get the session object for the user.
    HttpSession session = request.getSession(false);
    if (session != null) {
      Object userObj = session.getAttribute(BaseConstants.USER_CONTAINER);
      if (userObj != null) {
        container = (MyAlumniUserContainer) userObj;
        token = container.getToken();
      }
    } else {
      try {
        response.setStatus(Integer.parseInt(BaseConstants.SC_SESSION_EXPIRED_701));
        response.sendError(Integer.parseInt(BaseConstants.SC_SESSION_EXPIRED_701), SystemConfigConstants.EXPIRED_SESSION_MSG);
      } catch (IOException e) {
        log.error("problem dispatching error message for illegal caller ..");
      }

      // discontinue ...
      return false;
    }

    if (token != null) {
      // At this point, user is logged on
      String requestPathInfo = request.getPathInfo(); // request path
                              // info.

      // At this point, we make sure user is allowed to perform the
      // action.

      boolean userIsAuthorized = isUserActionAllowed(requestPathInfo, token.getIsAdmin());
      if (!userIsAuthorized) {

        try {
          response.setStatus(Integer.parseInt(BaseConstants.SC_INSURFICIENT_PRIV_700));
          response.sendError(Integer.parseInt(BaseConstants.SC_INSURFICIENT_PRIV_700), SystemConfigConstants.UNAUTHORIZED_MSG);
View Full Code Here


                                       HttpServletResponse response) throws
        Exception {
   
      MemberForm memberForm = (MemberForm)form;
      String memberUserName = memberForm.getMemberUserName();
      MemberVO memberVO = memService.getMemberProfileByUserName(memberUserName);
      setRequestObject(request, "profile", memberVO);
      return mapping.findForward(BaseConstants.FWD_SUCCESS);

    }
View Full Code Here

                                       ActionForm form,
                                       HttpServletRequest request,
                                       HttpServletResponse response) throws
        Exception {

        MemberVO token =   getCurrentLoggedInUser(request);
     
        // check to see if the user logged on is a member
        if (!memberSecurityCheck(request, token)){
          return mapping.findForward(BaseConstants.FWD_LOGIN);
        }


      MemberForm memberForm = (MemberForm) form;
      MemberVO memberVO = memService.getMemberProfileByUserName(token.getMemberUserName());
      BeanUtils.copyProperties(memberForm, memberVO);
     
      try{
      // IM
        List<XlatDetailVO> availableMessengers = xlatService.getActiveGroupDetails(BaseConstants.GROUP_INSTANT_MESSENGERS);
View Full Code Here

      ActionMessages errors = new ActionMessages();
      SystemConfigVO sysConfigVO = sysConfigSerivce.getSystemConfig();
     
      try{              
        MemberForm memberForm = (MemberForm) form;
        MemberVO memberVO = new MemberVO();
        BeanUtils.copyProperties(memberVO, memberForm);
       
        memberVO.setLastModifiedBy(memberVO.getMemberUserName());
       
        // Member
        memService.createMember(memberVO, request);
        ////////
       final String memberId = memberVO.getMemberId();
        // Messengers
        List<MessengerVO> messengers = new ArrayList<MessengerVO>();
        MessengerVO mesgerVO = null;
        for(String str : memberVO.getLstSelectedIMs()){
          mesgerVO = new MessengerVO();
          mesgerVO.setLastModifiedBy(memberVO.getMemberUserName());
          mesgerVO.setMemberId(memberId);
          mesgerVO.setLookupCodeId(str);
          messengers.add(mesgerVO);
        }
        messengerService.saveAll(messengers, memberId);
       
        // Message Folders
        mfService.createMemberMessageFolders(memberId, SystemConfigConstants.MESSAGE_FOLDERS, memberVO.getMemberUserName());       
       
        StringBuffer message = new StringBuffer();
        message.append("Thank you " + StringUtil.capitalize(memberVO.getFirstName()) + " " + StringUtil.capitalize(memberVO.getLastName())  + " for registering and Welcome to " + sysConfigVO.getOrganizationName()  + "'s owns space in cyberspace.");
        message.append("Your account should be active within the next 24 hours. So please try logging into the system as soon as you get your activation confirmation email.");
        setSessionObject(request, BaseConstants.MESSAGE,  message.toString());

        // send email to registrant
        try {
          SendMailUtil.sendWelcomeNotice(memberVO.getEmail(), memberVO.getMemberUserName(),sysConfigVO);
        }
        catch (Exception ex) {
          logger.error(ex.getMessage());
          errors.add(BaseConstants.FATAL_KEY, new ActionMessage("error.mailserver"));
          saveMessages(request, errors);
View Full Code Here

      }

      ActionMessages msgs = new ActionMessages();


      MemberVO token = getCurrentLoggedInUser(request);

      // check to see if the user logged on is a member
      if (!memberSecurityCheck(request, token)){
        return mapping.findForward(BaseConstants.FWD_LOGIN);
      }

      MemberForm memberForm = (MemberForm) form;
      MemberVO memberVO = new MemberVO();
      BeanUtils.copyProperties(memberVO, memberForm);
      memberVO.setMemberUserName(token.getMemberUserName());
      memberVO.setMemberId(token.getMemberId());
      memService.updateMemberProfile(memberVO, getLastModifiedBy(request));
     
      // Messengers
      final String memberId = memberVO.getMemberId();
      List<MessengerVO> messengers = new ArrayList<MessengerVO>();
      MessengerVO mesgerVO = null;
      for(String str : memberVO.getLstSelectedIMs()){
        mesgerVO = new MessengerVO();
        mesgerVO.setLastModifiedBy(getLastModifiedBy(request));
        mesgerVO.setMemberId(memberId);
        mesgerVO.setLookupCodeId(str);
        messengers.add(mesgerVO);
View Full Code Here

            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response) throws
              Exception {

        MemberVO token = getCurrentLoggedInUser(request);

        // check to see if the user logged on is a member
        if (!memberSecurityCheck(request, token)){
          return mapping.findForward(BaseConstants.FWD_LOGIN);
        }
       
       
    ActionMessages errors = new ActionMessages();
    String avatarName = token.getAvatar();
     
    try{
      //
      // removed from database
      //
      memService.deleteMemberAvatar(token.getAvatar(), token.getMemberUserName(), getLastModifiedBy(request));
     
      //
      //removed from file system
      //
      String avatarDir = getSysProp().getValue("AVATAR.FILEPATH");
View Full Code Here

      if (isCancelled(request)){
        return mapping.findForward(BaseConstants.FWD_CANCEL);
      }

      MemberVO token = getCurrentLoggedInUser(request);
      MemberForm memberForm = (MemberForm)form;
     
      if (!memberSecurityCheck(request, token)){
        return mapping.findForward(BaseConstants.FWD_LOGIN);
      }
  
      //  Set Max Size
      try{
        maxFileSize = Integer.parseInt(getAppProp().getValue("avatar.image.size").trim());
      }
      catch(Exception e){
        maxFileSize = 120000;   // 120000 Bytes  = 120 KB
      }
     
      // Set Max Height
      try{
        maxHeight = Integer.parseInt(getAppProp().getValue("avatar.image.height").trim());
      }
      catch(Exception e){
        maxHeight = 200;   // 200 px
      }
     
      // Set Max Width
      try{
        maxWidth = Integer.parseInt(getAppProp().getValue("avatar.image.width").trim());
      }
      catch(Exception e){
        maxWidth = 200;   // 200 px
      }
     
     
      FormFile importFile = memberForm.getAvatarUpload();
      overwrite = StringUtil.safeString(memberForm.getAvatarUploadOverwrite());
      String importFileName = getCurrentLoggedInUser(request).getMemberUserName() + "." + getFileExtensionForImageReader(importFile.getFileName());
      int size = importFile.getFileSize();

    //--------------------  VALIDATE THE IMAGE -----------------------------------------
      // check width and heigh of image
      logger.debug(importFileName + " ext = " + getFileExtensionForImageReader(importFileName));
      Iterator readers = ImageIO.getImageReadersBySuffix(getFileExtensionForImageReader(importFileName));
      ImageReader reader = (ImageReader) readers.next();
  
       try {
          ImageInputStream iis = ImageIO.createImageInputStream(importFile.getInputStream());
          reader.setInput(iis, true);
          int width = reader.getWidth(0);
          int height = reader.getHeight(0);
          logger.debug(importFile.getFileName() + ": width=" + width + ", height=" + height);
          if (width > maxWidth || height >  maxHeight){
              errors.add(BaseConstants.WARN_KEY,new ActionMessage("error.dimensions", width, height, maxWidth, maxHeight ));
              saveMessages(request, errors);
              return mapping.getInputForward();           
          }
      } catch (IOException e) {
          System.err.println(e.getMessage() + ": can't open");
          errors.add(BaseConstants.FATAL_KEY,new ActionMessage("error.notreadable"));
          saveMessages(request, errors);
          return mapping.getInputForward();          
      }
         
     
      // check file name
      if (importFileName.indexOf(" ") > -1) {
        errors.add(BaseConstants.WARN_KEY,new ActionMessage("error.filename", importFileName));
        saveMessages(request, errors);
        return mapping.getInputForward();
      }

      //boolean validImageName = false;
/*      StringTokenizer st0 = new StringTokenizer(importFileName, ".");
      if (st0.hasMoreTokens()) {
        if (token.getMemberUserName().equals(st0.nextToken())) {
          //validImageName = true;
        }
        else{
          errors.add(BaseConstants.WARN_KEY, new ActionMessage("error.fileusername", token.getMemberUserName(),importFileName ));
          saveMessages(request, errors);
          return mapping.getInputForward();
        }
      }*/


      File f = new File(avatarDir + importFileName);
      if ( f.exists() && (overwrite.equalsIgnoreCase("false") || overwrite.equalsIgnoreCase(""))){
        continer.setOverWriteAvatar(true);
        errors.add(BaseConstants.WARN_KEY, new ActionMessage("error.filename.exist"));
        saveMessages(request, errors);
        return mapping.getInputForward();
      }

      if ( size > maxFileSize){
        errors.add(BaseConstants.WARN_KEY, new ActionMessage("error.filetoobig", String.valueOf(size), String.valueOf(maxFileSize)));
        saveMessages(request, errors);
        return mapping.getInputForward();
      }

      boolean validImageExtension = false;
      StringTokenizer st = new StringTokenizer(fileTypes, ",");

      logger.debug("Current Type = " + importFile.getContentType());
      while (st.hasMoreTokens()) {
        if ( importFile.getContentType().equalsIgnoreCase(st.nextToken())){
          validImageExtension = true;
        }
      }

      // check file extension
      if (!validImageExtension){
        errors.add(BaseConstants.WARN_KEY, new ActionMessage("error.imageext", String.valueOf(fileTypes)));
        saveMessages(request, errors);
        return mapping.getInputForward();
      }
     
      // apend the file extension
      //avatar = avatar + "." + importFile.getContentType();



    //-------------------------------------------------------------

        if(!uploadFromLocalDrive(importFile, importFileName ,avatarDir)){
          errors.add(BaseConstants.FATAL_KEY, new ActionMessage("errors.technical.difficulty"));
          saveMessages(request, errors);
          return mapping.getInputForward();
        }


        memService.updateMemberAvatar(importFileName, token.getMemberUserName(), getLastModifiedBy(request));
        continer.setOverWriteAvatar(false);
        continer.setAvatar(importFileName);
        MemberVO memberVO = memService.getMemberProfileByUserName(token.getMemberUserName());
        BeanUtils.copyProperties(memberForm, memberVO);
        return mapping.findForward(BaseConstants.FWD_SUCCESS);
    }   
View Full Code Here

      if (isCancelled(request)){
        return mapping.findForward(BaseConstants.FWD_CANCEL);
      }


      MemberVO token = getCurrentLoggedInUser(request);
      // check to see if the user logged on is a member
      if (!memberSecurityCheck(request, token)){
        return mapping.findForward(BaseConstants.FWD_LOGIN);
      }

      MemberForm memberForm = (MemberForm) form;
      String email = memberForm.getEmail().toLowerCase();

      if (memService.isMemberAvailableByEmail(email, memberForm.getMemberId())) {
        ActionMessages errors = new ActionMessages();
        errors.add(BaseConstants.WARN_KEY, new ActionMessage("error.duplicate.email"));
        saveMessages(request, errors);
           return mapping.getInputForward();
      }

      memService.updateMemberEmail(email, token.getMemberUserName(), getLastModifiedBy(request));

      // get the member profile
      MemberVO memberVO = memService.getMemberProfileByUserName(token.getMemberUserName());
      BeanUtils.copyProperties(memberForm, memberVO);
      MyAlumniUserContainer continer = getUserContainer(request);
      continer.updateTokenEmail(email);
      return mapping.findForward(BaseConstants.FWD_SUCCESS);
View Full Code Here

      if (isCancelled(request)){
        return mapping.findForward(BaseConstants.FWD_CANCEL);
      }

      MemberVO token = getCurrentLoggedInUser(request);
      // check to see if the user logged on is a member
      if (!memberSecurityCheck(request, token)){
        return mapping.findForward(BaseConstants.FWD_LOGIN);
      }


      MemberForm memberForm = (MemberForm) form;
      String oldpassword =  memberForm.getOldMemberPassword();
      String newpassword =  memberForm.getMemberPasswordConfirm();

      String currentPassword = memService.getMemberPasswordByUserName(token.getMemberUserName());

      if (!currentPassword.equals(Encoder.getMD5_Base64(oldpassword))) {
        ActionMessages errors = new ActionMessages();
        errors.add(BaseConstants.WARN_KEY, new ActionMessage("error.password.equal"));
        saveMessages(request, errors);
           return mapping.getInputForward();
      }

      memService.updateMemberPassword(token.getMemberUserName(), newpassword, getLastModifiedBy(request));

      // get the member profile
      MemberVO memberVO = memService.getMemberProfileByUserName(token.getMemberUserName());
      BeanUtils.copyProperties(memberForm, memberVO);
      return mapping.findForward(BaseConstants.FWD_SUCCESS);

    }   
View Full Code Here

      if (isCancelled(request)){
        return mapping.findForward(BaseConstants.FWD_CANCEL);
      }

      MemberVO token = getCurrentLoggedInUser(request);

      // check to see if the user logged on is a member
      if (!memberSecurityCheck(request, token)){
        return mapping.findForward(BaseConstants.FWD_LOGIN);
      }

      MemberForm memberForm = (MemberForm) form;
      String signature = memberForm.getSignature().toLowerCase();

      memService.updateMemberSignature(signature, token.getMemberUserName(), getLastModifiedBy(request));

      token.setSignature(signature);

      // get the member profile
      MemberVO memberVO = memService.getMemberProfileByUserName(token.getMemberUserName());
       BeanUtils.copyProperties(memberForm, memberVO);

      return mapping.findForward(BaseConstants.FWD_SUCCESS);

    }   
View Full Code Here

TOP

Related Classes of net.naijatek.myalumni.modules.common.domain.MemberVO

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.