@Test public void testCreateHeaderMapWithAuthorSheet() throws Exception { Map<Integer, UploadFileHeader> headerRowMap = uploadSheetProcessor.createHeaderMap(authorDepositedSheet.getRow(0)); assertThat(headerRowMap).isNotEmpty().hasSize(16); assertThat(headerRowMap).containsValues(UploadFileHeader.SNP, UploadFileHeader.CHR, UploadFileHeader.BP, UploadFileHeader.GENOME_BUILD, UploadFileHeader.EFFECT_ALLELE, UploadFileHeader.OTHER_ALLELES, UploadFileHeader.EFFECT_ELEMENT_FREQUENCY_IN_CONTROLS, UploadFileHeader.PVALUE_MANTISSA, UploadFileHeader.PVALUE_EXPONENT, UploadFileHeader.OR, UploadFileHeader.BETA, UploadFileHeader.BETA_UNIT, UploadFileHeader.BETA_DIRECTION, UploadFileHeader.STANDARD_ERROR, UploadFileHeader.RANGE, UploadFileHeader.PVALUE_DESCRIPTION); }
@Override public Map<Integer, UploadFileHeader> createHeaderMap(XSSFRow row) { Map<Integer, UploadFileHeader> headerMap = new HashMap<>(); if (row.getPhysicalNumberOfCells() != 0) { short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for (short colIx = minColIx; colIx < maxColIx; colIx++) { XSSFCell cell = row.getCell(colIx); UploadFileHeader headerType = translateUploadHeaders.translateToEnumValue(cell.getStringCellValue().trim()); headerMap.put((int) colIx, headerType); } } else { getLog().error("Header column contains no cells"); } return headerMap; }
SheetProcessorImpl implements UploadSheetProcessor { @Override public Map<Integer, UploadFileHeader> createHeaderMap(XSSFRow row) { Map<Integer, UploadFileHeader> headerMap = new HashMap<>(); if (row.getPhysicalNumberOfCells() != 0) { short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for (short colIx = minColIx; colIx < maxColIx; colIx++) { XSSFCell cell = row.getCell(colIx); UploadFileHeader headerType = translateUploadHeaders.translateToEnumValue(cell.getStringCellValue().trim()); headerMap.put((int) colIx, headerType); } } else { getLog().error("Header column contains no cells"); } return headerMap; } }
SheetProcessorImpl implements UploadSheetProcessor { @Override public Map<Integer, UploadFileHeader> createHeaderMap(XSSFRow row) { Map<Integer, UploadFileHeader> headerMap = new HashMap<>(); if (row.getPhysicalNumberOfCells() != 0) { short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for (short colIx = minColIx; colIx < maxColIx; colIx++) { XSSFCell cell = row.getCell(colIx); UploadFileHeader headerType = translateUploadHeaders.translateToEnumValue(cell.getStringCellValue().trim()); headerMap.put((int) colIx, headerType); } } else { getLog().error("Header column contains no cells"); } return headerMap; } @Autowired  SheetProcessorImpl(TranslateUploadHeaders translateUploadHeaders); }
SheetProcessorImpl implements UploadSheetProcessor { @Override public Map<Integer, UploadFileHeader> createHeaderMap(XSSFRow row) { Map<Integer, UploadFileHeader> headerMap = new HashMap<>(); if (row.getPhysicalNumberOfCells() != 0) { short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for (short colIx = minColIx; colIx < maxColIx; colIx++) { XSSFCell cell = row.getCell(colIx); UploadFileHeader headerType = translateUploadHeaders.translateToEnumValue(cell.getStringCellValue().trim()); headerMap.put((int) colIx, headerType); } } else { getLog().error("Header column contains no cells"); } return headerMap; } @Autowired  SheetProcessorImpl(TranslateUploadHeaders translateUploadHeaders); @Override Collection<AssociationUploadRow> readSheetRows(XSSFSheet sheet); @Override Map<Integer, UploadFileHeader> createHeaderMap(XSSFRow row); }
SheetProcessorImpl implements UploadSheetProcessor { @Override public Map<Integer, UploadFileHeader> createHeaderMap(XSSFRow row) { Map<Integer, UploadFileHeader> headerMap = new HashMap<>(); if (row.getPhysicalNumberOfCells() != 0) { short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for (short colIx = minColIx; colIx < maxColIx; colIx++) { XSSFCell cell = row.getCell(colIx); UploadFileHeader headerType = translateUploadHeaders.translateToEnumValue(cell.getStringCellValue().trim()); headerMap.put((int) colIx, headerType); } } else { getLog().error("Header column contains no cells"); } return headerMap; } @Autowired  SheetProcessorImpl(TranslateUploadHeaders translateUploadHeaders); @Override Collection<AssociationUploadRow> readSheetRows(XSSFSheet sheet); @Override Map<Integer, UploadFileHeader> createHeaderMap(XSSFRow row);  }