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
This commit is contained in:
Giancarlo Panichi 2014-07-29 09:11:20 +00:00
parent 1eb3f07073
commit 8738594d06
1 changed files with 21 additions and 15 deletions

View File

@ -59,8 +59,12 @@ public class QueryService {
ArrayList<Occurrences> occurences = new ArrayList<Occurrences>(); ArrayList<Occurrences> occurences = new ArrayList<Occurrences>();
TableId tableId = new TableId(new Long(column.getTrId() TableId tableId;
.getTableId())); 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()); ColumnLocalId columnId = new ColumnLocalId(column.getColumnId());
QuerySelect querySelect = null; QuerySelect querySelect = null;
QueryGroup queryGroup = null; QueryGroup queryGroup = null;
@ -105,19 +109,21 @@ public class QueryService {
querySelect = new QuerySelect(Arrays.asList( querySelect = new QuerySelect(Arrays.asList(
new QueryColumn(columnId), new QueryColumn( new QueryColumn(columnId), new QueryColumn(
sourceColumnId),new QueryColumn(columnId, sourceColumnId), new QueryColumn(
Function.COUNT))); columnId, Function.COUNT)));
logger.debug("Occurences querySelect:" logger.debug("Occurences querySelect:"
+ querySelect.toString()); + querySelect.toString());
queryGroup = new QueryGroup(Arrays.asList(columnId, sourceColumnId)); queryGroup = new QueryGroup(Arrays.asList(columnId,
sourceColumnId));
logger.debug("Occurences queryGroup:" logger.debug("Occurences queryGroup:"
+ queryGroup.toString()); + queryGroup.toString());
} else { } else {
//ColumnLocalId idColumn = retrieveColumnLocalIdOFIdColumnType( // ColumnLocalId idColumn =
// column.getTrId(), service); // retrieveColumnLocalIdOFIdColumnType(
// column.getTrId(), service);
querySelect = new QuerySelect(Arrays.asList( querySelect = new QuerySelect(Arrays.asList(
new QueryColumn(columnId),new QueryColumn(columnId, new QueryColumn(columnId), new QueryColumn(
Function.COUNT))); columnId, Function.COUNT)));
logger.debug("Occurences querySelect:" logger.debug("Occurences querySelect:"
+ querySelect.toString()); + querySelect.toString());
queryGroup = new QueryGroup(Arrays.asList(columnId)); queryGroup = new QueryGroup(Arrays.asList(columnId));
@ -357,11 +363,12 @@ public class QueryService {
if (column.isViewColumn()) { if (column.isViewColumn()) {
occurence = new Occurrences( occurence = new Occurrences(
currentRow.getString(0), currentRow.getString(0),
currentRow.getString(1), currentRow.getInt(2)); currentRow.getString(1),
currentRow.getInt(2));
} else { } else {
occurence = new Occurrences( occurence = new Occurrences(
currentRow.getString(0), currentRow.getString(0), "1",
"1", currentRow.getInt(1)); currentRow.getInt(1));
} }
break; break;
case CastValidation: case CastValidation:
@ -478,7 +485,6 @@ public class QueryService {
} }
public static String retrieveColumnDimensionValue(String rowId, public static String retrieveColumnDimensionValue(String rowId,
ColumnData column, TabularDataService service) ColumnData column, TabularDataService service)
throws TDGWTServiceException { throws TDGWTServiceException {
@ -542,7 +548,7 @@ public class QueryService {
logger.debug("Reading rows from json"); logger.debug("Reading rows from json");
String colValue = null; String colValue = null;
String dimensionValue = null; String dimensionValue = null;
if(i < totalRows) { if (i < totalRows) {
currentRow = rows.getJSONArray(i); currentRow = rows.getJSONArray(i);
colValue = currentRow.getString(0); colValue = currentRow.getString(0);
dimensionValue = currentRow.getString(1); dimensionValue = currentRow.getString(1);