@Override public List<SeekerAimsTO> buildParticipants() throws Exception { boolean mark = false; List<Row> participantRows = new ArrayList<Row>(); for (int i = 0; i < sheetParticipants.getLastRowNum(); i++) { Row row = sheetParticipants.getRow(i); if (mark) { if (row != null) { participantRows.add(row); } } if (row != null && row.getCell(ParticipantCols.NAME.getColumn()) != null) { String string = row.getCell(ParticipantCols.NAME.getColumn()).toString(); if (string.contains(ParticipantCols.NAME.getHeader())) { mark = true; } if (mark) { if (row == null || (row.getCell(ParticipantCols.NAME.getColumn()) == null) || row.getCell(ParticipantCols.NAME.getColumn()).toString().isEmpty()) { mark = false; } } } } ProgramHeaderTO buildProgramDetails = buildProgramDetails(); List<SeekerAimsTO> processRows = processRows(participantRows); for (SeekerAimsTO seekerAims : processRows) { seekerAims.setCountry(buildProgramDetails.getCountry()); } sLogger.info("Participant list:" + participantRows.size()); return processRows; }
/** @param row */ private SeekerAimsTO buildParticipant(Row row) { SeekerAimsTO seekerTo = new SeekerAimsTO(); Cell cellName = row.getCell(ParticipantCols.NAME.getColumn()); seekerTo.setFirstName(validateNull(cellName)); Cell cellCity = row.getCell(ParticipantCols.CITY.getColumn()); seekerTo.setCity(validateNull(cellCity)); Cell cellState = row.getCell(ParticipantCols.STATE.getColumn()); seekerTo.setState(validateNull(cellState)); Cell cellEmail = row.getCell(ParticipantCols.EMAIL.getColumn()); seekerTo.setEmail(validateNull(cellEmail)); Cell cellPhone = row.getCell(ParticipantCols.MOBILE.getColumn()); populatePhone(seekerTo, cellPhone); Cell cellIntroduced = row.getCell(ParticipantCols.THIRD_SITTING.getColumn()); if (cellIntroduced.getStringCellValue() != null && !cellIntroduced.getStringCellValue().isEmpty() && cellIntroduced.getStringCellValue().contains("Y")) { seekerTo.setIntroduced(Boolean.TRUE); } Cell cellAge = row.getCell(ParticipantCols.AGE_GROUP.getColumn()); seekerTo.setAgeGroup(validateNull(cellAge)); Cell cellBatchYear = row.getCell(ParticipantCols.BATCH_YEAR.getColumn()); seekerTo.setBatchOrYear(validateNull(cellBatchYear)); Cell cellGender = row.getCell(ParticipantCols.GENDER.getColumn()); seekerTo.setGender(validateNull(cellGender)); Cell cellDepartment = row.getCell(ParticipantCols.DEPARTMENT.getColumn()); seekerTo.setDepartment(validateNull(cellDepartment)); Cell cellPrefLang = row.getCell(ParticipantCols.PREF_LANGUAGE.getColumn()); seekerTo.setPreferredLanguageForCommunication(validateNull(cellPrefLang)); Cell cellReceiveUpdates = row.getCell(ParticipantCols.RECEIVE_UPDATES.getColumn()); String recUpdates = validateNull(cellReceiveUpdates); if ("Y".equalsIgnoreCase(recUpdates.trim().toUpperCase())) { seekerTo.setReceiveUpddates(Boolean.TRUE); } setWelcomeCardIssuedDate(row, seekerTo); Cell cellOcc = row.getCell(ParticipantCols.PROFFESION.getColumn()); seekerTo.setOccupation(validateNull(cellOcc)); Cell cellRemarks = row.getCell(ParticipantCols.REMARKS.getColumn()); seekerTo.setRemarks(validateNull(cellRemarks)); Cell cellWelcomeCardNo = row.getCell(ParticipantCols.WELCOME_CARD_NUMBER.getColumn()); seekerTo.setWelcomeCardNo(validateNull(cellWelcomeCardNo)); return seekerTo; }