Skip to content

Commit

Permalink
GGW-369: Resolve project saving ajax issue
Browse files Browse the repository at this point in the history
  • Loading branch information
brianbrix committed Nov 6, 2024
1 parent 8458843 commit 8e29ef9
Showing 1 changed file with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,41 +340,41 @@ public void onClick(AjaxRequestTarget target) {

@Override
protected void onSubmit() {
FileUpload upload = new FileUploadField("fileUpload").getFileUpload();
if (upload == null) {
logger.info("No file uploaded");
} else {
logger.info("File-Name: " + upload.getClientFileName() + " File-Size: " +
Bytes.bytes(upload.getSize()));
try {
XSSFWorkbook workbook = new XSSFWorkbook(upload.getInputStream());
XSSFSheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.iterator();
rowIterator.next();

while (rowIterator.hasNext()) {
XSSFRow row = (XSSFRow) rowIterator.next();
String title = getStringValueFromCell(row.getCell(0));
String description = getStringValueFromCell(row.getCell(1));
String latitude = getStringValueFromCell(row.getCell(2));
String longitude = getStringValueFromCell(row.getCell(3));

AmpStructure stru = new AmpStructure();
stru.setTitle(title);
stru.setDescription(description);
stru.setLatitude(latitude);
stru.setLongitude(longitude);
list.addItem(stru);
list.goToLastPage();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
// FileUpload upload = new FileUploadField("fileUpload").getFileUpload();
// if (upload == null) {
// logger.info("No file uploaded");
// } else {
// logger.info("File-Name: " + upload.getClientFileName() + " File-Size: " +
// Bytes.bytes(upload.getSize()));
// try {
// XSSFWorkbook workbook = new XSSFWorkbook(upload.getInputStream());
// XSSFSheet sheet = workbook.getSheetAt(0);
// Iterator<Row> rowIterator = sheet.iterator();
// rowIterator.next();
//
// while (rowIterator.hasNext()) {
// XSSFRow row = (XSSFRow) rowIterator.next();
// String title = getStringValueFromCell(row.getCell(0));
// String description = getStringValueFromCell(row.getCell(1));
// String latitude = getStringValueFromCell(row.getCell(2));
// String longitude = getStringValueFromCell(row.getCell(3));
//
// AmpStructure stru = new AmpStructure();
// stru.setTitle(title);
// stru.setDescription(description);
// stru.setLatitude(latitude);
// stru.setLongitude(longitude);
// list.addItem(stru);
// list.goToLastPage();
// }
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// }
}
};

form.setMultiPart(true);
// form.setMultiPart(true);
form.setMaxSize(Bytes.megabytes(10));
// form.add(fileUploadField);

Expand Down

0 comments on commit 8e29ef9

Please sign in to comment.