diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/export/Attribute.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/export/Attribute.java index 9318e05fbcdc8b2682737b606ebade740599fc71..1053b6d1d8186588bc8d5b8d77d653fb6dc0a17c 100644 --- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/export/Attribute.java +++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/export/Attribute.java @@ -20,69 +20,69 @@ package ch.ethz.sis.openbis.generic.server.xls.export; public enum Attribute { - $("$", true, true), + $("$", true, true, false), - ARCHIVING_STATUS("Archiving status", false, false), + ARCHIVING_STATUS("Archiving status", false, false, true), - AUTO_GENERATE_CODES("Auto generate codes", true, true), + AUTO_GENERATE_CODES("Auto generate codes", true, true, false), - CHILDREN("Children", true, false), + CHILDREN("Children", true, false, true), - CODE("Code", true, true), + CODE("Code", true, true, true), - DESCRIPTION("Description", true, true), + DESCRIPTION("Description", true, true, true), - DISALLOW_DELETION("Disallow Deletion", false, false), + DISALLOW_DELETION("Disallow Deletion", false, false, true), - EXPERIMENT("Experiment", true, false), + EXPERIMENT("Experiment", true, false, true), - GENERATE_CODES("Generate Codes", false, false), + GENERATE_CODES("Generate Codes", false, false, true), - GENERATED_CODE_PREFIX("Generated code prefix", true, true), + GENERATED_CODE_PREFIX("Generated code prefix", true, true, true), - IDENTIFIER("Identifier", true, true), + IDENTIFIER("Identifier", true, true, true), - LABEL("Label", true, true), + LABEL("Label", true, true, true), - MAIN_DATA_SET_PATH("Main Data Set Path", false, false), + MAIN_DATA_SET_PATH("Main Data Set Path", false, false, true), - MAIN_DATA_SET_PATTERN("Main Data Set Pattern", false, false), + MAIN_DATA_SET_PATTERN("Main Data Set Pattern", false, false, true), - MODIFICATION_DATE("Modification Date", false, false), + MODIFICATION_DATE("Modification Date", false, false, true), - MODIFIER("Modifier", false, false), + MODIFIER("Modifier", false, false, true), - ONTOLOGY_ID("Ontology ID", true, false), + ONTOLOGY_ID("Ontology ID", true, false, true), - ONTOLOGY_VERSION("Ontology Version", true, false), + ONTOLOGY_VERSION("Ontology Version", true, false, true), - ONTOLOGY_ANNOTATION_ID("Ontology Annotation Id", true, false), + ONTOLOGY_ANNOTATION_ID("Ontology Annotation Id", true, false, true), - PARENTS("Parents", true, false), + PARENTS("Parents", true, false, true), - PERM_ID("PermId", false, false), + PERM_ID("PermId", false, false, true), - PRESENT_IN_ARCHIVE("Present in archive", true, false), + PRESENT_IN_ARCHIVE("Present in archive", true, false, true), - PROJECT("Project", true, true), + PROJECT("Project", true, true, true), - REGISTRATION_DATE("Registration Date", false, false), + REGISTRATION_DATE("Registration Date", false, false, true), - REGISTRATOR("Registrator", false, false), + REGISTRATOR("Registrator", false, false, true), - SAMPLE("Sample", false, false), + SAMPLE("Sample", false, false, true), - SPACE("Space", true, true), + SPACE("Space", true, true, true), - STORAGE_CONFIRMATION("Storage confirmation", false, false), + STORAGE_CONFIRMATION("Storage confirmation", false, false, true), - UNIQUE_SUBCODES("Unique Subcodes", false, false), + UNIQUE_SUBCODES("Unique Subcodes", false, false, true), - URL_TEMPLATE("URL Template", false, false), + URL_TEMPLATE("URL Template", false, false, true), - VALIDATION_SCRIPT("Validation script", true, true), + VALIDATION_SCRIPT("Validation script", true, true, true), - VERSION("Version", true, true); + VERSION("Version", true, true, false); final String name; @@ -90,11 +90,14 @@ public enum Attribute final boolean requiredForImport; - Attribute(final String name, final boolean importable, final boolean requiredForImport) + final boolean includeInDefaultList; + + Attribute(final String name, final boolean importable, final boolean requiredForImport, final boolean includeInDefaultList) { this.name = name; this.importable = importable; this.requiredForImport = requiredForImport; + this.includeInDefaultList = includeInDefaultList; } public String getName() @@ -112,4 +115,8 @@ public enum Attribute return requiredForImport; } + public boolean isIncludeInDefaultList() + { + return includeInDefaultList; + } } diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/AbstractXLSEntityExportHelper.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/AbstractXLSEntityExportHelper.java index 424c4564349adc8a0f5807a1c036c13bb4097b71..dbcc1a1eca95b050f0da7d42c5490520242c4c72 100644 --- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/AbstractXLSEntityExportHelper.java +++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/AbstractXLSEntityExportHelper.java @@ -91,7 +91,9 @@ public abstract class AbstractXLSEntityExportHelper<ENTITY extends IPermIdHolder // Headers final Attribute[] importableAttributes = Arrays.stream(possibleAttributes).filter(Attribute::isImportable) .toArray(Attribute[]::new); - final Attribute[] attributes = compatibleWithImport ? importableAttributes : possibleAttributes; + final Attribute[] defaultPossibleAttributes = Arrays.stream(possibleAttributes).filter(Attribute::isIncludeInDefaultList) + .toArray(Attribute[]::new); + final Attribute[] attributes = compatibleWithImport ? importableAttributes : defaultPossibleAttributes; final String[] fieldHeaders = Stream.concat( Arrays.stream(attributes).map(Attribute::getName), diff --git a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/generic/server/xls/export/resources/export-sample.xlsx b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/generic/server/xls/export/resources/export-sample.xlsx index 009bd2ed680e267a74920601d44e55d1693df698..ce75bbec3c14d1568bf9c66eb80feed5d1e4807c 100644 Binary files a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/generic/server/xls/export/resources/export-sample.xlsx and b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/generic/server/xls/export/resources/export-sample.xlsx differ