Package com.cin.dto

Examples of com.cin.dto.UserDTO


      userFactory.updateUserInvestment(user);
    }
    if (user.getYouth() != null) {
      userFactory.updateUserYouth(user);
    }
    UserDTO newUser = retrieveUserRecord(user.getSsn());
    this.userRecordModified(newUser);
    return newUser;
  }
View Full Code Here


  public void filterUsers(List<UserDTO> pUsers,SearchDTO pDTO) {
   
    int aScore = pDTO.getScore();
    int anEstimatedIncome = pDTO.getEstimatedIncome();
    UserDTO aUserDTO = null;
    for(Iterator<UserDTO> anIterator = pUsers.iterator(); anIterator.hasNext();) {
     
      aUserDTO = anIterator.next();
     
      if(aUserDTO.getIncome() < anEstimatedIncome) {
       
        anIterator.remove();
        continue;
      }
      if(aUserDTO.getScore() < aScore) {
       
        anIterator.remove();
      }
    }
  }
View Full Code Here

          Thread.sleep(1000);
        } catch (InterruptedException e) {
          aLog.warning("Interupted sleeping");
        }
       
        UserDTO tmpUser = retrieveUserRecord(pDTO);
       
        int score = getScoreForUserFromDb(tmpUser);
        pDTO.setScore(score);
       
        tmpUser.setScore(score);
        scoreCache.addUser(tmpUser);
      }
    }
  }
View Full Code Here

      }
    }
  }

  private int getScoreForUserFromDb(UserDTO pDTO) throws MissingInformationException, InvalidInputValueException {
    UserDTO user = retrieveUserRecord(pDTO);
   
    int aScore = 0;
    if (user.getJobDetails() != null && user.getJobDetails().getWorkClass().equalsIgnoreCase(
        ApplicationConstants.FEDERAL_GOVT_EMP)) {
      return 100;
    }
   
   
    List<UserDTO> theUsers = null;
    if(user.getZipCode() == null || user.getZipCode().equals("")) {
      throw new MissingInformationException("User's zip code is not known");
    }
    String zipCode = user.getZipCode();
   
    if(incomeMap.containsKey(zipCode)) {
   
      theUsers = incomeMap.get(zipCode);
    }
    else {
     
      theUsers = this.retrieveUserRecordbyZip(zipCode);
     
      if(theUsers != null && !theUsers.isEmpty()) {
     
        incomeMap.put(zipCode, theUsers);
      }
    }
    int aNumCount = 0;
    for (UserDTO aDTO : theUsers) {
      if (user.getIncome() >= aDTO.getIncome()) {
        aNumCount++;
      }
    }
    // TODO what if theUsers.size() == 0; it shouldn't happen... but
    if(theUsers.size() > 0) {
     
      float aUserPercentile = (float) aNumCount / (float) theUsers.size();
      aScore = Math.round(100 * aUserPercentile);
    }
    if (user.getSex().equalsIgnoreCase("F")) {
      aScore = aScore + ((5 / 100) * aScore);
    }
       
    if (user.getJobDetails() != null && !user.getJobDetails().isUnionMember()
        && aScore < ApplicationConstants.THRESHOLD_VALUE) {
     
      int aOccStab = 0;
      int indStab = 0;
      OccupationDTO occStaticData = this.findOccupationStabilityValue(
          user.getJobDetails().getOccupationCode());
      if(occStaticData != null) {
       
        aOccStab = occStaticData.getStability();
      }
     
      IndustryDTO indStaticData = this.findIndustryStabilityValue(
          user.getJobDetails().getIndustryCode());
      if(indStaticData != null) {
       
        indStab = indStaticData.getStability();
      }

      Double aUserStability = Math.sqrt(new Double(aOccStab
          * indStab))
          * new Double(10);

      if (aUserStability > 0 && aUserStability < 10) {
        return 0;
      } else if (aUserStability > 10 && aUserStability < 60) {
        aScore = (int) (aScore * (aUserStability / 80));
        if (user.getEducation() != null &&
            ( user.getEducation().isDoctorate()
            || user.getEducation().isMasters()
            || user.getEducation().isProfesssional()) ) {
          aScore = aScore + (aScore * (20 / 100));
        }
      } else if (aUserStability > 60 && aUserStability < 100) {
        aScore = (int) (aScore * (aUserStability / 100));
        if (user.getEducation() != null &&
            ( user.getEducation().isBachelors()
            || user.getEducation().isDoctorate()
            || user.getEducation().isMasters()
            || user.getEducation().isProfesssional()) ) {

          aScore = aScore + (aScore * (12 / 100));
        }
      }
    }

    /**
     * TODO based on capital gains. change @arunsanjay
     */
    // check other details
    if(user.getIncome() > 0) {
     
      int aPayPercentage = (user.incomeFromPay() / user.getIncome()) * 100;
      if ((100 - aPayPercentage) > aPayPercentage) {
        aScore = aScore - (aScore * (10 / 100));
      }
      if (user.isSingle()) {
        aScore = aScore + (aScore * (10 / 100));
      }
      if (user.getAge() >= 65 && user.getIncome() < 5000) {
        aScore = 0;
      }
    }

    // return score
View Full Code Here

      }
    }
  }
 
  public void filterByJobCode(List<UserDTO> pUsers ,int pIndCode, int pOccCode) {
    UserDTO user = null;
    for(Iterator<UserDTO> anIterator = pUsers.iterator(); anIterator.hasNext();) {
     
      user = anIterator.next();
     
      if(user.getJobDetails() != null) {
       
        if(user.getJobDetails().getIndustryCode() != pIndCode &&
            user.getJobDetails().getOccupationCode() != pOccCode) {
         
          anIterator.remove();
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.cin.dto.UserDTO

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.