Search in sources :

Example 1 with ApplicantDTO

use of org.c4sg.dto.ApplicantDTO in project c4sg-services by Code4SocialGood.

the class UserMapper method getApplicantDTOs.

public List<ApplicantDTO> getApplicantDTOs(List<Object[]> applicants) {
    List<ApplicantDTO> applicantList = new ArrayList<>();
    Iterator<Object[]> iter = applicants.iterator();
    while (iter.hasNext()) {
        Object[] o = iter.next();
        ApplicantDTO applicant = new ApplicantDTO();
        applicant.setUserId((Integer) o[0]);
        applicant.setProjectId((Integer) o[1]);
        applicant.setFirstName((String) o[2]);
        applicant.setLastName((String) o[3]);
        applicant.setTitle((String) o[4]);
        applicant.setApplicationStatus(String.valueOf(o[5]));
        if (o[6] != null) {
            applicant.setAppliedTime((Date) o[6]);
        }
        if (o[7] != null) {
            applicant.setAcceptedTime((Date) o[7]);
        }
        if (o[8] != null) {
            applicant.setDeclinedTime((Date) o[8]);
        }
        applicantList.add(applicant);
    }
    return applicantList;
}
Also used : ArrayList(java.util.ArrayList) ApplicantDTO(org.c4sg.dto.ApplicantDTO)

Example 2 with ApplicantDTO

use of org.c4sg.dto.ApplicantDTO in project c4sg-services by Code4SocialGood.

the class BadgeServiceImpl method getApplicantIdsWithHeroFlagMap.

@Override
public Map<Integer, String> getApplicantIdsWithHeroFlagMap(Integer projectId) {
    // returns a map of Applicants Id as key and Hero Flag "Y"/"N" as value
    System.out.println("getApplicantIdsWithHeroFlagMap called...");
    List<ApplicantDTO> applicantDtos = applicationService.getApplicants(projectId);
    Map<Integer, String> applicantIdsWithHeroFlagMap = new HashMap<Integer, String>();
    for (ApplicantDTO applicantDto : applicantDtos) {
        String heroFlag = "N";
        Integer applicantId = applicantDto.getUserId();
        if (badgeDAO.findByUser_IdAndProject_Id(applicantId, projectId) != null) {
            heroFlag = "Y";
        }
        applicantIdsWithHeroFlagMap.put(applicantId, heroFlag);
    }
    return applicantIdsWithHeroFlagMap;
}
Also used : HashMap(java.util.HashMap) ApplicantDTO(org.c4sg.dto.ApplicantDTO)

Example 3 with ApplicantDTO

use of org.c4sg.dto.ApplicantDTO in project c4sg-services by Code4SocialGood.

the class ApplicationMapper method getApplicantDtosFromEntities.

public List<ApplicantDTO> getApplicantDtosFromEntities(List<Application> applications) {
    List<ApplicantDTO> applicantList = new ArrayList<ApplicantDTO>();
    ApplicantDTO applicant;
    for (Application application : applications) {
        applicant = new ApplicantDTO();
        applicant.setUserId(application.getUser().getId());
        applicant.setProjectId(application.getProject().getId());
        applicant.setFirstName(application.getUser().getFirstName());
        applicant.setLastName(application.getUser().getLastName());
        applicant.setTitle(application.getUser().getTitle());
        applicant.setApplicationStatus(application.getStatus());
        applicant.setComment(application.getComment());
        applicant.setResumeFlag(stringToBooleanConverter.convert(application.getResumeFlag()));
        applicant.setAppliedTime(application.getAppliedTime());
        applicant.setAcceptedTime(application.getAcceptedTime());
        applicant.setDeclinedTime(application.getDeclinedTime());
        applicantList.add(applicant);
    }
    return applicantList;
}
Also used : ArrayList(java.util.ArrayList) ApplicantDTO(org.c4sg.dto.ApplicantDTO) Application(org.c4sg.entity.Application)

Aggregations

ApplicantDTO (org.c4sg.dto.ApplicantDTO)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)1 Application (org.c4sg.entity.Application)1