Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@93389 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-03-20 15:40:08 +00:00
parent 18198f4a3b
commit 40661ff7b9
3 changed files with 181 additions and 104 deletions

View File

@ -46,8 +46,11 @@ 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.CodeColumnType;
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;
import org.gcube.data.analysis.tabulardata.model.column.type.TimeDimensionColumnType;
import org.gcube.data.analysis.tabulardata.model.column.type.ValidationColumnType;
import org.gcube.data.analysis.tabulardata.model.metadata.column.ViewColumnMetadata;
import org.gcube.data.analysis.tabulardata.model.metadata.common.DescriptionsMetadata;
import org.gcube.data.analysis.tabulardata.model.metadata.common.ImmutableLocalizedText;
import org.gcube.data.analysis.tabulardata.model.metadata.common.LocalizedText;
@ -103,6 +106,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo;
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnViewData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.batch.Occurences;
@ -226,7 +230,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
logger.debug("GetTabResourceInformation():" + currentTR.toString());
TRId trId=retrieveTabularResourceType(currentTR.getTrId());
TRId trId = retrieveTabularResourceType(currentTR.getTrId());
currentTR.setTrId(trId);
ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR
@ -261,7 +265,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
// ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("GetTabResourceInformation(TRId):" + trId.toString());
TabResource currentTR = new TabResource();
trId=retrieveTabularResourceType(trId);
trId = retrieveTabularResourceType(trId);
currentTR.setTrId(trId);
ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR
.getTrId());
@ -317,6 +321,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* Returns ArrayList<ColumnData> other than IdColumnType,
* ValidationColumnType, DimensionColumnType and TimeDimensionColumnType
*
* {@inheritDoc}
*/
@ -345,10 +351,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
List<Column> cols = table.getColumns();
int i = 0;
for (Column c : cols) {
if (c.getColumnType() instanceof IdColumnType) {
if (c.getColumnType() instanceof IdColumnType
|| c.getColumnType() instanceof ValidationColumnType
|| c.getColumnType() instanceof DimensionColumnType
|| c.getColumnType() instanceof TimeDimensionColumnType) {
} else {
if (c.getColumnType() instanceof ValidationColumnType) {
if (c.contains(ViewColumnMetadata.class)) {
} else {
ColumnData cData = new ColumnData();
@ -399,6 +408,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* Returns ArrayList<ColumnData> other than IdColumnType,
* ValidationColumnType, DimensionColumnType and TimeDimensionColumnType
*
*
* {@inheritDoc}
*/
@ -422,10 +434,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
List<Column> cols = table.getColumns();
int i = 0;
for (Column c : cols) {
if (c.getColumnType() instanceof IdColumnType) {
if (c.getColumnType() instanceof IdColumnType
|| c.getColumnType() instanceof ValidationColumnType
|| c.getColumnType() instanceof DimensionColumnType
|| c.getColumnType() instanceof TimeDimensionColumnType) {
} else {
if (c.getColumnType() instanceof ValidationColumnType) {
if (c.contains(ViewColumnMetadata.class)) {
} else {
ColumnData cData = new ColumnData();
@ -502,9 +517,32 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setId(Integer.toString(0));
cData.setColumnId(c.getLocalId().getValue());
cData.setName(c.getName());
if (c.contains(ViewColumnMetadata.class)) {
ViewColumnMetadata viewMetadata = c
.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);
cData.setColumnViewData(columnViewData);
cData.setViewColumn(true);
} else {
cData.setViewColumn(false);
}
cData.setTypeCode(c.getColumnType().getCode());
cData.setTypeName(c.getColumnType().getName());
cData.setDataTypeName(c.getDataType().getName());
NamesMetadata labelsMetadata = null;
try {
labelsMetadata = c.getMetadata(NamesMetadata.class);
@ -1372,7 +1410,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
new Long(trId.getId()));
TabularResource tr = service.getTabularResource(tabularResourceId);
trId.setTableType(tr.getTableType());
logger.debug("Retrieved TRId type:"+ trId.toString());
logger.debug("Retrieved TRId type:" + trId.toString());
return trId;
} catch (Throwable e) {
@ -3619,6 +3657,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
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) {
@ -3631,7 +3679,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setDataTypeName(c.getDataType().getName());
NamesMetadata labelsMetadata = null;
try {
labelsMetadata = c.getMetadata(NamesMetadata.class);
labelsMetadata = c
.getMetadata(NamesMetadata.class);
} catch (NoSuchMetadataException e) {
logger.debug("labelMetadata: NoSuchMetadataException "
+ e.getLocalizedMessage());
@ -3648,7 +3697,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " + cl.getValue());
logger.debug("Column Set Label: "
+ cl.getValue());
}
}
cData.setTrId(trId);
@ -3656,6 +3706,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
i++;
}
}
}
}
return columns;
} catch (Throwable e) {
@ -3693,6 +3746,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
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) {
@ -3705,7 +3767,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setDataTypeName(c.getDataType().getName());
NamesMetadata labelsMetadata = null;
try {
labelsMetadata = c.getMetadata(NamesMetadata.class);
labelsMetadata = c
.getMetadata(NamesMetadata.class);
} catch (NoSuchMetadataException e) {
logger.debug("labelMetadata: NoSuchMetadataException "
+ e.getLocalizedMessage());
@ -3722,7 +3785,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " + cl.getValue());
logger.debug("Column Set Label: "
+ cl.getValue());
}
}
cData.setTrId(trId);
@ -3730,6 +3794,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
i++;
}
}
}
}
return columns;
} catch (Throwable e) {

View File

@ -22,7 +22,8 @@ public class ColumnData implements Serializable {
protected String dataTypeName;
protected String label;
protected TRId trId;
protected ColumnViewData columnView;
protected boolean viewColumn;
protected ColumnViewData columnViewData;
public String getColumnId() {
return columnId;
@ -88,12 +89,20 @@ public class ColumnData implements Serializable {
this.label = label;
}
public ColumnViewData getColumnView() {
return columnView;
public ColumnViewData getColumnViewData() {
return columnViewData;
}
public void setColumnView(ColumnViewData columnView) {
this.columnView = columnView;
public void setColumnViewData(ColumnViewData columnViewData) {
this.columnViewData = columnViewData;
}
public boolean isViewColumn() {
return viewColumn;
}
public void setViewColumn(boolean viewColumn) {
this.viewColumn = viewColumn;
}
@Override
@ -101,10 +110,13 @@ public class ColumnData implements Serializable {
return "ColumnData [id=" + id + ", columnId=" + columnId + ", name="
+ name + ", typeName=" + typeName + ", typeCode=" + typeCode
+ ", dataTypeName=" + dataTypeName + ", label=" + label
+ ", trId=" + trId + ", columnView=" + columnView + "]";
+ ", trId=" + trId + ", viewColumn=" + viewColumn
+ ", columnViewData=" + columnViewData + "]";
}
}

View File

@ -4,25 +4,27 @@ import java.io.Serializable;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ColumnViewData implements Serializable {
private static final long serialVersionUID = 6727733264842637144L;
protected boolean viewColumn;
protected String sourceTableDimensionColumnId;
protected String targetTableColumnId;
protected long targetTableId;
public boolean isViewColumn() {
return viewColumn;
public ColumnViewData() {
}
public void setViewColumn(boolean viewColumn) {
this.viewColumn = viewColumn;
public ColumnViewData(String sourceTableDimensionColumnId,
String targetTableColumnId, long targetTableId) {
this.sourceTableDimensionColumnId = sourceTableDimensionColumnId;
this.targetTableColumnId = targetTableColumnId;
this.targetTableId = targetTableId;
}
public String getSourceTableDimensionColumnId() {
@ -52,13 +54,10 @@ public class ColumnViewData implements Serializable {
@Override
public String toString() {
return "ColumnViewData [viewColumn=" + viewColumn
+ ", sourceTableDimensionColumnId="
return "ColumnViewData [sourceTableDimensionColumnId="
+ sourceTableDimensionColumnId + ", targetTableColumnId="
+ targetTableColumnId + ", targetTableId=" + targetTableId
+ "]";
}
}