diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObject.java index d66239e83aeeffe5e93ee84c904733133ceb4550..4fb16beedc224e4cd3024f9d38cc915700ce2733 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObject.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractBusinessObject.java @@ -216,18 +216,23 @@ abstract class AbstractBusinessObject implements IDAOFactory return permID == null ? getPermIdDAO().createPermId() : permID; } - protected <T extends EntityPropertyPE> Set<T> convertProperties(final EntityTypePE type, - final Set<T> existingProperties, List<IEntityProperty> properties) + Set<String> extractPropertiesCodes(List<IEntityProperty> properties) { - final PersonPE registrator = findPerson(); - Set<String> propertiesToUpdate = new HashSet<String>(); + Set<String> propertiesCodes = new HashSet<String>(); if (properties != null) { for (IEntityProperty property : properties) { - propertiesToUpdate.add(property.getPropertyType().getCode()); + propertiesCodes.add(property.getPropertyType().getCode()); } } + return propertiesCodes; + } + + protected <T extends EntityPropertyPE> Set<T> convertProperties(final EntityTypePE type, + final Set<T> existingProperties, List<IEntityProperty> properties, Set<String> propertiesToUpdate) + { + final PersonPE registrator = findPerson(); return entityPropertiesConverter.updateProperties(existingProperties, type, properties, registrator, propertiesToUpdate); } @@ -559,7 +564,7 @@ abstract class AbstractBusinessObject implements IDAOFactory return RelationshipUtils.getContainerComponentRelationshipType(getRelationshipTypeDAO()); } - protected void updateProperties(EntityTypePE entityType, List<IEntityProperty> properties, + protected void updateProperties(EntityTypePE entityType, List<IEntityProperty> properties, Set<String> propertiesToUpdate, IEntityPropertiesHolder entityAsPropertiesHolder, IModifierAndModificationDateBean entityAsModifiableBean) { @@ -573,7 +578,7 @@ abstract class AbstractBusinessObject implements IDAOFactory existingPropertyValuesByCode.put(propertyCode, getValue(existingProperty)); } Set<? extends EntityPropertyPE> convertedProperties = - convertProperties(entityType, existingProperties, properties); + convertProperties(entityType, existingProperties, properties, propertiesToUpdate); if (isEquals(existingPropertyValuesByCode, convertedProperties) == false) { entityAsPropertiesHolder.setProperties(convertedProperties); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBO.java index 7abdc6b4245ac343a7a752516f8e76086001c607..29e4708565e90a9dbb6d36c76c50d337624d6646 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBO.java @@ -610,7 +610,7 @@ public class DataBO extends AbstractDataSetBusinessObject implements IDataBO updateContainer(updates.getModifiedContainerDatasetCodeOrNull()); updateComponents(updates.getModifiedContainedDatasetCodesOrNull()); updateFileFormatType(data, updates.getFileFormatTypeCode()); - updateProperties(data.getEntityType(), updates.getProperties(), data, data); + updateProperties(data.getEntityType(), updates.getProperties(), extractPropertiesCodes(updates.getProperties()), data, data); if (data.getContainedDataSets() != null) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTable.java index f2bbf1317c0eb1e3015c57df00601b7948e79068..626174af6471d066a50d99a40c0175c738bb4e3c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTable.java @@ -1064,7 +1064,7 @@ public final class DataSetTable extends AbstractDataSetBusinessObject implements DataSetBatchUpdateDetails details = dataSetUpdates.getDetails(); - updateProperties(dataSet.getEntityType(), dataSetUpdates.getProperties(), dataSet, dataSet); + updateProperties(dataSet.getEntityType(), dataSetUpdates.getProperties(), details.getPropertiesToUpdate(), dataSet, dataSet); checkPropertiesBusinessRules(dataSet); boolean isExperimentFromSample = false; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java index 0dce83e611e80dba0010768706569cc54ce97baa..ebbd94cc57791c11deaa29f7c77629d176f0cd32 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java @@ -448,7 +448,7 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper { throwModifiedEntityException("Experiment"); } - updateProperties(experiment.getEntityType(), updates.getProperties(), experiment, + updateProperties(experiment.getEntityType(), updates.getProperties(), extractPropertiesCodes(updates.getProperties()), experiment, experiment); ProjectPE project = findProject(updates.getProjectIdentifier()); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java index a089aea7d415f09e3cc30d771f9bb1c1e6008b77..a1e54190c00ff01caadfdca5d2b9f86909116f3b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java @@ -152,7 +152,7 @@ public final class MaterialBO extends AbstractMaterialBusinessObject implements { final Set<MaterialPropertyPE> existingProperties = material.getProperties(); final MaterialTypePE type = material.getMaterialType(); - material.setProperties(convertProperties(type, existingProperties, properties)); + material.setProperties(convertProperties(type, existingProperties, properties, extractPropertiesCodes(properties))); } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java index 2053b1feb1a2a8b168de2686f669c76002024b01..50d1f24646c45e7b7a5e5773428d34a5b6e2f359 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java @@ -298,7 +298,7 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam { throwModifiedEntityException("Sample"); } - updateProperties(sample.getSampleType(), updates.getProperties(), sample, sample); + updateProperties(sample.getSampleType(), updates.getProperties(), extractPropertiesCodes(updates.getProperties()), sample, sample); spaceUpdated = updateSpace(sample, updates.getSampleIdentifier(), null); if (updates.isUpdateExperimentLink()) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTable.java index 97a6498c1b2ee114d40dd20fc50ddb2b4fad051d..f780fe6579ba9d2d7909ef886b49ce6047620e6d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleTable.java @@ -418,7 +418,7 @@ public final class SampleTable extends AbstractSampleBusinessObject implements I { final Set<SamplePropertyPE> existingProperties = sample.getProperties(); final SampleTypePE type = sample.getSampleType(); - sample.setProperties(convertProperties(type, existingProperties, properties)); + sample.setProperties(convertProperties(type, existingProperties, properties, extractPropertiesCodes(properties))); } private void batchUpdateProperties(SamplePE sample, List<IEntityProperty> properties, diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java index 10921387bfccbb4f2a4534160838f39be3dde02a..0fd255c7d1c171a3fa172f50b4ab05c6053d05af 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java @@ -465,7 +465,7 @@ public final class ExperimentBOTest extends AbstractBOTest prepareUpdateProperties(exp.getProperties(), newProperties, experimentType, ManagerTestTool.EXAMPLE_SESSION.tryGetPerson(), Arrays.asList(changedProperty, addedProperty)); - bo.updateProperties(experiment.getEntityType(), newProperties, experiment, experiment); + bo.updateProperties(experiment.getEntityType(), newProperties, Collections.<String> emptySet(), experiment, experiment); assertTrue(experiment.getProperties().contains(changedProperty)); assertFalse(experiment.getProperties().contains(deletedProperty)); @@ -492,7 +492,7 @@ public final class ExperimentBOTest extends AbstractBOTest new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter, managedPropertyEvaluatorFactory); - bo.updateProperties(entityType, newProperties, entityAsPropertiesHolder, + bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder, entityAsModifiableBean); context.assertIsSatisfied(); @@ -519,7 +519,7 @@ public final class ExperimentBOTest extends AbstractBOTest new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter, managedPropertyEvaluatorFactory); - bo.updateProperties(entityType, newProperties, entityAsPropertiesHolder, + bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder, entityAsModifiableBean); context.assertIsSatisfied(); @@ -547,7 +547,7 @@ public final class ExperimentBOTest extends AbstractBOTest new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter, managedPropertyEvaluatorFactory); - bo.updateProperties(entityType, newProperties, entityAsPropertiesHolder, + bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder, entityAsModifiableBean); context.assertIsSatisfied(); @@ -575,7 +575,7 @@ public final class ExperimentBOTest extends AbstractBOTest new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter, managedPropertyEvaluatorFactory); - bo.updateProperties(entityType, newProperties, entityAsPropertiesHolder, + bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder, entityAsModifiableBean); context.assertIsSatisfied(); @@ -604,7 +604,7 @@ public final class ExperimentBOTest extends AbstractBOTest new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter, managedPropertyEvaluatorFactory); - bo.updateProperties(entityType, newProperties, entityAsPropertiesHolder, + bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder, entityAsModifiableBean); context.assertIsSatisfied(); @@ -629,7 +629,7 @@ public final class ExperimentBOTest extends AbstractBOTest new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter, managedPropertyEvaluatorFactory); - bo.updateProperties(entityType, newProperties, entityAsPropertiesHolder, + bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder, entityAsModifiableBean); context.assertIsSatisfied(); @@ -654,7 +654,7 @@ public final class ExperimentBOTest extends AbstractBOTest new ExperimentBO(daoFactory, ManagerTestTool.EXAMPLE_SESSION, propertiesConverter, managedPropertyEvaluatorFactory); - bo.updateProperties(entityType, newProperties, entityAsPropertiesHolder, + bo.updateProperties(entityType, newProperties, Collections.<String> emptySet(), entityAsPropertiesHolder, entityAsModifiableBean); context.assertIsSatisfied();