com.hrs.controller.front.UpdateResumeController.java Source code

Java tutorial

Introduction

Here is the source code for com.hrs.controller.front.UpdateResumeController.java

Source

package com.hrs.controller.front;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hrs.common.MapTableArray;
import com.hrs.model.dto.addResume.HiddenAddResumeDTO;
import com.hrs.model.dto.dynamicForm.YearsListDTO;
import com.hrs.model.dto.newResume.LanguageProficiencyDTO;
import com.hrs.model.dto.newResume.YearsDTO;
import com.hrs.model.dto.updateResume.UpdateResumeDTO;
import com.hrs.model.pojo.Experience;
import com.hrs.model.pojo.LanguageCertificates;
import com.hrs.model.pojo.LanguageProficiency;
import com.hrs.model.pojo.ProjectExperience;

//import com.hrs.model.ContactInfo;

@Controller
public class UpdateResumeController extends ResumeController {

    List<YearsDTO> postList = new ArrayList<YearsDTO>();
    private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
    String certificatesByEnglish = "", fractionsByEnglish = "", certificatesByJapanese = "",
            fractionsByJapanese = "";

    List<LanguageProficiencyDTO> languageDtoList = new ArrayList<LanguageProficiencyDTO>();
    List<LanguageCertificates> tempCreateLanguageCertificatesList = new ArrayList<LanguageCertificates>();

    @RequestMapping(value = "/updateResumeResult")
    public String updateResumeResult(@ModelAttribute("resumeDTO") UpdateResumeDTO updateResumeDTO,
            @ModelAttribute("hiddenAddResumeDTO") HiddenAddResumeDTO hiddenAddResumeDTO, HttpSession session,
            ModelMap modelMap) throws Exception {
        String hinderLevel = "", hinderType = "";
        List<ProjectExperience> projectExperienceList = null;
        List<Experience> experienceList = null;
        languageDtoList = new ArrayList<LanguageProficiencyDTO>();
        logger.info("basic info id= " + updateResumeDTO.getBasicInformation().getId());
        logger.info("basic info guid= " + updateResumeDTO.getBasicInformation().getGuid());

        updateResumeDTO.getBasicInformation().setCreateUser("System");

        updateResumeDTO.getBasicInformation().setCreateDate(new Date());

        logger.info("basic info guid= " + updateResumeDTO.getContactInformation().getId());

        try {
            logger.info("SumYears = " + hiddenAddResumeDTO.getSumYears());
            if (hiddenAddResumeDTO.getSumYears() != "0") {
                updateResumeDTO.getBasicInformation()
                        .setTotalYears(Integer.valueOf(hiddenAddResumeDTO.getSumYears()));
            }

            // Job
            HashMap<String, String> hinderMap = new HashMap<String, String>();
            hinderMap = setHinderData(hiddenAddResumeDTO.getSumHinder());
            hinderLevel = hinderMap.get("hinderLevel");
            hinderType = hinderMap.get("hinderType");

            updateResumeDTO.getBasicInformation()
                    .setHinder(hiddenAddResumeDTO.getSumHinder().equalsIgnoreCase("0,0")
                            ? hiddenAddResumeDTO.getSumHinder()
                            : hinderLevel + hinderType);
            // edu background
            // List<EducationalBackground> eduBgList = new
            // ArrayList<EducationalBackground>();
            updateResumeDTO.getFirstEducation().setCreateUser("System");
            updateResumeDTO.getFirstEducation().setEbId(1);
            updateResumeDTO.getFirstEducation().setCreateDate(new Date());
            // eduBgList.add(updateResumeDTO.getFirstEducation());
            updateResumeDTO.getSecondEducation().setCreateUser("System");
            updateResumeDTO.getSecondEducation().setEbId(2);
            updateResumeDTO.getSecondEducation().setCreateDate(new Date());
            // eduBgList.add(updateResumeDTO.getSecondEducation());

            if (StringUtils.isNotEmpty(hiddenAddResumeDTO.getSumExperience())) {

                experienceList = getExperienceList(hiddenAddResumeDTO.getSumExperience());

                updateResumeDTO.setExperiences(experienceList);
            }

            if (StringUtils.isNotEmpty(hiddenAddResumeDTO.getSumProject())) {
                logger.info("hiddenAddResumeDTO.getSumProject()");
                projectExperienceList = getProjectExperienceList(hiddenAddResumeDTO.getSumProject());
                updateResumeDTO.setProjectExperiences(projectExperienceList);
            }

            updateResumeDTO.setLanguageProficiencies(
                    getLanguageProficiencyList(updateResumeDTO.getBasicInformation().getId(),
                            hiddenAddResumeDTO.getSumlanguage(), hiddenAddResumeDTO.getSumOtherlanguage()));

            logger.info("SumCertificateByEnglish = " + hiddenAddResumeDTO.getSumCertificateByEnglish());
            logger.info("SumCertificateByJapanese = " + hiddenAddResumeDTO.getSumCertificateByJapanese());
            updateResumeDTO.setLanguageCertificateses(
                    getLanguageCertificates(hiddenAddResumeDTO.getSumCertificateByEnglish(),
                            hiddenAddResumeDTO.getSumCertificateByJapanese()));

            updateResumeDTO.getBasicInformation().setSkill(hiddenAddResumeDTO.getSumSkills());

            updateResumeDTO.getBasicInformation().setLicense(hiddenAddResumeDTO.getSumLicense());

            updateResumeService.updateResume(updateResumeDTO);

            modelMap.addAttribute("resumeDTO", updateResumeDTO);
            modelMap.addAttribute("hinderLevel", hinderLevel);
            modelMap.addAttribute("hinderType", hinderType);
            modelMap.addAttribute("languageDtoList", languageDtoList);

            //languageDtoList = new ArrayList<LanguageProficiencyDTO>();
            certificatesByEnglish = "";
            fractionsByEnglish = "";
            certificatesByJapanese = "";
            fractionsByJapanese = "";
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return "/front/updateResumeSuccess";
    }

    @RequestMapping(value = "/resumeUpdate")
    public String resumeDownQuery(HttpServletRequest req, HttpSession session, ModelMap modelMap, Integer guid)
            throws Exception {
        String hinderLevel = "", hinderType = "", stillWorking = "";

        // logger.info("id:" + guid);
        List<String> salaryRangeList = salaryRangeList();
        List<String> hinderTypeList = hinderTypeList();
        List<String> hinderLevelList = hinderLevelList();
        List<String> enableDateList = enableDateList();
        List<String> eduBgList = eduBgList();

        // skills
        List<String> computerSkillList = computerSkillList();
        List<String> oaList = oaList();
        List<String> osList = osList();
        List<String> programList = programList();
        List<String> dbList = dbList();
        List<String> imageList = imageList();
        List<String> uiList = uiList();
        List<String> multimediaList = multimediaList();
        List<String> hardwareList = hardwareList();
        List<String> erpList = erpList();
        List<String> infoList = infoList();
        List<String> hardwareDevList = hardwareDevList();

        List<String> sexList = sexList();
        List<String> maritalStatusList = maritalStatusList();
        List<String> vateranStatusList = vateranStatusList();
        List<String> identityCategoryList = identityCategoryList();
        List<String> stillWorkingList = stillWorkingList();
        List<String> schoolStatusList = schoolStatusList();

        // language
        List<String> languageList = languageList();
        List<String> otherLanguageList = otherLanguageList();
        List<String> LanguageProficiencyList = LanguageProficiencyList();

        List<String> companySizeList = companySizeList();
        List<YearsListDTO> yearsList = newResumeService.getYearsList();
        List<LanguageProficiencyDTO> languageDtoList = new ArrayList<LanguageProficiencyDTO>();
        List<String> languageTypeList = new ArrayList<String>();

        // postType
        List<String> postTypeLevelList = postTypeLevelList();
        List<String> postTypeByManageList = postTypeByManageList();
        List<String> postTypeBySalesList = postTypeBySalesList();
        List<String> postTypeByComputerList = postTypeByComputerList();
        List<String> postTypeByMachineList = postTypeByMachineList();
        List<String> postTypeByPurchaseList = postTypeByPurchaseList();
        List<String> postTypeByMedicalList = postTypeByMedicalList();
        List<String> postTypeByTvList = postTypeByTvList();
        List<String> postTypeByLegalList = postTypeByLegalList();
        List<String> postTypeByPreschoolList = postTypeByPreschoolList();
        List<String> postTypeByLifeList = postTypeByLifeList();
        List<String> postTypeByfinanceList = postTypeByfinanceList();
        List<String> postTypeBySellList = postTypeBySellList();
        List<String> postTypeByIcList = postTypeByIcList();
        List<String> postTypeByMaintainList = postTypeByMaintainList();
        List<String> postTypeByBuildList = postTypeByBuildList();
        List<String> postTypeByBiologicalList = postTypeByBiologicalList();
        List<String> postTypeByArtList = postTypeByArtList();
        List<String> postTypeByEduList = postTypeByEduList();
        List<String> postTypeByCosmetologyList = postTypeByCosmetologyList();
        List<String> postTypeByPoliceList = postTypeByPoliceList();

        Hashtable<Integer, String> languageMap = MapTableArray.languageByUpdateMap();

        Hashtable<Integer, String> otherLanguageMap = MapTableArray.otherLanguageByUpdateMap();

        List<String> certificateByEnglishList = certificateByEnglishList();

        List<String> certificateByJapaneseList = certificateByJapaneseList();

        UpdateResumeDTO updateResumeDTO = updateResumeService.getResumeDetails(guid);
        // logger.info("show basic info id= "
        // + updateResumeDTO.getBasicInformation().getId());
        // logger.info("show basic info guid= "
        // + updateResumeDTO.getBasicInformation().getGuid());
        // logger.info("show basic info id= "
        // + updateResumeDTO.getContactInformation().getId());

        stillWorking = updateResumeDTO.getBasicInformation().isStillWorking() ? "(??)"
                : "()";
        HashMap<String, String> hinderMap = new HashMap<String, String>();
        hinderMap = setHinderData(updateResumeDTO.getBasicInformation().getHinder());
        hinderLevel = hinderMap.get("hinderLevel");
        hinderType = hinderMap.get("hinderType");
        logger.info("hinderLevel = " + hinderLevel);
        logger.info("hinderType = " + hinderType);

        // logger.info("experiences size = "
        // + updateResumeDTO.getExperiences().size());
        // String postType = "";
        setPostYearsData(updateResumeDTO.getExperiences());
        HashMap<String, Boolean> certificateByEnglishMap = new HashMap<String, Boolean>();
        HashMap<String, String> fractionByEnglishMap = new HashMap<String, String>();
        HashMap<String, Integer> idByEnglishMap = new HashMap<String, Integer>();
        HashMap<String, Boolean> certificateByJapaneseMap = new HashMap<String, Boolean>();
        HashMap<String, String> fractionByJapaneseMap = new HashMap<String, String>();
        HashMap<String, Integer> idByJapaneseMap = new HashMap<String, Integer>();

        logger.info("LanguageProficiencies size = " + updateResumeDTO.getLanguageProficiencies().size());

        for (LanguageProficiency temp : updateResumeDTO.getLanguageProficiencies()) {
            LanguageProficiencyDTO languageDto = new LanguageProficiencyDTO();
            languageDto.setId(temp.getId());
            // logger.info("LanguageProficiency id = " + languageDto.getId());
            languageDto.setLocal(languageMap.containsKey(temp.getLanguages()) ? false : true);

            if (languageDto.isLocal() == true) {
                languageDto.setLanguageType(otherLanguageMap.get(temp.getLanguages()));
            } else {
                languageDto.setLanguageType(languageMap.get(temp.getLanguages()));
            }
            String certificate = "", fraction = "";
            for (LanguageCertificates listens : updateResumeDTO.getLanguageCertificateses()) {
                if (determineLanguageTypeByEnglishAndName(languageDto.getLanguageType(), listens.getName())) {
                    if (certificateByEnglishList.contains(listens.getName())) {
                        certificateByEnglishMap.put(listens.getName(), true);
                        fractionByEnglishMap.put(listens.getName(), listens.getFraction());
                        idByEnglishMap.put(listens.getName(), listens.getId());
                    }

                    certificate += listens.getName() + " ";
                    fraction += listens.getFraction() + " ";

                    languageDto.setCertificate(certificate);
                    languageDto.setFraction(fraction);
                }

                if (determineLanguageTypeByJapaneseAndName(languageDto.getLanguageType(), listens.getName())) {
                    if (certificateByJapaneseList.contains(listens.getName())) {
                        certificateByJapaneseMap.put(listens.getName(), true);
                        fractionByJapaneseMap.put(listens.getName(), listens.getFraction());
                        idByJapaneseMap.put(listens.getName(), listens.getId());
                    }

                    certificate += listens.getName() + " ";
                    fraction += listens.getFraction() + " ";

                    languageDto.setCertificate(certificate);
                    languageDto.setFraction(fraction);
                }

            }

            languageDto.setListen(temp.getListen());
            languageDto.setSay(temp.getSay());
            languageDto.setReading(temp.getReading());
            languageDto.setWrite(temp.getWrite());
            languageDtoList.add(languageDto);
            languageTypeList.add(languageDto.getLanguageType());
        }

        modelMap.addAttribute("resumeDTO", updateResumeDTO);
        modelMap.addAttribute("hinderTypeList", hinderTypeList);
        modelMap.addAttribute("hinderLevelList", hinderLevelList);
        modelMap.addAttribute("enableDateList", enableDateList);
        modelMap.addAttribute("eduBgList", eduBgList);
        modelMap.addAttribute("salaryRangeList", salaryRangeList);
        // skills
        modelMap.addAttribute("computerSkillList", computerSkillList);
        modelMap.addAttribute("oaList", oaList);
        modelMap.addAttribute("osList", osList);
        modelMap.addAttribute("programList", programList);
        modelMap.addAttribute("dbList", dbList);
        modelMap.addAttribute("imageList", imageList);
        modelMap.addAttribute("uiList", uiList);
        modelMap.addAttribute("multimediaList", multimediaList);
        modelMap.addAttribute("hardwareList", hardwareList);
        modelMap.addAttribute("erpList", erpList);
        modelMap.addAttribute("infoList", infoList);
        modelMap.addAttribute("hardwareDevList", hardwareDevList);
        // language
        modelMap.addAttribute("languageList", languageList);
        modelMap.addAttribute("otherLanguageList", otherLanguageList);
        modelMap.addAttribute("LanguageProficiencyList", LanguageProficiencyList);
        modelMap.addAttribute("languageDtoList", languageDtoList);
        modelMap.addAttribute("languageTypeList", languageTypeList);

        modelMap.addAttribute("companySizeList", companySizeList);
        modelMap.addAttribute("yearsList", yearsList);

        modelMap.addAttribute("sexList", sexList);
        modelMap.addAttribute("maritalStatusList", maritalStatusList);
        modelMap.addAttribute("vateranStatusList", vateranStatusList);
        modelMap.addAttribute("identityCategoryList", identityCategoryList);

        // postType
        modelMap.addAttribute("postTypeLevelList", postTypeLevelList);
        modelMap.addAttribute("postTypeByManageList", postTypeByManageList);
        modelMap.addAttribute("postTypeBySalesList", postTypeBySalesList);
        modelMap.addAttribute("postTypeByComputerList", postTypeByComputerList);
        modelMap.addAttribute("postTypeByMachineList", postTypeByMachineList);
        modelMap.addAttribute("postTypeByPurchaseList", postTypeByPurchaseList);
        modelMap.addAttribute("postTypeByMedicalList", postTypeByMedicalList);
        modelMap.addAttribute("postTypeByTvList", postTypeByTvList);
        modelMap.addAttribute("postTypeByLegalList", postTypeByLegalList);
        modelMap.addAttribute("postTypeByPreschoolList", postTypeByPreschoolList);
        modelMap.addAttribute("postTypeByLifeList", postTypeByLifeList);
        modelMap.addAttribute("postTypeByfinanceList", postTypeByfinanceList);
        modelMap.addAttribute("postTypeBySellList", postTypeBySellList);
        modelMap.addAttribute("postTypeByIcList", postTypeByIcList);
        modelMap.addAttribute("postTypeByMaintainList", postTypeByMaintainList);
        modelMap.addAttribute("postTypeByBuildList", postTypeByBuildList);
        modelMap.addAttribute("postTypeByBiologicalList", postTypeByBiologicalList);
        modelMap.addAttribute("postTypeByArtList", postTypeByArtList);
        modelMap.addAttribute("postTypeByEduList", postTypeByEduList);
        modelMap.addAttribute("postTypeByCosmetologyList", postTypeByCosmetologyList);
        modelMap.addAttribute("postTypeByPoliceList", postTypeByPoliceList);

        modelMap.addAttribute("hinderLevel", hinderLevel);
        modelMap.addAttribute("hinderType", hinderType);
        modelMap.addAttribute("stillWorking", stillWorking);
        modelMap.addAttribute("stillWorkingList", stillWorkingList);
        modelMap.addAttribute("schoolStatusList", schoolStatusList);
        modelMap.addAttribute("postList", postList);
        modelMap.addAttribute("yearsList", yearsList);
        modelMap.addAttribute("certificateByEnglishMap", certificateByEnglishMap);
        modelMap.addAttribute("fractionByEnglishMap", fractionByEnglishMap);
        modelMap.addAttribute("idByEnglishMap", idByEnglishMap);
        modelMap.addAttribute("certificateByJapaneseMap", certificateByJapaneseMap);
        modelMap.addAttribute("fractionByJapaneseMap", fractionByJapaneseMap);
        modelMap.addAttribute("idByJapaneseMap", idByJapaneseMap);
        modelMap.addAttribute("certificateByEnglishList", certificateByEnglishList);
        modelMap.addAttribute("certificateByJapaneseList", certificateByJapaneseList);

        return "/front/updateResume";
    }

    public void setPostListDTO(String postName, int postYear) {
        YearsDTO postListDTO = new YearsDTO();
        postListDTO.setPost(postName);
        postListDTO.setYears(String.valueOf(postYear));
        postList.add(postListDTO);
    }

    public HashMap<String, String> setHinderData(String hinder) {
        HashMap<String, String> tempMap = new HashMap<String, String>();
        if (StringUtils.isNotEmpty(hinder)) {
            if (!hinder.equalsIgnoreCase("0,0")) {
                String[] hinderString = hinder.split(",");
                tempMap.put("hinderLevel", hinderString[0]);
                tempMap.put("hinderType", hinderString[1]);
            } else {
                tempMap.put("hinderLevel", "?");
                tempMap.put("hinderType", "?");
            }

        }
        return tempMap;
    }

    public boolean determineLanguageTypeByEnglishAndName(String type, String name) {
        if (type == "" && (name.equalsIgnoreCase("TOEIC") || name.equalsIgnoreCase("GPET")
                || name.equalsIgnoreCase("?IELTS"))) {
            return true;
        } else {
            return false;
        }
    }

    public boolean determineLanguageTypeByJapaneseAndName(String type, String name) {
        if (type == "" && (name.equalsIgnoreCase("JLPT N1")
                || name.equalsIgnoreCase("JLPT N2")
                || name.equalsIgnoreCase("JLPT N3")
                || name.equalsIgnoreCase("JLPT N4")
                || name.equalsIgnoreCase("JLPT N5"))) {
            return true;
        } else {
            return false;
        }
    }

    public void setPostYearsData(List<Experience> expList) {
        int postTypeByManageYears = 0, postTypeBySalesYears = 0, postTypeByComputerYears = 0,
                postTypeByMachineYears = 0, postTypeByPurchaseYears = 0, postTypeByMedicalYears = 0,
                postTypeByTvYears = 0, postTypeByLegalYears = 0, postTypeByPreschoolYears = 0,
                postTypeByLifeYears = 0, postTypeByfinanceYears = 0, postTypeBySellYears = 0, postTypeByIcYears = 0,
                postTypeByMaintainYears = 0, postTypeByBuildYears = 0, postTypeByBiologicalYears = 0,
                postTypeByArtYears = 0, postTypeByEduYears = 0, postTypeByCosmetologyYears = 0,
                postTypeByPoliceYears = 0;
        for (int i = 0; i < expList.size(); i++) {
            if ("?/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByManageYears += expList.get(i).getPostYears();
            } else if ("/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeBySalesYears += expList.get(i).getPostYears();
            } else if ("/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByComputerYears += expList.get(i).getPostYears();
            } else if ("/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByMachineYears += expList.get(i).getPostYears();
            } else if ("?/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByPurchaseYears += expList.get(i).getPostYears();
            } else if ("/???".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByMedicalYears += expList.get(i).getPostYears();
            } else if ("/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByTvYears += expList.get(i).getPostYears();
            } else if ("/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByLegalYears += expList.get(i).getPostYears();
            } else if ("??/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByPreschoolYears += expList.get(i).getPostYears();
            } else if ("?/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByLifeYears += expList.get(i).getPostYears();
            } else if ("??/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByfinanceYears += expList.get(i).getPostYears();
            } else if ("/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeBySellYears += expList.get(i).getPostYears();
            } else if ("IC/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByIcYears += expList.get(i).getPostYears();
            } else if ("/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByMaintainYears += expList.get(i).getPostYears();
            } else if ("/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByBuildYears += expList.get(i).getPostYears();
            } else if ("/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByBiologicalYears += expList.get(i).getPostYears();
            } else if ("/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByArtYears += expList.get(i).getPostYears();
            } else if ("/".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByEduYears += expList.get(i).getPostYears();
            } else if ("/??".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByCosmetologyYears += expList.get(i).getPostYears();
            } else if ("?/?".equalsIgnoreCase(expList.get(i).getPost())) {
                postTypeByPoliceYears += expList.get(i).getPostYears();
            }
        }

        postList = new ArrayList<YearsDTO>();
        setPostListDTO("?/", postTypeByManageYears);
        setPostListDTO("/?", postTypeBySalesYears);
        setPostListDTO("/", postTypeByComputerYears);
        setPostListDTO("/", postTypeByMachineYears);
        setPostListDTO("?/?", postTypeByPurchaseYears);
        setPostListDTO("/???", postTypeByMedicalYears);
        setPostListDTO("/", postTypeByTvYears);
        setPostListDTO("/?", postTypeByLegalYears);
        setPostListDTO("??/", postTypeByPreschoolYears);
        setPostListDTO("?/?", postTypeByLifeYears);
        setPostListDTO("??/", postTypeByfinanceYears);
        setPostListDTO("/?", postTypeBySellYears);
        setPostListDTO("IC/?", postTypeByIcYears);
        setPostListDTO("/?", postTypeByMaintainYears);
        setPostListDTO("/", postTypeByBuildYears);
        setPostListDTO("/", postTypeByBiologicalYears);
        setPostListDTO("/?", postTypeByArtYears);
        setPostListDTO("/", postTypeByEduYears);
        setPostListDTO("/??", postTypeByCosmetologyYears);
        setPostListDTO("?/?", postTypeByPoliceYears);
    }

    private List<Experience> getExperienceList(String sumExp) throws Exception {
        logger.info("enter getExperenceList method ");
        String[] exp = sumExp.split("~~~");
        List<Experience> experienceList = new ArrayList<Experience>();
        for (String expString : exp) {
            experienceList.add(getExperience(expString));
        }
        return experienceList;
    }

    private Experience getExperience(String oneExp) throws Exception {
        logger.info("enter getExperience method ");
        Experience expEntity = new Experience();
        String[] temp = oneExp.split("---");

        expEntity.setCompanyName(temp[0]);
        expEntity.setIndustrySectors(temp[1]);
        expEntity.setCompanyScale(temp[2]);
        expEntity.setWorkPlace(temp[3]);
        expEntity.setPost(temp[4]);
        expEntity.setServicePeriodBegin(sdf.parse(temp[5]));
        expEntity.setServicePeriodEnd(sdf.parse(temp[6]));
        expEntity.setAverageMonthlySalary(Integer.valueOf(temp[7]));
        expEntity.setTotalAnnualSalary(Integer.valueOf(temp[8]));
        expEntity.setWorkContent(temp[9]);
        String[] tempYears = temp[10].split("-");
        expEntity.setPostYears(Integer.valueOf(tempYears[0]));
        if (temp.length == 12) {
            // logger.info("exp id = " + temp[11]);
            expEntity.setId(Integer.valueOf(temp[11]));
        }
        expEntity.setCreateUser("System");
        expEntity.setCreateDate(new Date());
        return expEntity;
    }

    private List<LanguageProficiency> getLanguageProficiencyList(int memberId, String language,
            String otherLanguage) throws Exception {
        logger.info("enter getLanguageProficiencyList method ");
        List<LanguageProficiency> languageProficiencyList = new ArrayList<LanguageProficiency>();

        String[] allLanguage = language.split("~~~");

        for (String oneLanguage : allLanguage) {
            logger.info("allLanguage = " + oneLanguage);
            languageProficiencyList.add(getLanguageProficiencyByLanguage(oneLanguage, memberId));
        }
        String[] allOtherLanguage = otherLanguage.split("~~~");

        for (String otherOtherLanguage : allOtherLanguage) {
            logger.info("allOtherLanguage = " + otherOtherLanguage);
            languageProficiencyList.add(getLanguageProficiencyByOtherLanguage(otherOtherLanguage));
        }

        return languageProficiencyList;
    }

    private LanguageProficiency getLanguageProficiencyByLanguage(String oneLanguage, int memberId)
            throws Exception {
        logger.info("enter getLanguageProficiencyByLanguage method ");
        Hashtable<String, Integer> languageMap = MapTableArray.languageMap();
        LanguageProficiency languageProficiency = new LanguageProficiency();
        LanguageCertificates tempCreateLanguageCertificates = new LanguageCertificates();
        String[] allColumn = oneLanguage.split("---");

        languageProficiency.setLanguages(languageMap.get(allColumn[0].trim()));
        languageProficiency.setListen(allColumn[1]);
        languageProficiency.setSay(allColumn[2]);
        languageProficiency.setReading(allColumn[3]);
        languageProficiency.setWrite(allColumn[4]);
        if (allColumn.length == 6) {
            logger.info("allColumn length is six. ");
            languageProficiency.setId(Integer.valueOf(allColumn[5]));
        } else if (allColumn.length == 7) {
            logger.info("allColumn length is seven. ");
            tempCreateLanguageCertificates.setName(allColumn[5]);
            tempCreateLanguageCertificates.setFraction(allColumn[6]);
            tempCreateLanguageCertificates.setMemberId(memberId);
        }
        languageProficiency.setCreateUser("System");
        languageProficiency.setCreateDate(new Date());

        LanguageProficiencyDTO languageUTO = new LanguageProficiencyDTO();
        languageUTO.setLanguageType(allColumn[0]);
        languageUTO.setListen(allColumn[1]);
        languageUTO.setSay(allColumn[2]);
        languageUTO.setReading(allColumn[3]);
        languageUTO.setWrite(allColumn[4]);
        languageUTO.setLocal(false);
        if (allColumn.length == 7) {
            logger.info("Certificate = " + allColumn[5]);
            logger.info("Fraction = " + allColumn[6]);
            languageUTO.setCertificate(allColumn[5]);
            languageUTO.setFraction(allColumn[6]);
        }
        languageDtoList.add(languageUTO);
        tempCreateLanguageCertificatesList.add(tempCreateLanguageCertificates);
        return languageProficiency;
    }

    private LanguageProficiency getLanguageProficiencyByOtherLanguage(String oneOtherLanguage) throws Exception {
        logger.info("enter getLanguageProficiencyByOtherLanguage method ");
        Hashtable<String, Integer> otherLanguageMap = MapTableArray.otherLanguageMap();
        LanguageProficiency languageProficiency = new LanguageProficiency();
        String[] allColumn = oneOtherLanguage.split("---");
        logger.info("allColumn by other language = " + allColumn[0]);
        languageProficiency.setLanguages(otherLanguageMap.get(allColumn[0].trim()));
        languageProficiency.setListen(allColumn[1]);
        if (allColumn.length == 3) {
            languageProficiency.setId(Integer.valueOf(allColumn[2]));
        }
        languageProficiency.setCreateDate(new Date());
        languageProficiency.setCreateUser("System");
        LanguageProficiencyDTO languageUTO = new LanguageProficiencyDTO();
        languageUTO.setLanguageType(allColumn[0]);
        languageUTO.setListen(allColumn[1]);

        languageUTO.setLocal(true);
        languageDtoList.add(languageUTO);

        return languageProficiency;
    }

    private List<LanguageCertificates> getLanguageCertificates(String certificatesByEnglish,
            String certificatesByJapanese) throws Exception {
        //logger.info("enter getLanguageCertificates method ");
        LanguageCertificates tempByEnglish = null;
        List<LanguageCertificates> languageCertificatesList = new ArrayList<LanguageCertificates>();
        String[] allCertificatesByEnglish = certificatesByEnglish.split("~~~");
        for (String oneCertificatesByEnglish : allCertificatesByEnglish) {
            tempByEnglish = getLanguageCertificatesByEnglish(oneCertificatesByEnglish);
            if (tempByEnglish != null) {
                languageCertificatesList.add(tempByEnglish);
            }
        }

        LanguageCertificates tempByJapanese = null;
        String[] allCertificatesByJapanese = certificatesByJapanese.split("~~~");
        for (String oneCertificatesByJapanese : allCertificatesByJapanese) {
            tempByJapanese = getLanguageCertificatesByJapanese(oneCertificatesByJapanese);
            if (tempByJapanese != null) {
                languageCertificatesList.add(tempByJapanese);
            }
        }

        if (tempCreateLanguageCertificatesList != null) {
            for (LanguageCertificates temp : tempCreateLanguageCertificatesList) {
                languageCertificatesList.add(temp);
            }
        }

        return languageCertificatesList;
    }

    private LanguageCertificates getLanguageCertificatesByEnglish(String oneCertificatesByEnglish)
            throws Exception {
        //logger.info("enter getLanguageCertificatesByEnglish method ");
        String[] allColumnByEnglish = oneCertificatesByEnglish.split("---");
        if (StringUtils.isNotEmpty(allColumnByEnglish[0].toString())
                || StringUtils.isNotEmpty(allColumnByEnglish[1].toString())
                || StringUtils.isNotEmpty(allColumnByEnglish[2].toString())) {
            LanguageCertificates languageCertificates = new LanguageCertificates();
            if (StringUtils.isNotEmpty(allColumnByEnglish[0].toString())) {
                languageCertificates.setId(Integer.valueOf(allColumnByEnglish[0].toString()));
            }
            languageCertificates.setName(allColumnByEnglish[1]);
            languageCertificates.setFraction(allColumnByEnglish[2]);
            certificatesByEnglish += allColumnByEnglish[1];
            fractionsByEnglish += allColumnByEnglish[2];
            // logger.info("certificatesByEnglish = " + certificatesByEnglish);
            // logger.info("fractionsByEnglish = " + fractionsByEnglish);
            for (int i = 0; i < languageDtoList.size(); i++) {
                if (languageDtoList.get(i).getLanguageType().trim().equalsIgnoreCase("")) {
                    languageDtoList.get(i).setCertificate(certificatesByEnglish);
                    languageDtoList.get(i).setFraction(fractionsByEnglish);
                }
            }
            return languageCertificates;
        } else {
            return null;
        }

    }

    private LanguageCertificates getLanguageCertificatesByJapanese(String oneCertificatesByJapanese)
            throws Exception {
        //logger.info("enter getLanguageCerticatesByJapanese method ");
        String[] allColumnByJapanese = oneCertificatesByJapanese.split("---");
        if (StringUtils.isNotEmpty(allColumnByJapanese[0].toString())
                || StringUtils.isNotEmpty(allColumnByJapanese[1].toString())
                || StringUtils.isNotEmpty(allColumnByJapanese[2].toString())) {
            LanguageCertificates languageCertificates = new LanguageCertificates();
            if (StringUtils.isNotEmpty(allColumnByJapanese[0].toString())) {
                languageCertificates.setId(Integer.valueOf(allColumnByJapanese[0].toString()));
            }
            languageCertificates.setName(allColumnByJapanese[1]);
            languageCertificates.setFraction(allColumnByJapanese[2]);
            certificatesByJapanese += allColumnByJapanese[1];
            fractionsByJapanese += allColumnByJapanese[2];
            //          logger.info("certificatesByJapanese = " +certificatesByJapanese);
            //          logger.info("fractionsByJapanese = " + fractionsByJapanese);
            if (StringUtils.isNotBlank(certificatesByJapanese) && StringUtils.isNotBlank(fractionsByJapanese)) {
                for (int i = 0; i < languageDtoList.size(); i++) {
                    if (languageDtoList.get(i).getLanguageType().trim().equalsIgnoreCase("")) {
                        languageDtoList.get(i).setCertificate(certificatesByJapanese);
                        languageDtoList.get(i).setFraction(fractionsByJapanese);
                    }
                }
            }

            return languageCertificates;
        } else {
            return null;
        }

    }

    private List<ProjectExperience> getProjectExperienceList(String sumProject) throws Exception {
        logger.info("enter getLanguageExperienceList method ");
        List<ProjectExperience> projectExperienceList = new ArrayList<ProjectExperience>();
        String[] allProject = sumProject.split("~~~");
        for (String oneProject : allProject) {
            projectExperienceList.add(getProjectExperience(oneProject));
        }
        return projectExperienceList;
    }

    private ProjectExperience getProjectExperience(String oneProject) throws Exception {
        logger.info("enter getLanguageProficiencyExperience method ");
        ProjectExperience projectExperience = new ProjectExperience();
        String[] allColumn = oneProject.split("---");
        projectExperience.setCustomerProjectName(allColumn[0]);
        projectExperience.setParticipationDuringBegin(sdf.parse(allColumn[1]));
        projectExperience
                .setParticipationDuringEnd(StringUtils.isBlank(allColumn[2]) ? null : sdf.parse(allColumn[2]));
        projectExperience.setProjectRoles(allColumn[3]);
        projectExperience.setWorkContent(allColumn[4]);
        projectExperience.setTechnologyAndEnvironment(allColumn[5]);
        if (allColumn.length == 7) {
            projectExperience.setId(Integer.valueOf(allColumn[6]));
        }
        return projectExperience;
    }

}