Package com.cin.dto

Examples of com.cin.dto.GenericResponse


     return aResponse;
   }
  
   public GenericResponse getLargestIndustriesForState(GenericRequest pRequest) {
     String state = pRequest.getStatistics().getState();
     GenericResponse aResponse = new GenericResponse();
     try {
       List<IndustryDTO> industries = statService.getLargestIndustriesInState(state);
       aResponse.setResponseStatus(true);
       aResponse.setIndustryList(industries);
     }
     catch(PersistenceException pException) {
      
       aResponse.setErrorMessage(pException.getMessage());
     }
     return aResponse;
   }
View Full Code Here


     return aResponse;
   }
  
   public GenericResponse getLargestOccupationsForState(GenericRequest pRequest)  {
     String state = pRequest.getStatistics().getState();
     GenericResponse aResponse = new GenericResponse();
     try {
      
       List<OccupationDTO> occupations = statService.getLargestOccupationsInState(state);
       aResponse.setOccupationList(occupations);
       aResponse.setResponseStatus(true);
     }
     catch(PersistenceException pException) {
      
       aResponse.setErrorMessage(pException.getMessage());
     }
     return aResponse;
   }
View Full Code Here

  
   public GenericResponse getProminantStatesForIndustry(GenericRequest pRequest){
     int industryCode = pRequest.getStatistics().getIndustryCode();
     List<String> states = statService.getPrincipleStateForIndustry(industryCode);
    
     GenericResponse aResponse = new GenericResponse();
     aResponse.setStateList(states);
     return aResponse;
   }
View Full Code Here

  
   public GenericResponse getProminantStatesForOccupation(GenericRequest pRequest){
     int occupationCode = pRequest.getStatistics().getOccCode();
     List<String> states = statService.getPrincipleStateForOccupation(occupationCode);
    
     GenericResponse aResponse = new GenericResponse();
     aResponse.setStateList(states);
     return aResponse;
   }
View Full Code Here

   }
  
  
   public GenericResponse calculateLikelinessFactor(GenericRequest pRequest) throws PersistenceException{
    
     GenericResponse aResponse = new GenericResponse();
     try {
       UserDTO user = cinService.calculateLikelinessFactor(pRequest.getUser());
       aResponse.setUser(user);
       aResponse.setResponseStatus(true);
     }
     catch(MissingInformationException pException) {
      
       EventLogger.getInstance().log(Level.SEVERE,pException.getMessage());
       aResponse.setErrorMessage(pException.getMessage());
     }
     catch(PersistenceException pException) {
       aResponse.setErrorMessage(pException.getMessage());
     }
    
     return aResponse;
   }
View Full Code Here

      }
      aStatsService = new StatisticsService();
    }
    public GenericResponse calculateAverageWeeklyWage(GenericRequest pRequest)  {
     
      GenericResponse aResponse = new GenericResponse();
      try {
      aResponse = aStatsService.calculateWeeklyWage(pRequest.getStatistics());
      aResponse.setResponseStatus(true);
      }
      catch(PersistenceException pException) {
       
        aResponse.setErrorMessage(pException.getMessage());
      }
  
      return aResponse;
    }
View Full Code Here

  
      return aResponse;
    }
   
    public GenericResponse calculateAverageIncome(GenericRequest pRequest) {
      GenericResponse aResponse = new GenericResponse();
      try {
      aResponse = aStatsService.calculateAverageIncome(pRequest.getStatistics());
      }
      catch(PersistenceException pException) {
       
        aResponse.setErrorMessage(pException.getMessage());
      }
      return aResponse;
    }
View Full Code Here

    }
  }
  public GenericResponse calculateWeeklyWage(StatisticsDTO pDTO) throws PersistenceException {
   
    List<UserDTO> theUsers = aRemote.findForAvgWage(pDTO);
    GenericResponse aResponse = new GenericResponse();
    if(theUsers != null && !theUsers.isEmpty()) {
     
      StaticDataService aStaticService = new StaticDataService();
      int anAvgWage = aStaticService.calculateMeanWeekWage(theUsers);
     
      pDTO.setAvgWeekWage(anAvgWage);
      aResponse.setStatistics(pDTO);
      aResponse.setResponseStatus(true);
    }
    else {
     
      aResponse.setErrorMessage("No users found for criteria");
    }
    return aResponse;
  }
View Full Code Here

    }
    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);
      aResponse.setErrorMessage("No users found for given criteria");
    }
    return aResponse;
  }
View Full Code Here

  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

TOP

Related Classes of com.cin.dto.GenericResponse

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.