diff --git a/common/source/java/ch/systemsx/cisd/common/parser/AbstractParserObjectFactory.java b/common/source/java/ch/systemsx/cisd/common/parser/AbstractParserObjectFactory.java index fa71d2490eabb9077b64c0b7e21a9812e7f8aa51..09174265d516116d8b75f444cc13aa00c0ca7b5b 100644 --- a/common/source/java/ch/systemsx/cisd/common/parser/AbstractParserObjectFactory.java +++ b/common/source/java/ch/systemsx/cisd/common/parser/AbstractParserObjectFactory.java @@ -35,7 +35,8 @@ import ch.systemsx.cisd.common.utilities.ClassUtils; */ public abstract class AbstractParserObjectFactory<E> implements IParserObjectFactory<E> { - protected static final String DELETE = "--DELETE--"; + protected static final String[] DELETE = new String[] + { "--DELETE--", "__DELETE__" }; /** The <code>IPropertyMapper</code> implementation. */ private final IPropertyMapper propertyMapper; @@ -180,7 +181,7 @@ public abstract class AbstractParserObjectFactory<E> implements IParserObjectFac protected static boolean isDeletionMark(String value) { - return DELETE.equals(value); + return DELETE[0].equals(value) || DELETE[1].equals(value); } private void checkMandatory(String value, String code) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java index a9d139d16f5613ab1db3f54c28d2bf7f0dfc2f90..97ddf4e4a61ca353fe79c05efa80391e58c097e8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java @@ -1669,11 +1669,11 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt private static final String UPDATE_TEMPLATE_COMMENT = "# If one doesn't want to modify values in a column the column can be removed completely from the file.\n" + "# Empty value in a column also means that the value stored in openBIS shouldn't be changed.\n" - + "# To delete a value/connection from openBIS one needs to put \"--DELETE--\" into the corresponding cell.\n"; + + "# To delete a value/connection from openBIS one needs to put \"--DELETE--\" or \"__DELETE__\" into the corresponding cell.\n"; private String createTemplateForType(EntityKind entityKind, boolean autoGenerate, - EntityTypePE entityType, boolean addComments, boolean withExperiments, boolean withSpace, - BatchOperationKind operationKind) + EntityTypePE entityType, boolean addComments, boolean withExperiments, + boolean withSpace, BatchOperationKind operationKind) { List<String> columns = new ArrayList<String>(); switch (entityKind) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/UpdatedBasicExperiment.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/UpdatedBasicExperiment.java index 6e426fac3231a7abcc34636232f593d12275f325..e8b4987a91599914d87b1dc7862276f401fca5c4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/UpdatedBasicExperiment.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/UpdatedBasicExperiment.java @@ -26,7 +26,7 @@ public class UpdatedBasicExperiment extends NewBasicExperiment public static final String EXPERIMENT_UPDATE_TEMPLATE_COMMENT = "# All columns except \"identifier\" can be removed from the file.\n" + "# If a column is removed from the file or a cell in a column is left empty the corresponding values of updated expriments will be preserved.\n" - + "# To delete a value/connection from openBIS one needs to put \"--DELETE--\" into the corresponding cell\n" + + "# To delete a value/connection from openBIS one needs to put \"--DELETE--\" or \"__DELETE__\" into the corresponding cell\n" + "# The \"identifier\" column should contain experiment identifiers, e.g. /SPACE/PROJECT/EXPERIMENT_1,\n" + "# The \"project\" column (if not removed) should contain project identifiers, e.g. /SPACE/PROJECT\n"; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/UpdatedSample.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/UpdatedSample.java index 45ed065c4d791d4dd5fe7eedee9837f399c5a5d4..75189423d0c9cf1b7a1ab2c752455d9ac9b6e8c2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/UpdatedSample.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/UpdatedSample.java @@ -28,7 +28,7 @@ public final class UpdatedSample extends NewSample public static final String SAMPLE_UPDATE_TEMPLATE_COMMENT = "# All columns except \"identifier\" can be removed from the file.\n" + "# If a column is removed from the file or a cell in a column is left empty the corresponding values of updated samples will be preserved.\n" - + "# To delete a value/connection from openBIS one needs to put \"--DELETE--\" into the corresponding cell\n" + + "# To delete a value/connection from openBIS one needs to put \"--DELETE--\" or \\\"__DELETE__\\\" into the corresponding cell\n" + "# (in particular, a sample can become detached from an experiment, container or all parents this way).\n" + "# Basically the \"identifier\" column should contain sample identifiers, e.g. /SPACE/SAMPLE_1,\n" + "# but for samples from default space (if it was provided in the form) it is enough to put sample codes (e.g. SAMPLE_1) into the column.\n" diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactoryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactoryTest.java index 9cc355af7ce50163e23a7b2b6a7798f4588cae6a..f30b2f16339c6b584443f737dc446e6d0413c878 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactoryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactoryTest.java @@ -78,9 +78,9 @@ public final class UpdatedSampleParserObjectFactoryTest { new String[] { "", "cont1", "", "hello" }, 1, 1 }, { new String[] - { "id1", "cont1", "--DELETE--", "--DELETE--" }, 0, 2 }, + { "id1", "cont1", "--DELETE--", "__DELETE__" }, 0, 2 }, { new String[] - { "--DELETE--", "--DELETE--", "--DELETE--", "hello" }, 1, 2 } }; + { "__DELETE__", "--DELETE--", "--DELETE--", "hello" }, 1, 2 } }; } @Test(dataProvider = "getLineTokens") @@ -97,9 +97,9 @@ public final class UpdatedSampleParserObjectFactoryTest (UpdatedSample) parserObjectFactory.createObject(lineTokens); // assert that all NewSample properties are set properly assertEquals(identifierToken, objectCreated.getIdentifier()); - assertEquals( - StringUtils.isEmpty(containerToken) || "--DELETE--".equals(containerToken) ? null - : containerToken, objectCreated.getContainerIdentifier()); + assertEquals(StringUtils.isEmpty(containerToken) || "--DELETE--".equals(containerToken) + || "__DELETE__".equals(containerToken) ? null : containerToken, + objectCreated.getContainerIdentifier()); final IEntityProperty[] properties = objectCreated.getProperties(); assertEquals(numberOfProperties, properties.length); int index = 2; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/ExperimentRegistrationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/ExperimentRegistrationTest.java index bb32845ea16b8c12e64c9d47e35de4db947badf4..36eebdcb4dd206271fd40ff3085f5f17b9ea6cdd 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/ExperimentRegistrationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/ExperimentRegistrationTest.java @@ -403,7 +403,7 @@ public class ExperimentRegistrationTest extends GenericSystemTestCase codes = new String[] { "GENDER" }; values = new String[] - { "--DELETE--" }; + { "__DELETE__" }; bulkUpdateString = createBulkUpdateString(expIds, codes, values); addMultiPartFile(EXPERIMENTS_SESSION_KEY, "experiments.txt",