@Test public void shouldReturnCellDisplayGivenData(){ CellMeta cellMeta = new CellMeta(0, "facilityName", "facility2", false); Map<String, String> data = new HashMap<>(); data.put("facilityName", "facility1"); Row dataRow = tempSheet.createRow(1); Cell rowCell = util.createRowCell(cellMeta, data, dataRow); assertThat(rowCell.getStringCellValue(), is("facility2")); }
public Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow) { logger.debug("createRowCell = [" + cellMeta + "]"); Cell cell = dataRow.createCell(cellMeta.getColumn()); if (cellMeta.isVariable()) { String key = cellMeta.getName(); if (key != null && key.length() > 0) { Object tmp = data.get(key); String cellData = ( tmp == null? "" : tmp.toString()); cell.setCellValue(cellData); } } else { cell.setCellValue(cellMeta.getDisplay()); } return cell; }
SingleListSheetExcelHandler extends ExcelHandler { public Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow) { logger.debug("createRowCell = [" + cellMeta + "]"); Cell cell = dataRow.createCell(cellMeta.getColumn()); if (cellMeta.isVariable()) { String key = cellMeta.getName(); if (key != null && key.length() > 0) { Object tmp = data.get(key); String cellData = ( tmp == null? "" : tmp.toString()); cell.setCellValue(cellData); } } else { cell.setCellValue(cellMeta.getDisplay()); } return cell; } }
SingleListSheetExcelHandler extends ExcelHandler { public Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow) { logger.debug("createRowCell = [" + cellMeta + "]"); Cell cell = dataRow.createCell(cellMeta.getColumn()); if (cellMeta.isVariable()) { String key = cellMeta.getName(); if (key != null && key.length() > 0) { Object tmp = data.get(key); String cellData = ( tmp == null? "" : tmp.toString()); cell.setCellValue(cellData); } } else { cell.setCellValue(cellMeta.getDisplay()); } return cell; }  }
SingleListSheetExcelHandler extends ExcelHandler { public Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow) { logger.debug("createRowCell = [" + cellMeta + "]"); Cell cell = dataRow.createCell(cellMeta.getColumn()); if (cellMeta.isVariable()) { String key = cellMeta.getName(); if (key != null && key.length() > 0) { Object tmp = data.get(key); String cellData = ( tmp == null? "" : tmp.toString()); cell.setCellValue(cellData); } } else { cell.setCellValue(cellMeta.getDisplay()); } return cell; }  void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList); Map<String, CellMeta> parseTemplateVariables(Sheet tempSheet); Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow); }
SingleListSheetExcelHandler extends ExcelHandler { public Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow) { logger.debug("createRowCell = [" + cellMeta + "]"); Cell cell = dataRow.createCell(cellMeta.getColumn()); if (cellMeta.isVariable()) { String key = cellMeta.getName(); if (key != null && key.length() > 0) { Object tmp = data.get(key); String cellData = ( tmp == null? "" : tmp.toString()); cell.setCellValue(cellData); } } else { cell.setCellValue(cellMeta.getDisplay()); } return cell; }  void createDataRows(Sheet tempSheet, List<Map<String, String>> dataList); Map<String, CellMeta> parseTemplateVariables(Sheet tempSheet); Cell createRowCell(CellMeta cellMeta, Map<String, String> data, Row dataRow);  }