Updated time table retrieving

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@111399 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-01-15 17:39:13 +00:00
parent 2a86a730d9
commit 9e1809883a
2 changed files with 73 additions and 76 deletions

View File

@ -1394,6 +1394,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
throw new TDGWTServiceException(
"Error retrieving Time Table: " + table);
}
logger.debug("Time Table Id: "+timeTable.getId());
Column timeColumn = timeTable
.getColumnByName(periodTypeMetadata.getType()
.getName());
@ -1425,16 +1426,18 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
if (sourceColumn.contains(PeriodTypeMetadata.class)) {
periodTypeMetadataSourceColumn = sourceColumn
.getMetadata(PeriodTypeMetadata.class);
periodTypeMetadataSourceColumn.getType();
Table timeTable = service
.getTimeTable(periodTypeMetadataSourceColumn.getType());
if (timeTable == null || timeTable.getId() == null) {
throw new TDGWTServiceException(
"Error retrieving Time Table: " + table);
}
logger.debug("Time Table Id: "+timeTable.getId());
Column timeColumn = timeTable
.getColumnByName(periodTypeMetadata.getType()
.getColumnByName(periodTypeMetadataSourceColumn.getType()
.getName());
String sourceTableDimensionColumnId = viewMetadata
@ -1806,7 +1809,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("getLastTable: " + trId);
logger.debug("getLastTable(): " + trId);
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService();
@ -1867,29 +1870,27 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
colData.setTypeCode(column.getColumnType().getCode());
colData.setDataTypeName(column.getDataType().getName());
colData.setTrId(newTRId);
PeriodTypeMetadata periodTypeMetadata = null;
if (column.contains(PeriodTypeMetadata.class)) {
periodTypeMetadata = column
.getMetadata(PeriodTypeMetadata.class);
PeriodType periodType = periodTypeMetadata
.getType();
colData.setPeriodDataType(PeriodTypeMap
.map(periodType));
}
ColumnRelationship rel = column.getRelationship();
if (rel != null) {
RelationshipData relData = new RelationshipData(rel
.getTargetTableId().getValue(), rel
.getTargetColumnId().getValue());
RelationshipData relData = retrieveRelationship(service,
table, column, periodTypeMetadata, rel);
colData.setRelationship(relData);
}
if (column.contains(ViewColumnMetadata.class)) {
ViewColumnMetadata viewMetadata = column
.getMetadata(ViewColumnMetadata.class);
logger.debug("ViewColumnMetadata: "
+ viewMetadata.toString());
String sourceTableDimensionColumnId = viewMetadata
.getSourceTableDimensionColumnId().getValue();
String targetTableColumnId = viewMetadata
.getTargetTableColumnId().getValue();
long targetTableId = viewMetadata.getTargetTableId()
.getValue();
ColumnViewData columnViewData = new ColumnViewData(
sourceTableDimensionColumnId,
targetTableColumnId, targetTableId);
ColumnViewData columnViewData = retrieveColumnViewData(service, table, column,
periodTypeMetadata);
colData.setColumnViewData(columnViewData);
colData.setViewColumn(true);
@ -1931,28 +1932,27 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
colData.setTypeCode(column.getColumnType().getCode());
colData.setDataTypeName(column.getDataType().getName());
colData.setTrId(newTRId);
PeriodTypeMetadata periodTypeMetadata = null;
if (column.contains(PeriodTypeMetadata.class)) {
periodTypeMetadata = column
.getMetadata(PeriodTypeMetadata.class);
PeriodType periodType = periodTypeMetadata
.getType();
colData.setPeriodDataType(PeriodTypeMap
.map(periodType));
}
ColumnRelationship rel = column.getRelationship();
if (rel != null) {
RelationshipData relData = new RelationshipData(rel
.getTargetTableId().getValue(), rel
.getTargetColumnId().getValue());
RelationshipData relData = retrieveRelationship(service,
viewTable, column, periodTypeMetadata, rel);
colData.setRelationship(relData);
}
if (column.contains(ViewColumnMetadata.class)) {
ViewColumnMetadata viewMetadata = column
.getMetadata(ViewColumnMetadata.class);
logger.debug("ViewColumnMetadata: "
+ viewMetadata.toString());
String sourceTableDimensionColumnId = viewMetadata
.getSourceTableDimensionColumnId().getValue();
String targetTableColumnId = viewMetadata
.getTargetTableColumnId().getValue();
long targetTableId = viewMetadata.getTargetTableId()
.getValue();
ColumnViewData columnViewData = new ColumnViewData(
sourceTableDimensionColumnId,
targetTableColumnId, targetTableId);
ColumnViewData columnViewData = retrieveColumnViewData(service, viewTable, column,
periodTypeMetadata);
colData.setColumnViewData(columnViewData);
colData.setViewColumn(true);
@ -2042,29 +2042,28 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
colData.setTypeCode(column.getColumnType().getCode());
colData.setDataTypeName(column.getDataType().getName());
colData.setTrId(newTRId);
PeriodTypeMetadata periodTypeMetadata = null;
if (column.contains(PeriodTypeMetadata.class)) {
periodTypeMetadata = column
.getMetadata(PeriodTypeMetadata.class);
PeriodType periodType = periodTypeMetadata
.getType();
colData.setPeriodDataType(PeriodTypeMap
.map(periodType));
}
ColumnRelationship rel = column.getRelationship();
if (rel != null) {
RelationshipData relData = new RelationshipData(rel
.getTargetTableId().getValue(), rel
.getTargetColumnId().getValue());
RelationshipData relData = retrieveRelationship(service,
table, column, periodTypeMetadata, rel);
colData.setRelationship(relData);
}
if (column.contains(ViewColumnMetadata.class)) {
ViewColumnMetadata viewMetadata = column
.getMetadata(ViewColumnMetadata.class);
logger.debug("ViewColumnMetadata: "
+ viewMetadata.toString());
String sourceTableDimensionColumnId = viewMetadata
.getSourceTableDimensionColumnId().getValue();
String targetTableColumnId = viewMetadata
.getTargetTableColumnId().getValue();
long targetTableId = viewMetadata.getTargetTableId()
.getValue();
ColumnViewData columnViewData = new ColumnViewData(
sourceTableDimensionColumnId,
targetTableColumnId, targetTableId);
ColumnViewData columnViewData = retrieveColumnViewData(service, table, column,
periodTypeMetadata);
colData.setColumnViewData(columnViewData);
colData.setViewColumn(true);
@ -2106,29 +2105,27 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
colData.setTypeCode(column.getColumnType().getCode());
colData.setDataTypeName(column.getDataType().getName());
colData.setTrId(newTRId);
PeriodTypeMetadata periodTypeMetadata = null;
if (column.contains(PeriodTypeMetadata.class)) {
periodTypeMetadata = column
.getMetadata(PeriodTypeMetadata.class);
PeriodType periodType = periodTypeMetadata
.getType();
colData.setPeriodDataType(PeriodTypeMap
.map(periodType));
}
ColumnRelationship rel = column.getRelationship();
if (rel != null) {
RelationshipData relData = new RelationshipData(rel
.getTargetTableId().getValue(), rel
.getTargetColumnId().getValue());
RelationshipData relData = retrieveRelationship(service,
viewTable, column, periodTypeMetadata, rel);
colData.setRelationship(relData);
}
if (column.contains(ViewColumnMetadata.class)) {
ViewColumnMetadata viewMetadata = column
.getMetadata(ViewColumnMetadata.class);
logger.debug("ViewColumnMetadata: "
+ viewMetadata.toString());
String sourceTableDimensionColumnId = viewMetadata
.getSourceTableDimensionColumnId().getValue();
String targetTableColumnId = viewMetadata
.getTargetTableColumnId().getValue();
long targetTableId = viewMetadata.getTargetTableId()
.getValue();
ColumnViewData columnViewData = new ColumnViewData(
sourceTableDimensionColumnId,
targetTableColumnId, targetTableId);
if (column.contains(ViewColumnMetadata.class)) {
ColumnViewData columnViewData = retrieveColumnViewData(service, viewTable, column,
periodTypeMetadata);
colData.setColumnViewData(columnViewData);
colData.setViewColumn(true);