Package com.cin.dto

Examples of com.cin.dto.StatisticsDTO


    return aResponse;
  }
 
  public GenericResponse calculateAverageIncome(StatisticsDTO pStatistics) throws PersistenceException {
    GenericResponse aResponse = new GenericResponse();
    StatisticsDTO statistics = new StatisticsDTO();
    List<UserDTO> theUsers = userFactory.findForIncomeStatistics(pStatistics);
    double income = 0;
    int avgIncome = 0;
    if(theUsers != null && !theUsers.isEmpty()) {
      for(UserDTO user : theUsers) {
          income = income + user.getIncome();
      }
     
      avgIncome = (int)income/theUsers.size();
      statistics.setAvgIncome(avgIncome);
      aResponse.setStatistics(statistics);
      aResponse.setResponseStatus(true);
    }
    else {
      aResponse.setResponseStatus(false);
View Full Code Here


    service = new StatisticsService();
  }

  @Test
  public void testCalculateWeeklyWage() throws PersistenceException {
    StatisticsDTO aStatistics = new StatisticsDTO();
    aStatistics.setState("illinois");
    aStatistics.setOccCode(1);
    aStatistics.setIndustryCode(9);
    GenericResponse aResponse = service.calculateWeeklyWage(aStatistics);
    assertTrue(aResponse.isResponseStatus());
    assertTrue(aResponse.getStatistics().getAvgWeekWage() > 0);
  }
View Full Code Here

    assertTrue(aResponse.getStatistics().getAvgWeekWage() > 0);
  }

  @Test
  public void testCalculateAverageIncomeForState() throws PersistenceException {
    StatisticsDTO aStatistics = new StatisticsDTO();
    aStatistics.setState("illinois");
    GenericResponse aResponse = service.calculateAverageIncome(aStatistics);
    assertTrue(aResponse.isResponseStatus());
    assertTrue(aResponse.getStatistics().getAvgIncome() > 0);
  }
View Full Code Here

    assertTrue(aResponse.getStatistics().getAvgIncome() > 0);
  }
 
  @Test
  public void testCalculateAverageIncomeForCode() throws PersistenceException {
    StatisticsDTO aStatistics = new StatisticsDTO();
    aStatistics.setIndustryCode(9);
    aStatistics.setOccCode(1);
    GenericResponse aResponse = service.calculateAverageIncome(aStatistics);
    assertTrue(aResponse.isResponseStatus());
    assertTrue(aResponse.getStatistics().getAvgIncome() > 0);
  }
View Full Code Here

    assertTrue(aResponse.getStatistics().getAvgIncome() > 0);
  }
 
  @Test
  public void testCalculateAverageIncomeForRace() throws PersistenceException {
    StatisticsDTO aStatistics = new StatisticsDTO();
    aStatistics.setRace("White");
    GenericResponse aResponse = service.calculateAverageIncome(aStatistics);
    assertTrue(aResponse.isResponseStatus());
    assertTrue(aResponse.getStatistics().getAvgIncome() > 0);
  }
View Full Code Here

    assertTrue(aResponse.getStatistics().getAvgIncome() > 0);
  }
 
  @Test
  public void testCalculateAverageIncomeForEducation() throws PersistenceException {
    StatisticsDTO aStatistics = new StatisticsDTO();
    aStatistics.setEducationLevel("masters");
    GenericResponse aResponse = service.calculateAverageIncome(aStatistics);
    assertTrue(aResponse.isResponseStatus());
    assertTrue(aResponse.getStatistics().getAvgIncome() > 0);
  }
View Full Code Here

 
  public UserDTO calculateLikelinessFactor(UserDTO pUser) throws MissingInformationException,PersistenceException {
   
    UserDTO user = userFactory.findUserBySsn(pUser.getSsn());
    StatisticsService aStatsService = new StatisticsService();
    StatisticsDTO aUserStateStats = new StatisticsDTO();
    if(user.getZipCode() == null || user.getZipCode().trim().length() > 0) {
     
      throw new MissingInformationException("Location information is missing for user.Update the info and calculate the factor");
    }
    if(user.getJobDetails() != null) {
     
      ZipDTO zip = aRemote.findStateForZip(Integer.parseInt(user.getZipCode()));
     
      if(zip != null) {
     
        aUserStateStats.setState(zip.getState());
      }
      aUserStateStats.setIndustryCode(user.getJobDetails().getIndustryCode());
      aUserStateStats.setOccCode(user.getJobDetails().getOccupationCode());
    }
    GenericResponse aResponse = aStatsService.calculateWeeklyWage(aUserStateStats);
    int userStateAvgWage = 0;
    int numOfStates = 0;
    if(aResponse != null && aResponse.getStatistics() != null
        && aResponse.isResponseStatus()) {
     
      userStateAvgWage = aResponse.getStatistics().getAvgWeekWage();
    }
    List<StateAbbvDTO> theStates = aRemote.findAllStates();
    StatisticsDTO otherStatesStats = new StatisticsDTO();
    for(StateAbbvDTO aState : theStates) {
      String aStateName = aState.getAbbv();
      otherStatesStats.setIndustryCode(user.getJobDetails().getIndustryCode());
      otherStatesStats.setOccCode(user.getJobDetails().getOccupationCode());
      otherStatesStats.setState(aStateName);
      aResponse = aStatsService.calculateWeeklyWage(aUserStateStats);
      if(aResponse != null && aResponse.getStatistics() != null
          && aResponse.isResponseStatus()) {
       
        if(userStateAvgWage < aResponse.getStatistics().getAvgWeekWage()) {
View Full Code Here

TOP

Related Classes of com.cin.dto.StatisticsDTO

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.