class CaseSearchPresenter extends RecordSearchPresenter {

    @Override
    protected List<Long> getSearchResult(Map<String, String> searchConditions) {
        String uniqueId = searchConditions.get(ID);
        String name = searchConditions.get(NAME);
        String registrationDate = searchConditions.get(REGISTRATION_DATE);
        if (PrimeroAppConfiguration.getCurrentUser().getRoleType() == User.Role.CP) {
            int ageFrom = Integer.valueOf(searchConditions.get(AGE_FROM));
            int ageTo = Integer.valueOf(searchConditions.get(AGE_TO));
            String caregiver = searchConditions.get(CAREGIVER);
            return caseService.getCPSearchResult(uniqueId, name, ageFrom, ageTo, caregiver, getDate(registrationDate));
        } else {
            String location = searchConditions.get(LOCATION);
            return caseService.getGBVSearchResult(uniqueId, name, location, getDate(registrationDate));
        }
    }

    @Inject public  CaseSearchPresenter(CaseService caseService);

}