From 54094a312c43aa3e71aad8d2594407612a7e3ee5 Mon Sep 17 00:00:00 2001
From: jakubs <jakubs>
Date: Mon, 13 Feb 2012 08:56:22 +0000
Subject: [PATCH] LMS-2767 Initial changes for postregistration queue

SVN: 24421
---
 .../openbis/generic/server/ETLService.java    |  21 ++
 .../generic/server/ETLServiceLogger.java      |  16 ++
 .../generic/shared/IETLLIMSService.java       | 219 ++++++++++--------
 .../basic/dto/DatabaseModificationKind.java   |   2 +-
 4 files changed, 165 insertions(+), 93 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java
index bc7c03bb02f..2a4049796ec 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java
@@ -1594,4 +1594,25 @@ public class ETLService extends AbstractCommonServer<IETLLIMSService> implements
         dataBO.loadByCode(dataSetCode);
         dataBO.setStorageConfirmed();
     }
+
+    private HashSet<Long> postRegistrationQueue = new HashSet<Long>();
+
+    public void markDataSetForRegistration(String sessionToken, long dataSetId)
+    {
+        // check access to dataset
+        postRegistrationQueue.add(dataSetId);
+    }
+
+    public void markSuccessfulPostRegistration(String sessionToken, long lastSeenDataSetId)
+    {
+        // check access to dataset
+        postRegistrationQueue.remove(lastSeenDataSetId);
+    }
+
+    public List<ExternalData> listDataSetsForPostRegistration(String sessionToken)
+    {
+        final Session session = getSession(sessionToken);
+        final IDatasetLister datasetLister = createDatasetLister(session);
+        return datasetLister.listByDatasetIds(postRegistrationQueue);
+    }
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceLogger.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceLogger.java
index 7a3b6d91e9b..babb1625476 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceLogger.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceLogger.java
@@ -553,4 +553,20 @@ public class ETLServiceLogger extends AbstractServerLogger implements IETLLIMSSe
     {
         logAccess(sessionToken, "setStorageConfirmed", "DATA_SET_CODE(%s)", dataSetCode);
     }
+
+    public void markDataSetForRegistration(String sessionToken, long dataSetId)
+    {
+        logAccess(sessionToken, "setStorageConfirmed", "DATA_SET_ID(%s)", dataSetId);
+    }
+
+    public void markSuccessfulPostRegistration(String sessionToken, long dataSetId)
+    {
+        logAccess(sessionToken, "markSuccessfulPostRegistration", "DATA_SET_ID(%s)", dataSetId);
+    }
+
+    public List<ExternalData> listDataSetsForPostRegistration(String sessionToken)
+    {
+        logAccess(sessionToken, "listDataSetsForPostRegistration", "DATA_SET_CODE(%s)");
+        return null;
+    }
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IETLLIMSService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IETLLIMSService.java
index ff76e54397d..02a507588d6 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IETLLIMSService.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IETLLIMSService.java
@@ -120,9 +120,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
-    public Experiment tryToGetExperiment(String sessionToken,
-            @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class)
-            ExperimentIdentifier experimentIdentifier) throws UserFailureException;
+    public Experiment tryToGetExperiment(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class) ExperimentIdentifier experimentIdentifier)
+            throws UserFailureException;
 
     /**
      * For given {@link MaterialIdentifier} returns the corresponding {@link Material}.
@@ -161,9 +162,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
      */
     @Transactional(readOnly = true)
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
-    public Sample tryGetSampleWithExperiment(final String sessionToken,
-            @AuthorizationGuard(guardClass = ExistingSampleOwnerIdentifierPredicate.class)
-            final SampleIdentifier sampleIdentifier) throws UserFailureException;
+    public Sample tryGetSampleWithExperiment(
+            final String sessionToken,
+            @AuthorizationGuard(guardClass = ExistingSampleOwnerIdentifierPredicate.class) final SampleIdentifier sampleIdentifier)
+            throws UserFailureException;
 
     /**
      * Returns a list of terms belonging to given vocabulary.
@@ -198,9 +200,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
-    public List<ExternalData> listDataSetsByExperimentID(final String sessionToken,
-            @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class)
-            final TechId experimentID) throws UserFailureException;
+    public List<ExternalData> listDataSetsByExperimentID(
+            final String sessionToken,
+            @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) final TechId experimentID)
+            throws UserFailureException;
 
     /**
      * For given sample {@link TechId} returns the corresponding list of {@link ExternalData}.
@@ -211,9 +214,8 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
     public List<ExternalData> listDataSetsBySampleID(final String sessionToken,
-            @AuthorizationGuard(guardClass = SampleTechIdPredicate.class)
-            final TechId sampleId, final boolean showOnlyDirectlyConnected)
-            throws UserFailureException;
+            @AuthorizationGuard(guardClass = SampleTechIdPredicate.class) final TechId sampleId,
+            final boolean showOnlyDirectlyConnected) throws UserFailureException;
 
     /**
      * Returns all data sets found for specified data set codes.
@@ -223,9 +225,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
-    public List<ExternalData> listDataSetsByCode(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class)
-            List<String> dataSetCodes) throws UserFailureException;
+    public List<ExternalData> listDataSetsByCode(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes)
+            throws UserFailureException;
 
     /**
      * Lists samples using given configuration.
@@ -236,9 +239,9 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
     @ReturnValueFilter(validatorClass = SampleValidator.class)
-    public List<Sample> listSamples(final String sessionToken,
-            @AuthorizationGuard(guardClass = ListSampleCriteriaPredicate.class)
-            final ListSampleCriteria criteria);
+    public List<Sample> listSamples(
+            final String sessionToken,
+            @AuthorizationGuard(guardClass = ListSampleCriteriaPredicate.class) final ListSampleCriteria criteria);
 
     /**
      * Tries to return the properties of the top sample (e.g. master plate) registered for the
@@ -252,9 +255,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
-    public IEntityProperty[] tryToGetPropertiesOfTopSampleRegisteredFor(final String sessionToken,
-            @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class)
-            final SampleIdentifier sampleIdentifier) throws UserFailureException;
+    public IEntityProperty[] tryToGetPropertiesOfTopSampleRegisteredFor(
+            final String sessionToken,
+            @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) final SampleIdentifier sampleIdentifier)
+            throws UserFailureException;
 
     /**
      * Registers/updates various entities in one transaction.
@@ -273,8 +277,8 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseCreateOrDeleteModification(value = ObjectKind.EXPERIMENT)
     public long registerExperiment(String sessionToken,
-            @AuthorizationGuard(guardClass = NewExperimentPredicate.class)
-            NewExperiment experiment) throws UserFailureException;
+            @AuthorizationGuard(guardClass = NewExperimentPredicate.class) NewExperiment experiment)
+            throws UserFailureException;
 
     /**
      * Registers samples in batches.
@@ -282,10 +286,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value = ObjectKind.SAMPLE)
-    public void registerSamples(final String sessionToken,
-            @AuthorizationGuard(guardClass = NewSamplesWithTypePredicate.class)
-            final List<NewSamplesWithTypes> newSamplesWithType, String userIdOrNull)
-            throws UserFailureException;
+    public void registerSamples(
+            final String sessionToken,
+            @AuthorizationGuard(guardClass = NewSamplesWithTypePredicate.class) final List<NewSamplesWithTypes> newSamplesWithType,
+            String userIdOrNull) throws UserFailureException;
 
     /**
      * Registers a new sample.
@@ -294,8 +298,8 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseCreateOrDeleteModification(value = ObjectKind.SAMPLE)
     public long registerSample(final String sessionToken,
-            @AuthorizationGuard(guardClass = NewSamplePredicate.class)
-            final NewSample newSample, String userIDOrNull) throws UserFailureException;
+            @AuthorizationGuard(guardClass = NewSamplePredicate.class) final NewSample newSample,
+            String userIDOrNull) throws UserFailureException;
 
     /**
      * Saves changed sample.
@@ -304,8 +308,7 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value = ObjectKind.SAMPLE)
     public void updateSample(String sessionToken,
-            @AuthorizationGuard(guardClass = SampleUpdatesPredicate.class)
-            SampleUpdatesDTO updates);
+            @AuthorizationGuard(guardClass = SampleUpdatesPredicate.class) SampleUpdatesDTO updates);
 
     /**
      * Registers the specified data connected to a sample.
@@ -321,10 +324,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseCreateOrDeleteModification(value = ObjectKind.DATA_SET)
-    public void registerDataSet(final String sessionToken,
-            @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class)
-            final SampleIdentifier sampleIdentifier, final NewExternalData externalData)
-            throws UserFailureException;
+    public void registerDataSet(
+            final String sessionToken,
+            @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) final SampleIdentifier sampleIdentifier,
+            final NewExternalData externalData) throws UserFailureException;
 
     /**
      * Registers the specified data connected to an experiment.
@@ -340,10 +343,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseCreateOrDeleteModification(value = ObjectKind.DATA_SET)
-    public void registerDataSet(final String sessionToken,
-            @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class)
-            final ExperimentIdentifier experimentIdentifier, final NewExternalData externalData)
-            throws UserFailureException;
+    public void registerDataSet(
+            final String sessionToken,
+            @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) final ExperimentIdentifier experimentIdentifier,
+            final NewExternalData externalData) throws UserFailureException;
 
     /**
      * Checks that the user of specified session has INSTANCE_ADMIN access rights.
@@ -366,8 +369,8 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER)
     public void checkDataSetAccess(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodePredicate.class)
-            String dataSetCode) throws UserFailureException;
+            @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode)
+            throws UserFailureException;
 
     /**
      * Check if the current user can access all the data sets in the list
@@ -377,9 +380,9 @@ public interface IETLLIMSService extends IServer, ISessionProvider
      */
     @Transactional(readOnly = true)
     @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER)
-    public void checkDataSetCollectionAccess(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class)
-            List<String> dataSetCodes);
+    public void checkDataSetCollectionAccess(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes);
 
     /**
      * Tries to return the data set specified by its code.
@@ -388,8 +391,8 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(value =
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
     public ExternalData tryGetDataSet(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodePredicate.class)
-            String dataSetCode) throws UserFailureException;
+            @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode)
+            throws UserFailureException;
 
     /**
      * Creates and returns a unique code for a new data set. TODO KE: 2011-04-19 remove this method.
@@ -421,9 +424,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
-    public List<Sample> listSamplesByCriteria(final String sessionToken,
-            @AuthorizationGuard(guardClass = ListSamplesByPropertyPredicate.class)
-            final ListSamplesByPropertyCriteria criteria) throws UserFailureException;
+    public List<Sample> listSamplesByCriteria(
+            final String sessionToken,
+            @AuthorizationGuard(guardClass = ListSamplesByPropertyPredicate.class) final ListSamplesByPropertyCriteria criteria)
+            throws UserFailureException;
 
     /**
      * Lists share ids of all data sets belonging to chosen data store (even the ones in trash!).
@@ -471,9 +475,9 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(value =
         { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
-    public List<Experiment> listExperiments(String sessionToken,
-            @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class)
-            ProjectIdentifier projectIdentifier);
+    public List<Experiment> listExperiments(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) ProjectIdentifier projectIdentifier);
 
     /**
      * List experiments for a given list of experiment identifiers.
@@ -523,9 +527,12 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value = ObjectKind.DATA_SET)
-    public void addPropertiesToDataSet(String sessionToken, List<NewProperty> properties,
-            String dataSetCode, @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class)
-            final SpaceIdentifier identifier) throws UserFailureException;
+    public void addPropertiesToDataSet(
+            String sessionToken,
+            List<NewProperty> properties,
+            String dataSetCode,
+            @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) final SpaceIdentifier identifier)
+            throws UserFailureException;
 
     /**
      * Updates share id and size of specified data set.
@@ -534,8 +541,8 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value = ObjectKind.DATA_SET)
     public void updateShareIdAndSize(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodePredicate.class)
-            String dataSetCode, String shareId, long size) throws UserFailureException;
+            @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode,
+            String shareId, long size) throws UserFailureException;
 
     /**
      * Updates status of given data sets.
@@ -543,10 +550,11 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value = ObjectKind.DATA_SET)
-    public void updateDataSetStatuses(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class)
-            List<String> dataSetCodes, final DataSetArchivingStatus newStatus,
-            boolean presentInArchive) throws UserFailureException;
+    public void updateDataSetStatuses(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes,
+            final DataSetArchivingStatus newStatus, boolean presentInArchive)
+            throws UserFailureException;
 
     /**
      * Set the status for a given dataset to the given new status value if the current status equals
@@ -572,9 +580,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value = ObjectKind.DATA_SET)
-    public int archiveDatasets(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class)
-            List<String> datasetCodes, boolean removeFromDataStore);
+    public int archiveDatasets(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> datasetCodes,
+            boolean removeFromDataStore);
 
     /**
      * Schedules unarchiving of specified data sets.
@@ -584,9 +593,9 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value = ObjectKind.DATA_SET)
-    public int unarchiveDatasets(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class)
-            List<String> datasetCodes);
+    public int unarchiveDatasets(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> datasetCodes);
 
     /**
      * Check if the user has USER access on the space
@@ -597,8 +606,7 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(RoleWithHierarchy.SPACE_USER)
     public void checkSpaceAccess(String sessionToken,
-            @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class)
-            SpaceIdentifier spaceId);
+            @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) SpaceIdentifier spaceId);
 
     /**
      * For the ETL Server to get data sets.
@@ -606,8 +614,8 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     public ExternalData tryGetDataSetForServer(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodePredicate.class)
-            String dataSetCode) throws UserFailureException;
+            @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode)
+            throws UserFailureException;
 
     /**
      * Returns a list of unique codes.
@@ -648,9 +656,8 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @DatabaseCreateOrDeleteModification(value =
         { ObjectKind.SAMPLE, ObjectKind.DATA_SET })
     public Sample registerSampleAndDataSet(final String sessionToken,
-            @AuthorizationGuard(guardClass = NewSamplePredicate.class)
-            final NewSample newSample, final NewExternalData externalData, String userIdOrNull)
-            throws UserFailureException;
+            @AuthorizationGuard(guardClass = NewSamplePredicate.class) final NewSample newSample,
+            final NewExternalData externalData, String userIdOrNull) throws UserFailureException;
 
     /**
      * Updates a sample and registers a data set connected to that sample in one transaction.
@@ -667,9 +674,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value = ObjectKind.SAMPLE)
     @DatabaseCreateOrDeleteModification(value = ObjectKind.DATA_SET)
-    public Sample updateSampleAndRegisterDataSet(String sessionToken,
-            @AuthorizationGuard(guardClass = SampleUpdatesPredicate.class)
-            SampleUpdatesDTO updates, NewExternalData externalData);
+    public Sample updateSampleAndRegisterDataSet(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = SampleUpdatesPredicate.class) SampleUpdatesDTO updates,
+            NewExternalData externalData);
 
     /**
      * Updates a sample and registers a data set connected to that sample in one transaction.
@@ -686,9 +694,9 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @DatabaseCreateOrDeleteModification(value =
         { ObjectKind.SPACE, ObjectKind.PROJECT, ObjectKind.SAMPLE, ObjectKind.EXPERIMENT,
                 ObjectKind.DATA_SET })
-    public AtomicEntityOperationResult performEntityOperations(String sessionToken,
-            @AuthorizationGuard(guardClass = AtomicOperationsPredicate.class)
-            AtomicEntityOperationDetails operationDetails);
+    public AtomicEntityOperationResult performEntityOperations(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = AtomicOperationsPredicate.class) AtomicEntityOperationDetails operationDetails);
 
     /**
      * Tries to return the space specified by its identifier.
@@ -696,9 +704,9 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(value =
         { RoleWithHierarchy.SPACE_ETL_SERVER })
-    public Space tryGetSpace(String sessionToken,
-            @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class)
-            SpaceIdentifier spaceIdentifier);
+    public Space tryGetSpace(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class) SpaceIdentifier spaceIdentifier);
 
     /**
      * Tries to return the project specified by its identifier.
@@ -706,9 +714,9 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @Transactional(readOnly = true)
     @RolesAllowed(value =
         { RoleWithHierarchy.SPACE_ETL_SERVER })
-    public Project tryGetProject(String sessionToken,
-            @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class)
-            ProjectIdentifier projectIdentifier);
+    public Project tryGetProject(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class) ProjectIdentifier projectIdentifier);
 
     /**
      * Search for samples matching the provided criteria.
@@ -741,9 +749,10 @@ public interface IETLLIMSService extends IServer, ISessionProvider
         { ObjectKind.SAMPLE, ObjectKind.EXPERIMENT })
     @DatabaseCreateOrDeleteModification(value =
         { ObjectKind.DATA_SET })
-    public void removeDataSetsPermanently(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class)
-            List<String> dataSetCodes, String reason);
+    public void removeDataSetsPermanently(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes,
+            String reason);
 
     /**
      * updates a data set.
@@ -752,9 +761,9 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
     @DatabaseUpdateModification(value =
         { ObjectKind.EXPERIMENT, ObjectKind.SAMPLE, ObjectKind.DATA_SET })
-    public void updateDataSet(String sessionToken,
-            @AuthorizationGuard(guardClass = DataSetUpdatesPredicate.class)
-            DataSetUpdatesDTO dataSetUpdates);
+    public void updateDataSet(
+            String sessionToken,
+            @AuthorizationGuard(guardClass = DataSetUpdatesPredicate.class) DataSetUpdatesDTO dataSetUpdates);
 
     /**
      * Returns a list of configured trusted domains which can host external shared web resources.
@@ -774,4 +783,30 @@ public interface IETLLIMSService extends IServer, ISessionProvider
     @DatabaseUpdateModification(value =
         { ObjectKind.DATA_SET })
     public void setStorageConfirmed(String sessionToken, String dataSetCode);
+
+    /**
+     * Adds the given dataset to post-registration queue.
+     */
+    @Transactional
+    @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
+    @DatabaseCreateOrDeleteModification(value =
+        { ObjectKind.POSTREGISTRATION_QUEUE })
+    public void markDataSetForRegistration(String token, long dataSetId);
+
+    /**
+     * Informs that the post-registration task for a given dataset was performed, and it should be
+     * removed from the post-registration queue.
+     */
+    @Transactional
+    @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
+    @DatabaseCreateOrDeleteModification(value =
+        { ObjectKind.POSTREGISTRATION_QUEUE })
+    public void markSuccessfulPostRegistration(String token, long lastSeenDataSetId);
+
+    /**
+     * Gets the list of all datasets, which are in the post-registration queue.
+     */
+    @Transactional
+    @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER)
+    public List<ExternalData> listDataSetsForPostRegistration(String token);
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DatabaseModificationKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DatabaseModificationKind.java
index 0810d95fd6f..257f3240b4c 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DatabaseModificationKind.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DatabaseModificationKind.java
@@ -39,7 +39,7 @@ public class DatabaseModificationKind implements Serializable
         AUTHORIZATION_GROUP, SAMPLE, EXPERIMENT, MATERIAL, DATA_SET, SAMPLE_TYPE, EXPERIMENT_TYPE,
         MATERIAL_TYPE, DATASET_TYPE, FILE_FORMAT_TYPE, PROJECT, SPACE, PROPERTY_TYPE,
         PROPERTY_TYPE_ASSIGNMENT, VOCABULARY, VOCABULARY_TERM, ROLE_ASSIGNMENT, PERSON,
-        GRID_CUSTOM_FILTER, GRID_CUSTOM_COLUMN, SCRIPT, DELETION,
+        GRID_CUSTOM_FILTER, GRID_CUSTOM_COLUMN, SCRIPT, DELETION, POSTREGISTRATION_QUEUE,
         // TODO 2010-02-19, PTR: no easy way to extend current modification notification solution in
         // modules
         QUERY
-- 
GitLab