From 8738594d0605cff911e38dfa46ed71013f8d651b Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 29 Jul 2014 09:11:20 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@99052 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/trservice/QueryService.java | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/QueryService.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/QueryService.java index 9c08b76..92dae55 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/QueryService.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/trservice/QueryService.java @@ -59,8 +59,12 @@ public class QueryService { ArrayList occurences = new ArrayList(); - TableId tableId = new TableId(new Long(column.getTrId() - .getTableId())); + TableId tableId; + if (column.getTrId().isViewTable()) { + tableId= new TableId(new Long(column.getTrId().getReferenceTargetTableId())); + } else { + tableId = new TableId(new Long(column.getTrId().getTableId())); + } ColumnLocalId columnId = new ColumnLocalId(column.getColumnId()); QuerySelect querySelect = null; QueryGroup queryGroup = null; @@ -105,19 +109,21 @@ public class QueryService { querySelect = new QuerySelect(Arrays.asList( new QueryColumn(columnId), new QueryColumn( - sourceColumnId),new QueryColumn(columnId, - Function.COUNT))); + sourceColumnId), new QueryColumn( + columnId, Function.COUNT))); logger.debug("Occurences querySelect:" + querySelect.toString()); - queryGroup = new QueryGroup(Arrays.asList(columnId, sourceColumnId)); + queryGroup = new QueryGroup(Arrays.asList(columnId, + sourceColumnId)); logger.debug("Occurences queryGroup:" + queryGroup.toString()); } else { - //ColumnLocalId idColumn = retrieveColumnLocalIdOFIdColumnType( - // column.getTrId(), service); + // ColumnLocalId idColumn = + // retrieveColumnLocalIdOFIdColumnType( + // column.getTrId(), service); querySelect = new QuerySelect(Arrays.asList( - new QueryColumn(columnId),new QueryColumn(columnId, - Function.COUNT))); + new QueryColumn(columnId), new QueryColumn( + columnId, Function.COUNT))); logger.debug("Occurences querySelect:" + querySelect.toString()); queryGroup = new QueryGroup(Arrays.asList(columnId)); @@ -357,11 +363,12 @@ public class QueryService { if (column.isViewColumn()) { occurence = new Occurrences( currentRow.getString(0), - currentRow.getString(1), currentRow.getInt(2)); + currentRow.getString(1), + currentRow.getInt(2)); } else { occurence = new Occurrences( - currentRow.getString(0), - "1", currentRow.getInt(1)); + currentRow.getString(0), "1", + currentRow.getInt(1)); } break; case CastValidation: @@ -478,14 +485,13 @@ public class QueryService { } - public static String retrieveColumnDimensionValue(String rowId, ColumnData column, TabularDataService service) throws TDGWTServiceException { try { logger.debug("RetriveColumnDimensionValue: [rowId=" + rowId + ", column=" + column + "]"); - + column.getColumnViewData().getSourceTableDimensionColumnId(); TableId tableId = new TableId(new Long(column.getTrId() @@ -542,7 +548,7 @@ public class QueryService { logger.debug("Reading rows from json"); String colValue = null; String dimensionValue = null; - if(i < totalRows) { + if (i < totalRows) { currentRow = rows.getJSONArray(i); colValue = currentRow.getString(0); dimensionValue = currentRow.getString(1);