diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/ExcelFileSection.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/ExcelFileSection.java index 9e9c052d2f8fd6b00f989620ab65c4c1d0fc3e7a..8f8282d67b6aeaaa670690c9e1760b78e30ec517 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/ExcelFileSection.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/ExcelFileSection.java @@ -112,7 +112,7 @@ public class ExcelFileSection List<ExcelFileSection> defaultSheetSections = null; Sheet sheet = null; - String prefix = excelSheetName + "-"; + String prefix = excelSheetName; for (int i = 0; i < wb.getNumberOfSheets(); i++) { String sheetName = wb.getSheetName(i); @@ -120,9 +120,9 @@ public class ExcelFileSection { sheet = wb.getSheetAt(i); defaultSheetSections = extractSectionsFromDefaultSheet(sheet); - } else if (sheetName.startsWith(prefix)) + } else if (sheetName.toUpperCase().startsWith(prefix.toUpperCase())) { - String sectionName = sheetName.substring(prefix.length()); + String sectionName = sheetName.substring(prefix.length() + 1); sheet = wb.getSheetAt(i); if (SECTION_FILE_DEFAULT.equalsIgnoreCase(sectionName)) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/MaterialUploadSectionsParser.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/MaterialUploadSectionsParser.java index 7008fe4b90d1ffc92d865c0cfd5812a5eb3bbfdb..1d7422bc0d7307dbd05f2666a2d04a4f16ee6046 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/MaterialUploadSectionsParser.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/MaterialUploadSectionsParser.java @@ -111,6 +111,7 @@ public class MaterialUploadSectionsParser { final String fileName = multipartFile.getOriginalFilename(); final String loweredFileName = fileName.toLowerCase(); + String registrationMessage = "Registration/update of %d material(s) is complete."; if (loweredFileName.endsWith("xls") || loweredFileName.endsWith("xlsx")) { List<ExcelFileSection> materialSections = new ArrayList<ExcelFileSection>(); @@ -164,7 +165,7 @@ public class MaterialUploadSectionsParser } } results.add(new BatchRegistrationResult(fileName, String.format( - "Registration of %d material(s) is complete.", materialCounter))); + registrationMessage, materialCounter))); } else { @@ -217,7 +218,7 @@ public class MaterialUploadSectionsParser } } results.add(new BatchRegistrationResult(fileName, String.format( - "Registration of %d material(s) is complete.", materialCounter))); + registrationMessage, materialCounter))); } } return results; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java index dafb53f7661730c3cb7b884af189052af5c2590f..4c7d343f81ea8460056a2be9719a492dddf76e07 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java @@ -16,6 +16,7 @@ package ch.systemsx.cisd.openbis.plugin.generic.server; +import java.io.IOException; import java.io.Writer; import java.util.ArrayList; import java.util.Arrays; @@ -799,13 +800,31 @@ public final class GenericServer extends AbstractServer<IGenericServer> implemen { public String getName() { - return "General Import"; + return "General Batch Import"; } public boolean doAction(Writer messageWriter) { - genericServer.registerOrUpdateSamplesAndMaterials(sessionToken, - newSamplesWithType, newMaterialsWithType); + try + { + genericServer.registerOrUpdateSamplesAndMaterials(sessionToken, + newSamplesWithType, newMaterialsWithType); + } catch (RuntimeException ex) + { + try + { + messageWriter.write(getName() + + " has failed with a following exception: "); + messageWriter.write(ex.getMessage()); + messageWriter + .write("\n\nPlease correct the error or contact your administrator."); + } catch (IOException writingEx) + { + throw new UserFailureException(writingEx.getMessage() + + " when trying to throw exception: " + ex.getMessage(), ex); + } + throw ex; + } return true; } }); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js index 65351df382fc28f6d719114037a7d94b68148615..93a24845333683cc1fba7190944f79f743aa5dc7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js @@ -454,7 +454,7 @@ var common = { ARCHIVING_MENU_LOCK: "Disable", ARCHIVING_MENU_UNLOCK: "Enable", - GENERAL_IMPORT_MENU: "General Import", + GENERAL_IMPORT_MENU: "General Batch Import", menu_modules: "Utilities",