From fd1d9bda3d8f86f54a9803d2a0aa933c44180971 Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Tue, 23 Feb 2010 08:43:07 +0000
Subject: [PATCH] [LMS-1361] extracted common code

SVN: 14878
---
 .../query/client/web/server/QueryClientService.java  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientService.java
index 768c216e075..7bc7dc2d09e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientService.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientService.java
@@ -95,8 +95,7 @@ public class QueryClientService extends AbstractClientService implements IQueryC
             final String sessionToken = getSessionToken();
             final TableModel tableModel =
                     queryServer.queryDatabase(sessionToken, sqlQuery, bindingsOrNull);
-            String resultSetKey = saveInCache(tableModel.getRows());
-            return new TableModelReference(resultSetKey, tableModel.getHeader());
+            return createTableModelReference(tableModel);
         } catch (final UserFailureException e)
         {
             throw UserFailureExceptionTranslator.translate(e);
@@ -111,14 +110,19 @@ public class QueryClientService extends AbstractClientService implements IQueryC
             final String sessionToken = getSessionToken();
             final TableModel tableModel =
                     queryServer.queryDatabase(sessionToken, query, bindingsOrNull);
-            String resultSetKey = saveInCache(tableModel.getRows());
-            return new TableModelReference(resultSetKey, tableModel.getHeader());
+            return createTableModelReference(tableModel);
         } catch (final UserFailureException e)
         {
             throw UserFailureExceptionTranslator.translate(e);
         }
     }
 
+    private TableModelReference createTableModelReference(TableModel tableModel)
+    {
+        String resultSetKey = saveInCache(tableModel.getRows());
+        return new TableModelReference(resultSetKey, tableModel.getHeader());
+    }
+
     public List<QueryExpression> listQueries()
             throws ch.systemsx.cisd.openbis.generic.client.web.client.exception.UserFailureException
     {
-- 
GitLab