diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/AbstractRegistrationHolder.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/AbstractRegistrationHolder.java index 8cf1c1de3c574c2574ce53a1dfc91bdff7e724fe..f43b03ae53ddfda0f2513f9076f9e0f34d9511ce 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/AbstractRegistrationHolder.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/AbstractRegistrationHolder.java @@ -48,5 +48,5 @@ public abstract class AbstractRegistrationHolder this.registrationTimestamp = registrationTimestamp; } - + public abstract Date getLastModificationDate(); } diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/EntitySynchronizer.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/EntitySynchronizer.java index 960fbaf000552e440ce93e82c17005edfb5a7a16..0a009236a6c954cda1f86baee8be8d33c18c5589 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/EntitySynchronizer.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/EntitySynchronizer.java @@ -402,6 +402,7 @@ public class EntitySynchronizer RegistrationDTO registration = new RegistrationDTO(); registration.setPermId(permID); registration.setTypeId(typeId); + registration.setModificationTimestamp(entity.getLastModificationDate()); registration.setRegistrationTimestamp(entity.getRegistrationTimestamp()); registration.setRegistratorId(registratorId); registrations.add(registration); diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/IHarvesterQuery.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/IHarvesterQuery.java index f6c790f9e8451aee4ba5f22eef3d7f77bda77a0d..3875622beb80664cfbb6b8a7325acdcb7d1d1d26 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/IHarvesterQuery.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/IHarvesterQuery.java @@ -27,9 +27,9 @@ import net.lemnik.eodsql.Update; */ public interface IHarvesterQuery extends BaseQuery { - public static final String UPDATE2 = - "set registration_timestamp = ?{1.registrationTimestamp}, pers_id_registerer = ?{1.registratorId} " - + "where perm_id = ?{1.permId}"; + public static final String SETTERS = "set modification_timestamp = ?{1.modificationTimestamp}, " + + "registration_timestamp = ?{1.registrationTimestamp}, " + + "pers_id_registerer = ?{1.registratorId} "; @Select("select id,user_id as userId from persons") public List<PersonRecord> listAllUsers(); @@ -37,20 +37,18 @@ public interface IHarvesterQuery extends BaseQuery @Select("select id,code from material_types") public List<MaterialTypeRecord> listAllMaterialTypes(); - @Update(sql = "update materials set registration_timestamp = ?{1.registrationTimestamp}, pers_id_registerer = ?{1.registratorId} " - + "where code = ?{1.permId} and maty_id = ?{1.typeId}", batchUpdate = true) + @Update(sql = "update materials " + SETTERS + " where code = ?{1.permId} and maty_id = ?{1.typeId}", batchUpdate = true) public void updateMaterialRegistrations(List<RegistrationDTO> registrations); - @Update(sql = "update projects " + UPDATE2, batchUpdate = true) + @Update(sql = "update projects " + SETTERS + "where perm_id = ?{1.permId}", batchUpdate = true) public void updateProjectRegistrations(List<RegistrationDTO> registrations); - @Update(sql = "update experiments_all " + UPDATE2, batchUpdate = true) + @Update(sql = "update experiments_all " + SETTERS + "where perm_id = ?{1.permId}", batchUpdate = true) public void updateExperimentRegistrations(List<RegistrationDTO> registrations); - @Update(sql = "update samples_all " + UPDATE2, batchUpdate = true) + @Update(sql = "update samples_all " + SETTERS + "where perm_id = ?{1.permId}", batchUpdate = true) public void updateSampleRegistrations(List<RegistrationDTO> registrations); - @Update(sql = "update data_all set registration_timestamp = ?{1.registrationTimestamp}, pers_id_registerer = ?{1.registratorId} " - + "where code = ?{1.permId}", batchUpdate = true) + @Update(sql = "update data_all " + SETTERS + "where code = ?{1.permId}", batchUpdate = true) public void updateDataSetRegistrations(List<RegistrationDTO> registrations); } diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/RegistrationDTO.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/RegistrationDTO.java index de5777cfe3e15188f48052711c06633ffd2fa14a..ab1083230e7be2a7dbe2431ebaee867ba7bd6ecf 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/RegistrationDTO.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/RegistrationDTO.java @@ -24,9 +24,11 @@ import java.util.Date; public class RegistrationDTO { private String permId; - + private Long typeId; + private Date modificationTimestamp; + private Date registrationTimestamp; private long registratorId; @@ -51,6 +53,16 @@ public class RegistrationDTO this.typeId = typeId; } + public Date getModificationTimestamp() + { + return modificationTimestamp; + } + + public void setModificationTimestamp(Date modificationTimestamp) + { + this.modificationTimestamp = modificationTimestamp; + } + public Date getRegistrationTimestamp() { return registrationTimestamp;