@Test public void testCreateHeaderMapWithCuratorSheet() throws Exception { Map<Integer, UploadFileHeader> headerRowMap = uploadSheetProcessor.createHeaderMap(curatorSheet.getRow(0)); assertThat(headerRowMap).isNotEmpty().hasSize(23); assertThat(headerRowMap).containsValues(UploadFileHeader.GENES, UploadFileHeader.EFFECT_ALLELE, UploadFileHeader.SNP, UploadFileHeader.PROXY_SNP, UploadFileHeader.INDEPENDENT_SNP_EFFECT_ALLELE_FREQUENCY_IN_CONTROLS, UploadFileHeader.EFFECT_ELEMENT_FREQUENCY_IN_CONTROLS, UploadFileHeader.PVALUE_MANTISSA, UploadFileHeader.PVALUE_EXPONENT, UploadFileHeader.PVALUE_DESCRIPTION, UploadFileHeader.OR, UploadFileHeader.OR_RECIPROCAL, UploadFileHeader.BETA, UploadFileHeader.BETA_UNIT, UploadFileHeader.BETA_DIRECTION, UploadFileHeader.RANGE, UploadFileHeader.OR_RECIPROCAL_RANGE, UploadFileHeader.STANDARD_ERROR, UploadFileHeader.DESCRIPTION, UploadFileHeader.MULTI_SNP_HAPLOTYPE, UploadFileHeader.SNP_INTERACTION, UploadFileHeader.SNP_STATUS, UploadFileHeader.SNP_TYPE, UploadFileHeader.EFO_TRAITS); }
@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);  }