From d7fe10b37b9c02f8f87f3f5e4ade5e90a462aece Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 26 Jan 2010 15:38:38 +0000
Subject: [PATCH] SE-191 service interface slightly changed for choice of copy
 tasks

SVN: 14462
---
 .../web/client/IPhosphoNetXClientService.java |   3 +-
 .../IPhosphoNetXClientServiceAsync.java       |   4 +-
 .../application/RawDataProcessingMenu.java    | 167 ++++++++++++++++++
 .../client/application/RawDataSampleGrid.java |  87 ++-------
 .../web/public/phosphonetx-dictionary.js      |   8 +-
 .../web/server/PhosphoNetXClientService.java  |   4 +-
 .../phosphonetx/server/RawDataService.java    |   6 +-
 .../server/RawDataServiceInternal.java        |  21 ++-
 .../server/RawDataServiceInternalLogger.java  |   2 +-
 .../server/RawDataServiceLogger.java          |   8 +-
 .../phosphonetx/shared/IRawDataService.java   |  10 +-
 .../shared/IRawDataServiceInternal.java       |   2 +-
 .../plugin/phosphonetx/RawDataTestClient.java |   2 +-
 .../server/RawDataServiceInternalTest.java    |   4 +-
 .../server/RawDataServiceTest.java            |   6 +-
 15 files changed, 223 insertions(+), 111 deletions(-)
 create mode 100644 rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RawDataProcessingMenu.java

diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java
index 4e55fc527f6..583ae254883 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientService.java
@@ -92,6 +92,7 @@ public interface IPhosphoNetXClientService extends IClientService
     public String prepareExportRawDataSamples(TableExportCriteria<GenericTableRow> exportCriteria)
             throws UserFailureException;
     
-    public void copyRawData(long[] rawDataSampleIDs) throws UserFailureException;
+    public void processRawData(String dataSetProcessingKey, long[] rawDataSampleIDs)
+            throws UserFailureException;
 
 }
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java
index 6d522eb5d2d..7d43422e112 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/IPhosphoNetXClientServiceAsync.java
@@ -111,6 +111,6 @@ public interface IPhosphoNetXClientServiceAsync extends IClientServiceAsync
     public void prepareExportRawDataSamples(TableExportCriteria<GenericTableRow> exportCriteria,
             AsyncCallback<String> callback);
     
-    /** @see IPhosphoNetXClientService#copyRawData(long[]) */
-    public void copyRawData(long[] rawDataSampleIDs, AsyncCallback<Void> callback);
+    /** @see IPhosphoNetXClientService#processRawData(String, long[]) */
+    public void processRawData(String dataSetProcessingKey, long[] rawDataSampleIDs, AsyncCallback<Void> callback);
 }
\ No newline at end of file
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RawDataProcessingMenu.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RawDataProcessingMenu.java
new file mode 100644
index 00000000000..ad1192bce24
--- /dev/null
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RawDataProcessingMenu.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2010 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application;
+
+import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.Dict.COPY_DATA_SETS_MESSAGE;
+import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.Dict.COPY_DATA_SETS_TITLE;
+
+import java.util.List;
+
+import com.extjs.gxt.ui.client.widget.menu.Menu;
+
+import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.VoidAsyncCallback;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.ActionMenu;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.IActionMenuItem;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.AbstractDataConfirmationDialog;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedActionWithResult;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.TextToolItem;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStoreServiceKind;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatastoreServiceDescription;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ISerializableComparable;
+import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SerializableComparableIDDecorator;
+import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync;
+
+/**
+ * 
+ *
+ * @author Franz-Josef Elmer
+ */
+public class RawDataProcessingMenu extends TextToolItem
+{
+    private static final class CopyConfirmationDialog extends
+            AbstractDataConfirmationDialog<List<GenericTableRow>>
+    {
+        private final IViewContext<IPhosphoNetXClientServiceAsync> specificViewContext;
+
+        private final List<GenericTableRow> samples;
+
+        private final DatastoreServiceDescription datastoreServiceDescription;
+
+        private CopyConfirmationDialog(
+                IViewContext<IPhosphoNetXClientServiceAsync> specificViewContext,
+                DatastoreServiceDescription datastoreServiceDescription,
+                List<GenericTableRow> samples, String title)
+        {
+            super(specificViewContext, samples, title);
+            this.specificViewContext = specificViewContext;
+            this.datastoreServiceDescription = datastoreServiceDescription;
+            this.samples = samples;
+        }
+
+        @Override
+        protected String createMessage()
+        {
+            String list = "[";
+            String delim = "";
+            for (GenericTableRow sample : samples)
+            {
+                list += delim + sample.tryToGetValue(0);
+                delim = ", ";
+            }
+            list += "]";
+            String label = datastoreServiceDescription.getLabel();
+            return specificViewContext.getMessage(COPY_DATA_SETS_MESSAGE, label, list);
+        }
+
+        @Override
+        protected void executeConfirmedAction()
+        {
+            long[] rawDataSampleIDs = new long[samples.size()];
+            for (int i = 0; i < samples.size(); i++)
+            {
+                GenericTableRow row = samples.get(i);
+                ISerializableComparable c = row.tryToGetValue(0);
+                if (c instanceof SerializableComparableIDDecorator == false)
+                {
+                    throw new IllegalArgumentException("Missing id: " + c);
+                }
+                rawDataSampleIDs[i] = ((SerializableComparableIDDecorator) c).getID();
+            }
+            specificViewContext.getService().processRawData(datastoreServiceDescription.getKey(),
+                    rawDataSampleIDs, new VoidAsyncCallback<Void>(specificViewContext));
+        }
+
+        @Override
+        protected void extendForm()
+        {
+        }
+    }
+
+    private final IViewContext<IPhosphoNetXClientServiceAsync> viewContext;
+    private final IDelegatedActionWithResult<List<GenericTableRow>> selectedDataProvider;
+    
+    public RawDataProcessingMenu(IViewContext<IPhosphoNetXClientServiceAsync> viewContext,
+            IDelegatedActionWithResult<List<GenericTableRow>> selectedDataProvider)
+    {
+        super(viewContext.getMessage(Dict.COPY_DATA_SETS_BUTTON_LABEL));
+        this.viewContext = viewContext;
+        this.selectedDataProvider = selectedDataProvider;
+        IViewContext<ICommonClientServiceAsync> commonViewContext =
+                viewContext.getCommonViewContext();
+        viewContext.getCommonService().listDataStoreServices(DataStoreServiceKind.PROCESSING,
+                new AbstractAsyncCallback<List<DatastoreServiceDescription>>(commonViewContext)
+                    {
+                        @Override
+                        public final void process(List<DatastoreServiceDescription> plugins)
+                        {
+                            createMenu(plugins);
+                        }
+                    });
+    }
+    
+    private void createMenu(List<DatastoreServiceDescription> plugins)
+    {
+        Menu subMenu = new Menu();
+
+        for (final DatastoreServiceDescription datastoreServiceDescription : plugins)
+        {
+            IActionMenuItem actionMenuItem = new IActionMenuItem()
+                {
+
+                    public String getMenuText(IMessageProvider messageProvider)
+                    {
+                        return datastoreServiceDescription.getLabel();
+                    }
+
+                    public String getMenuId()
+                    {
+                        return datastoreServiceDescription.getKey();
+                    }
+                };
+            IDelegatedAction action = new IDelegatedAction()
+                {
+
+                    public void execute()
+                    {
+                        String title = viewContext.getMessage(COPY_DATA_SETS_TITLE);
+                        List<GenericTableRow> selectedSamples = selectedDataProvider.execute();
+                        new CopyConfirmationDialog(viewContext, datastoreServiceDescription,
+                                selectedSamples, title).show();
+                    }
+                };
+            subMenu.add(new ActionMenu(actionMenuItem, viewContext, action));
+        }
+        setMenu(subMenu);
+    }
+
+}
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RawDataSampleGrid.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RawDataSampleGrid.java
index 22364c4a78c..b50779972b6 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RawDataSampleGrid.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/client/application/RawDataSampleGrid.java
@@ -18,25 +18,18 @@ package ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.applicatio
 
 import static ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.createOrDelete;
 import static ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.edit;
-import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.Dict.COPY_DATA_SETS_BUTTON_LABEL;
-import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.Dict.COPY_DATA_SETS_MESSAGE;
-import static ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.application.Dict.COPY_DATA_SETS_TITLE;
 
 import java.util.List;
 
-import com.extjs.gxt.ui.client.widget.Dialog;
-import com.extjs.gxt.ui.client.widget.button.Button;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
-import ch.systemsx.cisd.openbis.generic.client.web.client.application.VoidAsyncCallback;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.GenericTableBrowserGrid;
-import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IBrowserGridActionInvoker;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.ICellListener;
 import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.grid.IDisposableComponent;
-import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.AbstractDataConfirmationDialog;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedActionWithResult;
 import ch.systemsx.cisd.openbis.generic.client.web.client.dto.GenericTableResultSet;
 import ch.systemsx.cisd.openbis.generic.client.web.client.dto.IResultSetConfig;
 import ch.systemsx.cisd.openbis.generic.client.web.client.dto.TableExportCriteria;
@@ -45,7 +38,6 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.BasicEntityType;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GenericTableRow;
-import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ISerializableComparable;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SerializableComparableIDDecorator;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind;
 import ch.systemsx.cisd.openbis.plugin.phosphonetx.client.web.client.IPhosphoNetXClientServiceAsync;
@@ -66,59 +58,6 @@ class RawDataSampleGrid extends GenericTableBrowserGrid
         return grid.asDisposableWithoutToolbar();
     }
 
-    private static final class CopyConfirmationDialog extends
-            AbstractDataConfirmationDialog<List<GenericTableRow>>
-    {
-        private final IViewContext<IPhosphoNetXClientServiceAsync> specificViewContext;
-
-        private final List<GenericTableRow> samples;
-
-        private CopyConfirmationDialog(
-                IViewContext<IPhosphoNetXClientServiceAsync> specificViewContext,
-                List<GenericTableRow> samples, String title)
-        {
-            super(specificViewContext, samples, title);
-            this.specificViewContext = specificViewContext;
-            this.samples = samples;
-        }
-
-        @Override
-        protected String createMessage()
-        {
-            String list = "[";
-            String delim = "";
-            for (GenericTableRow sample : samples)
-            {
-                list += delim + sample.tryToGetValue(0);
-                delim = ", ";
-            }
-            list += "]";
-            return specificViewContext.getMessage(COPY_DATA_SETS_MESSAGE, list);
-        }
-
-        @Override
-        protected void executeConfirmedAction()
-        {
-            long[] rawDataSampleIDs = new long[samples.size()];
-            for (int i = 0; i < samples.size(); i++)
-            {
-                GenericTableRow row = samples.get(i);
-                ISerializableComparable c = row.tryToGetValue(0);
-                if (c instanceof SerializableComparableIDDecorator == false)
-                {
-                    throw new IllegalArgumentException("Missing id: " + c);
-                }
-                rawDataSampleIDs[i] = ((SerializableComparableIDDecorator) c).getID();
-            }
-            specificViewContext.getService().copyRawData(rawDataSampleIDs,
-                    new VoidAsyncCallback<Void>(specificViewContext));
-        }
-
-        @Override
-        protected void extendForm()
-        {
-        }
-    }
 
    private final IViewContext<IPhosphoNetXClientServiceAsync> specificViewContext;
     
@@ -136,20 +75,16 @@ class RawDataSampleGrid extends GenericTableBrowserGrid
                 });
         allowMultipleSelection();
         addEntityOperationsLabel();
-        Button uploadButton =
-                new Button(viewContext.getMessage(COPY_DATA_SETS_BUTTON_LABEL),
-                        new AbstractCreateDialogListener()
-                            {
-                                @Override
-                                protected Dialog createDialog(List<GenericTableRow> samples,
-                                        IBrowserGridActionInvoker invoker)
-                                {
-                                    return new CopyConfirmationDialog(specificViewContext, samples,
-                                            specificViewContext.getMessage(COPY_DATA_SETS_TITLE));
-                                }
-                            });
-        addButton(uploadButton);
-
+        RawDataProcessingMenu button = new RawDataProcessingMenu(viewContext,
+                new IDelegatedActionWithResult<List<GenericTableRow>>()
+                    {
+                        public List<GenericTableRow> execute()
+                        {
+                            return getSelectedBaseObjects();
+                        }
+                    });
+        enableButtonOnSelectedItems(button);
+        addButton(button);
     }
 
     @Override
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js
index 0faaf75d392..6f307d795b6 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/public/phosphonetx-dictionary.js
@@ -42,11 +42,11 @@ var phosphonetx = {
   ALL_RAW_DATA_SAMPLES_menu_item: "All MS INJECTION Samples",  
   ALL_RAW_DATA_SAMPLES_tab_label: "MS INJECTION Samples and Related Biological Samples",  
   openbis_raw_data_sample_browser_CODE: "MS INJECTION Sample",
-  openbis_raw_data_sample_browser_REGISTRATION_DATE: "Regustration Date",
+  openbis_raw_data_sample_browser_REGISTRATION_DATE: "Registration Date",
   openbis_raw_data_sample_browser_PARENT: "Biological Sample",
-  copy_data_sets_button_label: "Copy Data Sets",
-  copy_data_sets_title: "Copy Data Sets Confirmation",
-  copy_data_sets_message: "Do you want to make the data sets of the samples {0} available for processing?", 
+  copy_data_sets_button_label: "Process Data Sets",
+  copy_data_sets_title: "Process Data Sets Confirmation",
+  copy_data_sets_message: "Do you want to process '{0}' for the data sets of the samples {1}?", 
   
   // LAST LINE: KEEP IT AT THE END
   lastline: "" // we need a line without a comma
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java
index a78874bc47f..74852de88f0 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/client/web/server/PhosphoNetXClientService.java
@@ -201,10 +201,10 @@ public class PhosphoNetXClientService extends AbstractClientService implements
         return prepareExportEntities(exportCriteria);
     }
     
-    public void copyRawData(long[] rawDataSampleIDs)
+    public void processRawData(String dataSetProcessingKey, long[] rawDataSampleIDs)
             throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException
     {
-        rawDataService.copyRawData(getSessionToken(), rawDataSampleIDs);
+        rawDataService.processRawData(getSessionToken(), dataSetProcessingKey, rawDataSampleIDs);
     }
     
 }
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataService.java
index 3fd32b1a160..cb6a0c32bb1 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataService.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataService.java
@@ -67,13 +67,15 @@ public class RawDataService extends AbstractServer<IRawDataService> implements I
         }
     }
 
-    public void copyRawData(String sessionToken, String userID, long[] rawDataSampleIDs)
+    public void processingRawData(String sessionToken, String userID, String dataSetProcessingKey,
+            long[] rawDataSampleIDs)
     {
         checkSession(sessionToken);
         SessionContextDTO session = login(userID);
         try
         {
-            service.copyRawData(session.getSessionToken(), rawDataSampleIDs);
+            service.processRawData(session.getSessionToken(), dataSetProcessingKey,
+                    rawDataSampleIDs);
         } finally
         {
             service.logout(session.getSessionToken());
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternal.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternal.java
index 9dbaf9c9ddd..228dc07ebd7 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternal.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternal.java
@@ -56,9 +56,7 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.authorization.validato
  */
 public class RawDataServiceInternal extends AbstractServer<IRawDataServiceInternal> implements IRawDataServiceInternal
 {
-    @Private static final String COPY_PROCESSING_KEY = "copy-data-sets";
-
-    @Private static final String GROUP_CODE = "MS_DATA";
+     @Private static final String GROUP_CODE = "MS_DATA";
 
     @Private static final String RAW_DATA_SAMPLE_TYPE = "MS_INJECTION";
     
@@ -95,11 +93,12 @@ public class RawDataServiceInternal extends AbstractServer<IRawDataServiceIntern
         return loadAllRawDataSamples(getSession(sessionToken));
     }
     
-    public void copyRawData(String sessionToken, long[] rawDataSampleIDs)
+    public void processRawData(String sessionToken, String dataSetProcessingKey,
+            long[] rawDataSampleIDs)
     {
         Session session = getSession(sessionToken);
         PersonPE person = session.tryGetPerson();
-        
+
         List<Sample> samples = loadAllRawDataSamples(session);
         Set<Long> sampleIDs = new HashSet<Long>();
         for (Sample sample : samples)
@@ -109,7 +108,7 @@ public class RawDataServiceInternal extends AbstractServer<IRawDataServiceIntern
                 sampleIDs.add(sample.getId());
             }
         }
-        
+
         ISampleDAO sampleDAO = getDAOFactory().getSampleDAO();
         IExternalDataDAO externalDataDAO = getDAOFactory().getExternalDataDAO();
         List<String> dataSetCodes = new ArrayList<String>();
@@ -127,10 +126,10 @@ public class RawDataServiceInternal extends AbstractServer<IRawDataServiceIntern
                 dataSetCodes.add(dataSet.getCode());
             }
         }
-        String dataStoreServerCode = findDataStoreServer();
+        String dataStoreServerCode = findDataStoreServer(dataSetProcessingKey);
         IExternalDataTable externalDataTable =
                 businessObjectFactory.createExternalDataTable(session);
-        externalDataTable.processDatasets(COPY_PROCESSING_KEY, dataStoreServerCode, dataSetCodes);
+        externalDataTable.processDatasets(dataSetProcessingKey, dataStoreServerCode, dataSetCodes);
     }
 
     private List<Sample> loadAllRawDataSamples(Session session)
@@ -147,7 +146,7 @@ public class RawDataServiceInternal extends AbstractServer<IRawDataServiceIntern
         return sampleLister.list(criteria2);
     }
     
-    private String findDataStoreServer()
+    private String findDataStoreServer(String dataSetProcessingKey)
     {
         List<DataStorePE> dataStores = getDAOFactory().getDataStoreDAO().listDataStores();
         for (DataStorePE dataStore : dataStores)
@@ -156,13 +155,13 @@ public class RawDataServiceInternal extends AbstractServer<IRawDataServiceIntern
             for (DataStoreServicePE dataStoreService : services)
             {
                 if (DataStoreServiceKind.PROCESSING.equals(dataStoreService.getKind())
-                        && COPY_PROCESSING_KEY.equals(dataStoreService.getKey()))
+                        && dataSetProcessingKey.equals(dataStoreService.getKey()))
                 {
                     return dataStore.getCode();
                 }
             }
         }
         throw new EnvironmentFailureException("No data store processing service with key '"
-                + COPY_PROCESSING_KEY + "' found.");
+                + dataSetProcessingKey + "' found.");
     }
 }
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternalLogger.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternalLogger.java
index 98fbf7a4772..824c9dc0f08 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternalLogger.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternalLogger.java
@@ -44,7 +44,7 @@ class RawDataServiceInternalLogger extends AbstractServerLogger implements IRawD
         return null;
     }
     
-    public void copyRawData(String sessionToken, long[] rawDataSampleIDs)
+    public void processRawData(String sessionToken, String dataSetProcessingKey, long[] rawDataSampleIDs)
     {
         int numberOfDataSets = rawDataSampleIDs == null ? 0 : rawDataSampleIDs.length;
         logAccess(sessionToken, "copy_raw_data", "NUMBER_OF_DATA_SETS(%s)", numberOfDataSets);
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceLogger.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceLogger.java
index 32d98dff7e0..7af4229bcac 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceLogger.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceLogger.java
@@ -44,11 +44,13 @@ class RawDataServiceLogger extends AbstractServerLogger implements IRawDataServi
         return null;
     }
 
-    public void copyRawData(String sessionToken, String userID, long[] rawDataSampleIDs)
+    public void processingRawData(String sessionToken, String userID, String dataSetProcessingKey,
+            long[] rawDataSampleIDs)
     {
         int numberOfDataSets = rawDataSampleIDs == null ? 0 : rawDataSampleIDs.length;
-        logAccess(sessionToken, "copy_raw_data", "USER_ID(%s) NUMBER_OF_DATA_SETS(%s)", userID,
-                numberOfDataSets);
+        logAccess(sessionToken, "copy_raw_data",
+                "USER_ID(%s) DSS_PROCESSING_PLUGIN(%s) NUMBER_OF_DATA_SETS(%s)", userID,
+                dataSetProcessingKey, numberOfDataSets);
     }
 
 }
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IRawDataService.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IRawDataService.java
index 542e60a5b70..9160444ef8c 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IRawDataService.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IRawDataService.java
@@ -39,8 +39,14 @@ public interface IRawDataService extends IServer
     @Transactional(readOnly = true)
     @RolesAllowed(RoleSet.INSTANCE_ADMIN_OBSERVER)
     public List<Sample> listRawDataSamples(String sessionToken, String userID);
-    
+
+    /**
+     * Processes the data sets of specified samples by the DSS processing plug-in of specified key
+     * for the specified user. Implementations should check that the specified user is allowed
+     * to read specified samples.
+     */
     @Transactional(readOnly = true)
     @RolesAllowed(RoleSet.INSTANCE_ADMIN_OBSERVER)
-    public void copyRawData(String sessionToken, String userID, long[] rawDataSampleIDs);
+    public void processingRawData(String sessionToken, String userID, String dataSetProcessingKey,
+            long[] rawDataSampleIDs);
 }
diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IRawDataServiceInternal.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IRawDataServiceInternal.java
index f0b3483c468..d782ccf07da 100644
--- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IRawDataServiceInternal.java
+++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IRawDataServiceInternal.java
@@ -45,5 +45,5 @@ public interface IRawDataServiceInternal extends IServer
     
     @Transactional(readOnly = true)
     @RolesAllowed(RoleSet.USER)
-    public void copyRawData(String sessionToken, long[] rawDataSampleIDs);
+    public void processRawData(String sessionToken, String dataSetProcessingKey, long[] rawDataSampleIDs);
 }
\ No newline at end of file
diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/RawDataTestClient.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/RawDataTestClient.java
index 392f06676b3..6b4ef6d7726 100644
--- a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/RawDataTestClient.java
+++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/RawDataTestClient.java
@@ -67,6 +67,6 @@ public class RawDataTestClient
             Sample sample = samples.get(i);
             ids[i] = sample.getId();
         }
-        service.copyRawData(sessionToken, "test_a", ids);
+        service.processingRawData(sessionToken, "test_a", "copy-data-sets", ids);
     }
 }
diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternalTest.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternalTest.java
index 866bfec3698..6b4074dee2a 100644
--- a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternalTest.java
+++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceInternalTest.java
@@ -18,7 +18,6 @@ package ch.systemsx.cisd.openbis.plugin.phosphonetx.server;
 
 import static ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStoreServiceKind.PROCESSING;
 import static ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStoreServiceKind.QUERIES;
-import static ch.systemsx.cisd.openbis.plugin.phosphonetx.server.RawDataServiceInternal.COPY_PROCESSING_KEY;
 import static ch.systemsx.cisd.openbis.plugin.phosphonetx.server.RawDataServiceInternal.GROUP_CODE;
 import static ch.systemsx.cisd.openbis.plugin.phosphonetx.server.RawDataServiceInternal.RAW_DATA_SAMPLE_TYPE;
 
@@ -57,6 +56,7 @@ import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IRawDataServiceInterna
 @Friend(toClasses=RawDataServiceInternal.class)
 public class RawDataServiceInternalTest extends AbstractServerTestCase
 {
+    private static final String COPY_PROCESSING_KEY = "copy-data-sets";
     private IRawDataServiceInternal service;
     private ICommonBusinessObjectFactory boFactory;
     private ISampleLister sampleLister;
@@ -126,7 +126,7 @@ public class RawDataServiceInternalTest extends AbstractServerTestCase
                 
             });
         
-        service.copyRawData(SESSION_TOKEN, ids);
+        service.processRawData(SESSION_TOKEN, COPY_PROCESSING_KEY, ids);
         
         context.assertIsSatisfied();
     }
diff --git a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceTest.java b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceTest.java
index 0424cfea03e..af5128232cd 100644
--- a/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceTest.java
+++ b/rtd_phosphonetx/sourceTest/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/RawDataServiceTest.java
@@ -99,7 +99,7 @@ public class RawDataServiceTest extends AbstractServerTestCase
 
         try
         {
-            service.copyRawData(SESSION_TOKEN, "abc", new long[0]);
+            service.processingRawData(SESSION_TOKEN, "abc", null, new long[0]);
             fail("UserFailureException expected");
         } catch (UserFailureException ex)
         {
@@ -118,11 +118,11 @@ public class RawDataServiceTest extends AbstractServerTestCase
         context.checking(new Expectations()
             {
                 {
-                    one(internalService).copyRawData(session2.getSessionToken(), ids);
+                    one(internalService).processRawData(session2.getSessionToken(), null, ids);
                 }
             });
 
-        service.copyRawData(SESSION_TOKEN, "abc", ids);
+        service.processingRawData(SESSION_TOKEN, "abc", null, ids);
 
         context.assertIsSatisfied();
     }
-- 
GitLab