Added Validations on Table
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94657 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
182f35c406
commit
412bf7e8e5
|
@ -51,12 +51,12 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabMetadata;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabValidationsMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.google.gwt.user.client.rpc.RemoteService;
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
|
||||||
|
@ -190,6 +190,18 @@ public interface TDGWTService extends RemoteService {
|
||||||
public ArrayList<TRMetadata> getTRMetadata(TRId trId)
|
public ArrayList<TRMetadata> getTRMetadata(TRId trId)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return Validations Metadata of Table
|
||||||
|
*
|
||||||
|
* @param trId
|
||||||
|
* @return
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public TabValidationsMetadata getTableValidationsMetadata(TRId trId)
|
||||||
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns ArrayList<ColumnData> that contains all the validation columns of
|
* Returns ArrayList<ColumnData> that contains all the validation columns of
|
||||||
* columnName
|
* columnName
|
||||||
|
|
|
@ -50,6 +50,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabMetadata;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabValidationsMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
|
||||||
|
@ -86,6 +87,7 @@ public interface TDGWTServiceAsync {
|
||||||
void getLastTable(TRId trId, AsyncCallback<TableData> callback);
|
void getLastTable(TRId trId, AsyncCallback<TableData> callback);
|
||||||
void getTable(TRId trId, AsyncCallback<TableData> callback);
|
void getTable(TRId trId, AsyncCallback<TableData> callback);
|
||||||
void getTableMetadata(TRId trId, AsyncCallback<ArrayList<TabMetadata>> callback);
|
void getTableMetadata(TRId trId, AsyncCallback<ArrayList<TabMetadata>> callback);
|
||||||
|
void getTableValidationsMetadata(TRId trId,AsyncCallback<TabValidationsMetadata> callback);
|
||||||
void getTRMetadata(TRId trId, AsyncCallback<ArrayList<TRMetadata>> callback);
|
void getTRMetadata(TRId trId, AsyncCallback<ArrayList<TRMetadata>> callback);
|
||||||
void getColumns(AsyncCallback<ArrayList<ColumnData>> callback);
|
void getColumns(AsyncCallback<ArrayList<ColumnData>> callback);
|
||||||
void getColumns(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
void getColumns(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||||
|
|
|
@ -61,6 +61,8 @@ import org.gcube.data.analysis.tabulardata.model.metadata.common.DescriptionsMet
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.ImmutableLocalizedText;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.ImmutableLocalizedText;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.LocalizedText;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.LocalizedText;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.common.NamesMetadata;
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.NamesMetadata;
|
||||||
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.Validation;
|
||||||
|
import org.gcube.data.analysis.tabulardata.model.metadata.common.ValidationsMetadata;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata;
|
import org.gcube.data.analysis.tabulardata.model.metadata.table.DatasetViewTableMetadata;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.table.ExportMetadata;
|
import org.gcube.data.analysis.tabulardata.model.metadata.table.ExportMetadata;
|
||||||
import org.gcube.data.analysis.tabulardata.model.metadata.table.GenericMapMetadata;
|
import org.gcube.data.analysis.tabulardata.model.metadata.table.GenericMapMetadata;
|
||||||
|
@ -156,12 +158,14 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabDescriptionsMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabDescriptionsMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabExportMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabExportMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabGenericMapMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabGenericMapMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabImportMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabImportMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabNamesMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabNamesMetadata;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabValidationsMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabVersionMetadata;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabVersionMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
|
||||||
|
@ -2841,7 +2845,56 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error(
|
logger.error(
|
||||||
"Error in getTRMetadata(): " + e.getLocalizedMessage(), e);
|
"Error in getTRMetadata(): " + e.getLocalizedMessage(), e);
|
||||||
throw new TDGWTServiceException("Error in getTableMetadata(): "
|
throw new TDGWTServiceException("Error in getTRMetadata(): "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param trId
|
||||||
|
* @return
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public TabValidationsMetadata getTableValidationsMetadata(TRId trId)
|
||||||
|
throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
|
logger.debug("GetTableValidationsMetadata on " + trId.toString());
|
||||||
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
|
aslSession.getUsername()));
|
||||||
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
|
||||||
|
Table table = service.getTable(new TableId(Long.valueOf(trId
|
||||||
|
.getTableId())));
|
||||||
|
TabValidationsMetadata tabValidationsMetadata=null;
|
||||||
|
if(table.contains(ValidationsMetadata.class)){
|
||||||
|
ValidationsMetadata validationsMetadata=table.getMetadata(ValidationsMetadata.class);
|
||||||
|
if(validationsMetadata!=null){
|
||||||
|
List<Validation> vals=validationsMetadata.getValidations();
|
||||||
|
if(vals!=null && vals.size()>0){
|
||||||
|
Validations valid=null;
|
||||||
|
ArrayList<Validations> vList=new ArrayList<Validations>();
|
||||||
|
int i=0;
|
||||||
|
for(Validation v:vals){
|
||||||
|
valid=new Validations(i,v.getDescription(),v.isValid());
|
||||||
|
vList.add(valid);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
tabValidationsMetadata=new TabValidationsMetadata();
|
||||||
|
tabValidationsMetadata.setValidations(vList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tabValidationsMetadata;
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error(
|
||||||
|
"Error in getTableValidationMetadata(): " + e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
throw new TDGWTServiceException("Error in getTableValidationMetadata: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.shared.tr.table;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Validations implements Serializable {
|
||||||
|
private static final long serialVersionUID = 4950002331717895999L;
|
||||||
|
Integer id;// Only for grid
|
||||||
|
String description;
|
||||||
|
Boolean valid;
|
||||||
|
|
||||||
|
public Validations() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Validations(Integer id, String description, Boolean valid) {
|
||||||
|
this.id = id;
|
||||||
|
this.description = description;
|
||||||
|
this.valid = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isValid() {
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValid(Boolean valid) {
|
||||||
|
this.valid = valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Validations [id=" + id + ", description=" + description
|
||||||
|
+ ", valid=" + valid + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TabValidationsMetadata implements TabMetadata {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3321995330377334019L;
|
||||||
|
String id="ValidationsMetadata";
|
||||||
|
String title="Validations";
|
||||||
|
ArrayList<Validations> validations;
|
||||||
|
|
||||||
|
|
||||||
|
public ArrayList<Validations> getValidations() {
|
||||||
|
return validations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidations(ArrayList<Validations> validations) {
|
||||||
|
this.validations = validations;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TabValidationsMetadata [id=" + id + ", title=" + title
|
||||||
|
+ ", validations=" + validations + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue