ems.web.model.service.resume.ResumeServiceImpl.java Source code

Java tutorial

Introduction

Here is the source code for ems.web.model.service.resume.ResumeServiceImpl.java

Source

package ems.web.model.service.resume;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import com.sun.org.apache.xpath.internal.operations.Mult;

import ems.web.model.dao.resume.ResumeDAO;
import ems.web.model.dto.AcademicAblityDTO;
import ems.web.model.dto.CareerDTO;
import ems.web.model.dto.EmailDTO;
import ems.web.model.dto.LicenseDTO;
import ems.web.model.dto.MemberDTO;
import ems.web.model.service.mailsender.MailSenderService;
import java.util.concurrent.Future;

import javax.servlet.http.HttpServletResponse;

@Service
public class ResumeServiceImpl implements ResumeService {
    @Autowired
    private ResumeDAO resumeDAOImpl;
    @Autowired
    private MailSenderService mailSenderServiceImpl;

    @Override
    public void writeAcademicAbility(AcademicAblityDTO academicAblityDTO) {
        resumeDAOImpl.writeAcademicAbility(academicAblityDTO);
    }

    @Override
    public void writeCareer(CareerDTO careerDTO) {
        resumeDAOImpl.writeCareer(careerDTO);
    }

    @Override
    public void writeLicense(LicenseDTO licenseDTO) {
        resumeDAOImpl.writeLicense(licenseDTO);
    }

    @Override
    public void modifyAcademicAbility(AcademicAblityDTO academicAblityDTO) {
        resumeDAOImpl.modifyAcademicAbility(academicAblityDTO);
    }

    @Override
    public void modifyCareer(CareerDTO careerDTO) {
        resumeDAOImpl.modifyCareer(careerDTO);
    }

    @Override
    public void modifyLicense(LicenseDTO licenseDTO) {
        resumeDAOImpl.modifyLicense(licenseDTO);
    }

    @Override
    public AcademicAblityDTO selectAcademicAbility(int memberCode) {
        return resumeDAOImpl.selectAcademicAbility(memberCode);
    }

    @Override
    public List<CareerDTO> selectCareer(int memberCode) {
        return resumeDAOImpl.selectCareer(memberCode);
    }

    @Override
    public List<LicenseDTO> selectLicense(int memberCode) {
        return resumeDAOImpl.selectLicense(memberCode);
    }

    @Override
    public MemberDTO getResumeInitUserData(String memberId) {
        return resumeDAOImpl.getResumeInitUserData(memberId);
    }

    @Override
    public String spellCheck(String data) {
        String checkString = null;
        try {
            Process p = Runtime.getRuntime().exec("python C:\\pythonLib\\spell_checker.py \"" + data + "\"");
            BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line = null;

            while ((line = br.readLine()) != null) {
                if (line != null) {
                    checkString = line;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return checkString;

    }

    @Override
    public String hireApply(String content, String email, String subject, MultipartFile file) {
        EmailDTO emailDTO = new EmailDTO();
        emailDTO.setReceiver(email);
        emailDTO.setSubject(subject);
        emailDTO.setContent(content);
        emailDTO.setFile(file);

        try {
            Future<String> future = mailSenderServiceImpl.sendApply(emailDTO);
            return future.get();

        } catch (Exception e) {
            e.printStackTrace();
        }
        return "error/errorMessage";
    }
}