Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@93536 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-03-25 17:03:29 +00:00
parent 286feaeb47
commit b8c92d051c
1 changed files with 6 additions and 89 deletions

View File

@ -45,7 +45,9 @@ import org.gcube.data.analysis.tabulardata.model.column.Column;
import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId;
import org.gcube.data.analysis.tabulardata.model.column.ColumnReference;
import org.gcube.data.analysis.tabulardata.model.column.ColumnType;
import org.gcube.data.analysis.tabulardata.model.column.type.AnnotationColumnType;
import org.gcube.data.analysis.tabulardata.model.column.type.CodeColumnType;
import org.gcube.data.analysis.tabulardata.model.column.type.CodeDescriptionColumnType;
import org.gcube.data.analysis.tabulardata.model.column.type.CodeNameColumnType;
import org.gcube.data.analysis.tabulardata.model.column.type.DimensionColumnType;
import org.gcube.data.analysis.tabulardata.model.column.type.IdColumnType;
@ -3782,94 +3784,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
*
* @param trId
* @param aslSession
* @return
* @throws TDGWTServiceException
*/
public ArrayList<ColumnData> getColumnsForDimension(TRId trId,
ASLSession aslSession) throws TDGWTServiceException {
try {
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername()));
TabularDataService service = TabularDataServiceFactory.getService();
logger.debug("getColumnsForDimension():" + trId.toString());
Table table = service.getTable(new TableId(Long.valueOf(trId
.getTableId())));
ArrayList<ColumnData> columns = new ArrayList<ColumnData>();
List<Column> cols = table.getColumns();
int i = 0;
for (Column c : cols) {
ColumnType ctype = c.getColumnType();
if (c.getColumnType() instanceof IdColumnType
|| c.getColumnType() instanceof ValidationColumnType
|| c.getColumnType() instanceof DimensionColumnType
|| c.getColumnType() instanceof TimeDimensionColumnType) {
} else {
if (c.contains(ViewColumnMetadata.class)) {
} else {
if (ctype instanceof CodeColumnType
|| ctype instanceof CodeNameColumnType) {
ColumnData cData = new ColumnData();
cData.setId(Integer.toString(i));
cData.setColumnId(c.getLocalId().getValue());
cData.setName(c.getName());
cData.setTypeCode(c.getColumnType().getCode());
cData.setTypeName(c.getColumnType().getName());
cData.setDataTypeName(c.getDataType().getName());
NamesMetadata labelsMetadata = null;
try {
labelsMetadata = c
.getMetadata(NamesMetadata.class);
} catch (NoSuchMetadataException e) {
logger.debug("labelMetadata: NoSuchMetadataException "
+ e.getLocalizedMessage());
}
if (labelsMetadata == null) {
cData.setLabel("nolabel");
logger.debug("LabelsMetadata no labels");
} else {
LocalizedText cl = null;
cl = labelsMetadata.getTextWithLocale("en");
if (cl == null) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(cl.getValue());
logger.debug("Column Set Label: "
+ cl.getValue());
}
}
cData.setTrId(trId);
columns.add(cData);
i++;
}
}
}
}
return columns;
} catch (Throwable e) {
logger.error(
"Error in getColumnsForDimension() retrieving Columns: "
+ e.getLocalizedMessage(), e);
throw new TDGWTServiceException("Error retrieving Columns: "
+ e.getLocalizedMessage());
}
}
/**
*
* {@inheritDoc}
@ -3906,7 +3821,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} else {
if (ctype instanceof CodeColumnType
|| ctype instanceof CodeNameColumnType) {
|| ctype instanceof CodeNameColumnType
|| ctype instanceof CodeDescriptionColumnType
|| ctype instanceof AnnotationColumnType) {
ColumnData cData = new ColumnData();
cData.setId(Integer.toString(i));