Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94399 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-04 16:59:24 +00:00
parent ef8e75dcab
commit 35bebe87b8
3 changed files with 127 additions and 3 deletions

View File

@ -620,23 +620,25 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Table table = service.getTable(new TableId(Long.valueOf(trId
.getTableId())));
Column columnSource=table.getColumnByName(columnName);
if(columnSource==null){
logger.error("Column not present on table");
throw new TDGWTServiceException("Column not present on table");
}
logger.debug("getValidationColumns(): columnSource ColumnLocalId "+columnSource.getLocalId());
logger.debug("getValidationColumns(): columnSource "+columnSource.getLocalId());
String columnSourceId=columnSource.getLocalId().getValue();
ArrayList<ColumnData> columns = new ArrayList<ColumnData>();
List<Column> cols = table.getColumns();
int i = 0;
for (Column c : cols) {
if (c.getColumnType() instanceof ValidationColumnType) {
logger.debug("ValidationColumn present: "+c.getLocalId());
if (c.contains(ValidationReferencesMetadata.class)) {
logger.debug("ValidationReferencesMetadata present");
ValidationReferencesMetadata validationReferenceMetadata = c
.getMetadata(ValidationReferencesMetadata.class);
List<ColumnLocalId> valColumnList=validationReferenceMetadata.getValidationReferenceColumn();

View File

@ -0,0 +1,66 @@
package org.gcube.portlets.user.td.gwtservice.client;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
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.table.Table;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.exception.InvalidTabularResourceException;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTableException;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTabularResourceException;
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.junit.Test;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TestServiceColumn {
private final static long trId = 225;
private final String columnLocalId="a5aedc5b-b843-451b-9659-afd672656276";
@Test
public void TestTROperation() {
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
AuthorizationProvider.instance.set(new AuthorizationToken(
Constants.DEFAULT_USER));
TabularDataService service = TabularDataServiceFactory.getService();
TabularResourceId tabularResourceId = new TabularResourceId(trId);
Table lastTable;
try {
lastTable = service.getLastTable(tabularResourceId);
} catch (NoSuchTabularResourceException e) {
System.out.println("No such tabular resource with id: " + trId);
e.printStackTrace();
return;
} catch (InvalidTabularResourceException e) {
System.out.println("Invalid tabular resource with id: " + trId);
e.printStackTrace();
return;
} catch (NoSuchTableException e) {
System.out.println("No such last table for: " + trId);
e.printStackTrace();
return;
}
System.out.println(lastTable.toString());
ColumnLocalId clId=new ColumnLocalId(columnLocalId);
Column column=lastTable.getColumnById(clId);
System.out.println(column.toString());
}
}

View File

@ -0,0 +1,56 @@
package org.gcube.portlets.user.td.gwtservice.client;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
import org.gcube.data.analysis.tabulardata.model.table.Table;
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.exception.InvalidTabularResourceException;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTableException;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTabularResourceException;
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.junit.Test;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TestServiceTable {
private final static long trId = 225;
@Test
public void TestTROperation() {
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
AuthorizationProvider.instance.set(new AuthorizationToken(
Constants.DEFAULT_USER));
TabularDataService service = TabularDataServiceFactory.getService();
TabularResourceId tabularResourceId = new TabularResourceId(trId);
Table lastTable;
try {
lastTable = service.getLastTable(tabularResourceId);
} catch (NoSuchTabularResourceException e) {
System.out.println("No such tabular resource with id: " + trId);
e.printStackTrace();
return;
} catch (InvalidTabularResourceException e) {
System.out.println("Invalid tabular resource with id: " + trId);
e.printStackTrace();
return;
} catch (NoSuchTableException e) {
System.out.println("No such last table for: " + trId);
e.printStackTrace();
return;
}
System.out.println(lastTable.toString());
}
}