diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java index c27e8af2025dd9c9e27764bcb4f3967535017a03..1271faa227c01dc84100810a70e888b23c0d882e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java @@ -161,12 +161,6 @@ public class EntityTypePropertyTypeBO extends AbstractBusinessObject implements } } - private void updateEntityModificationTimestamps(List<Long> entityIds) - { - IEntityPropertyTypeDAO entityPropertyTypeDAO = getEntityPropertyTypeDAO(entityKind); - entityPropertyTypeDAO.updateEntityModificationTimestamps(entityIds, getTransactionTimeStamp()); - } - private ScriptPE tryFindScript(NewETPTAssignment newAssignment) { if (newAssignment.getScriptName() == null) @@ -211,7 +205,7 @@ public class EntityTypePropertyTypeBO extends AbstractBusinessObject implements registrator, validatedValue); entityPropertyTypeDAO.createProperties(property, entityIds); - updateEntityModificationTimestamps(entityIds); + entityPropertyTypeDAO.updateEntityModificationTimestamps(entityIds); } if (operationLog.isDebugEnabled()) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertyTypeDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertyTypeDAO.java index 409247eceff809aab969d5ba4f96afad22924062..22bc33d7a3ecfaa14dc896a1e20fa11a2b0ff535 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertyTypeDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertyTypeDAO.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess; -import java.util.Date; import java.util.List; import org.springframework.dao.DataAccessException; @@ -127,5 +126,5 @@ public interface IEntityPropertyTypeDAO * the entity type and existing entities need to be updated with a default value for the mandatory property 2. If a property is unassigned from an * entity type. */ - public void updateEntityModificationTimestamps(final List<Long> entityIds, final Date timestamp); + public void updateEntityModificationTimestamps(final List<Long> entityIds); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAO.java index 584e9e1908d316d08732c5822f144c08a440def2..0e57286be1d7f6ffebe968d65ec4a85bf3e35ae4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAO.java @@ -18,7 +18,6 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db; import java.io.Serializable; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -247,8 +246,15 @@ final class EntityPropertyTypeDAO extends AbstractDAO implements IEntityProperty } @SuppressWarnings({ "unchecked", "rawtypes" }) - public void updateEntityModificationTimestamps(final List<Long> entityIds, final Date timestamp) + public void updateEntityModificationTimestamps(final List<Long> entityIds) { + assert entityIds != null : "Null entityId list."; + + if (entityIds.isEmpty()) + { + return; + } + getHibernateTemplate().execute(new HibernateCallback() { @Override @@ -276,7 +282,7 @@ final class EntityPropertyTypeDAO extends AbstractDAO implements IEntityProperty SQLQuery clearQuery = session.createSQLQuery( "update " + entityTableName + " set modification_timestamp = :timestamp where id in :entityIds "); - clearQuery.setTimestamp("timestamp", timestamp); + clearQuery.setTimestamp("timestamp", getTransactionTimeStamp()); clearQuery.setParameterList("entityIds", entityIds); clearQuery.executeUpdate(); return null; @@ -551,7 +557,7 @@ final class EntityPropertyTypeDAO extends AbstractDAO implements IEntityProperty template.clear(); template.delete(assignment); - updateEntityModificationTimestamps(entityIds, getTransactionTimeStamp()); + updateEntityModificationTimestamps(entityIds); scheduleDynamicPropertiesEvaluation(entityIds); if (operationLog.isInfoEnabled()) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBOTest.java index b78e25dc2293c36448c93ea9e03f52a0339810ca..1f240634f1ebcadea296cb8dd23ec60ccbb5e891 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBOTest.java @@ -137,6 +137,7 @@ public final class EntityTypePropertyTypeBOTest extends AbstractBOTest with(any(PersonPE.class)), with(validatedValue)); will(returnValue(property)); + allowing(entityPropertyTypeDAO).updateEntityModificationTimestamps(with(experimentIds)); one(entityPropertyTypeDAO).createProperties(property, experimentIds); } });