Added Tasks Validations
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@95438 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f558e79fe3
commit
85fcced0cb
6
pom.xml
6
pom.xml
|
@ -149,7 +149,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>csv4j</artifactId>
|
||||
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<!-- <version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
|
||||
</dependency>
|
||||
|
||||
<!-- Service Client -->
|
||||
|
@ -164,12 +164,12 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-core</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<!-- <version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version> -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-wrapper</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<!-- <version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version> -->
|
||||
</dependency>
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
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.task.ValidationsTasksMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplyMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
||||
|
@ -203,6 +204,19 @@ public interface TDGWTService extends RemoteService {
|
|||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
|
||||
|
||||
//Validations
|
||||
/**
|
||||
* Returns validations contained in the tasks
|
||||
*
|
||||
* @param trId
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ValidationsTasksMetadata getValidationsTasksMetadata(TRId trId)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Return Validations Metadata of Table
|
||||
*
|
||||
|
@ -226,6 +240,7 @@ public interface TDGWTService extends RemoteService {
|
|||
public ArrayList<ColumnData> getValidationColumns(TRId trId,
|
||||
String columnName) throws TDGWTServiceException;
|
||||
|
||||
|
||||
//RollBack
|
||||
/**
|
||||
* Call rollback on tabular resource
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
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.task.ValidationsTasksMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplyMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
||||
|
@ -91,13 +92,16 @@ public interface TDGWTServiceAsync {
|
|||
void getLastTable(TRId trId, AsyncCallback<TableData> callback);
|
||||
void getTable(TRId trId, AsyncCallback<TableData> 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 getColumns(AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getColumns(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getColumnsForDimension(TRId trId, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
void getColumn(TRId trId, String columnName, AsyncCallback<ColumnData> callback);
|
||||
void getColumn(String columnLocalId,TRId trId, AsyncCallback<ColumnData> callback);
|
||||
|
||||
//Validations
|
||||
void getValidationsTasksMetadata(TRId trId,AsyncCallback<ValidationsTasksMetadata> callback);
|
||||
void getTableValidationsMetadata(TRId trId,AsyncCallback<TabValidationsMetadata> callback);
|
||||
void getValidationColumns(TRId trId, String columnName, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
//RollBack
|
||||
|
|
|
@ -75,6 +75,7 @@ import org.gcube.data.analysis.tabulardata.model.table.type.CodelistTableType;
|
|||
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
|
||||
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTemplateException;
|
||||
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
|
||||
import org.gcube.data.analysis.tabulardata.service.operation.Job;
|
||||
import org.gcube.data.analysis.tabulardata.service.operation.Task;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.HistoryStep;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.HistoryStepId;
|
||||
|
@ -122,6 +123,10 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
|||
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.task.JobS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.State;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplyMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
|
||||
|
@ -2916,7 +2921,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
ArrayList<Validations> vList = new ArrayList<Validations>();
|
||||
int i = 0;
|
||||
for (Validation v : vals) {
|
||||
valid = new Validations(i, v.getDescription(),
|
||||
valid = new Validations(String.valueOf(i), v.getDescription(),
|
||||
v.isValid());
|
||||
vList.add(valid);
|
||||
i++;
|
||||
|
@ -3804,24 +3809,24 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
protected ArrayList<OperationExecution> retrieveOperationExecution(
|
||||
TabularDataService service, DeleteColumnSession deleteColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
|
||||
|
||||
logger.debug(deleteColumnSession.toString());
|
||||
List<OperationDefinition> capabilities = service.getCapabilities();
|
||||
OperationDefinition operationDefinition;
|
||||
operationDefinition = OperationDefinitionMap.map(
|
||||
OperationsId.RemoveColumn.toString(), capabilities);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
|
||||
ArrayList<OperationExecution> invocations = new ArrayList<OperationExecution>();
|
||||
for (ColumnData col : deleteColumnSession.getColumns()) {
|
||||
|
||||
OperationExecution invocation = null;
|
||||
|
||||
|
||||
invocation = new OperationExecution(col.getColumnId(),
|
||||
operationDefinition.getOperationId(), map);
|
||||
invocations.add(invocation);
|
||||
}
|
||||
|
||||
|
||||
return invocations;
|
||||
}
|
||||
|
||||
|
@ -4149,9 +4154,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
ArrayList<OperationExecution> invocation = retrieveOperationExecution(service,
|
||||
deleteColumnSession);
|
||||
|
||||
ArrayList<OperationExecution> invocation = retrieveOperationExecution(
|
||||
service, deleteColumnSession);
|
||||
if (invocation == null) {
|
||||
throw new TDGWTServiceException(
|
||||
"Error Delete Column: Operation not supported for now!");
|
||||
|
@ -6184,4 +6189,63 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationsTasksMetadata getValidationsTasksMetadata(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();
|
||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||
new Long(trId.getId()));
|
||||
|
||||
ArrayList<TaskS> taskSList = new ArrayList<TaskS>();
|
||||
List<Task> tasks = service.getTasks(tabularResourceId);
|
||||
for (Task task : tasks) {
|
||||
ArrayList<JobS> jobSList = new ArrayList<JobS>();
|
||||
int j = 1;
|
||||
for (Job job : task.getTaskJobs()) {
|
||||
int i = 1;
|
||||
ArrayList<Validations> validations = new ArrayList<Validations>();
|
||||
for (Validation val : job.getValidations()) {
|
||||
Validations validation = new Validations(String.valueOf(i),
|
||||
val.getDescription(), val.isValid());
|
||||
validations.add(validation);
|
||||
i++;
|
||||
}
|
||||
JobS jobS = new JobS(String.valueOf(j), job.getProgress(),
|
||||
job.getHumaReadableStatus(), job.getDescription(),
|
||||
validations);
|
||||
jobSList.add(jobS);
|
||||
j++;
|
||||
|
||||
}
|
||||
State state = TaskStateMap.map(task.getStatus());
|
||||
TaskS taskS = new TaskS(task.getId().getValue(),
|
||||
task.getProgress(), state, task.getSubmitter(),
|
||||
task.getStartTime(), task.getEndTime(), jobSList);
|
||||
taskSList.add(taskS);
|
||||
}
|
||||
|
||||
ValidationsTasksMetadata validationsTasksMetadata = new ValidationsTasksMetadata(
|
||||
taskSList);
|
||||
|
||||
logger.debug("ValidationsTasksMetadata: "
|
||||
+ validationsTasksMetadata);
|
||||
return validationsTasksMetadata;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error(
|
||||
"Error in getValidationsTasksMetadata(): "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException(
|
||||
"Error in getValidationsTasksMetadata: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.task;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
*/
|
||||
public class JobS implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4502877601374000292L;
|
||||
|
||||
protected String id; //For grid only
|
||||
protected float progress;
|
||||
protected String humaReadableStatus;
|
||||
protected String description;
|
||||
protected ArrayList<Validations> validations;
|
||||
|
||||
public JobS() {
|
||||
|
||||
}
|
||||
|
||||
public JobS(String id, float progress, String humaReadableStatus, String description,
|
||||
ArrayList<Validations> validations) {
|
||||
this.id=id;
|
||||
this.progress=progress;
|
||||
this.humaReadableStatus=humaReadableStatus;
|
||||
this.description=description;
|
||||
this.validations=validations;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public float getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(float progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public String getHumaReadableStatus() {
|
||||
return humaReadableStatus;
|
||||
}
|
||||
|
||||
public void setHumaReadableStatus(String humaReadableStatus) {
|
||||
this.humaReadableStatus = humaReadableStatus;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public ArrayList<Validations> getValidations() {
|
||||
return validations;
|
||||
}
|
||||
|
||||
public void setValidations(ArrayList<Validations> validations) {
|
||||
this.validations = validations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JobS [id=" + id + ", progress=" + progress
|
||||
+ ", humaReadableStatus=" + humaReadableStatus
|
||||
+ ", description=" + description + ", validations="
|
||||
+ validations + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.task;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
*/
|
||||
public class TaskS implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8228657333318157153L;
|
||||
|
||||
protected String id;
|
||||
protected float progress;
|
||||
protected State state;
|
||||
protected String submitter;
|
||||
protected Date startTime;
|
||||
protected Date endTime;
|
||||
protected ArrayList<JobS> jobs;
|
||||
|
||||
public TaskS() {
|
||||
|
||||
}
|
||||
|
||||
public TaskS(String id, float progress, State state, String submitter,
|
||||
Date startTime, Date endTime, ArrayList<JobS> jobs) {
|
||||
this.id = id;
|
||||
this.progress = progress;
|
||||
this.state = state;
|
||||
this.submitter = submitter;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.jobs = jobs;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public float getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(float progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getSubmitter() {
|
||||
return submitter;
|
||||
}
|
||||
|
||||
public void setSubmitter(String submitter) {
|
||||
this.submitter = submitter;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public ArrayList<JobS> getJobs() {
|
||||
return jobs;
|
||||
}
|
||||
|
||||
public void setJobs(ArrayList<JobS> jobs) {
|
||||
this.jobs = jobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "STask [id=" + id + ", progress=" + progress + ", state="
|
||||
+ state + ", submitter=" + submitter + ", startTime="
|
||||
+ startTime + ", endTime=" + endTime + ", jobs=" + jobs + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.task;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ValidationsTasksMetadata implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 4767980931682849226L;
|
||||
String id="ValidationsTasksMetadata";
|
||||
String title="Validations";
|
||||
ArrayList<TaskS> tasks;
|
||||
|
||||
public ValidationsTasksMetadata(){
|
||||
|
||||
}
|
||||
|
||||
public ValidationsTasksMetadata(ArrayList<TaskS> tasks){
|
||||
this.tasks=tasks;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public ArrayList<TaskS> getTasks() {
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public void setTasks(ArrayList<TaskS> tasks) {
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValidationsTasksMetadata [id=" + id + ", title=" + title
|
||||
+ ", tasks=" + tasks + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@ import java.io.Serializable;
|
|||
*/
|
||||
public class Validations implements Serializable {
|
||||
private static final long serialVersionUID = 4950002331717895999L;
|
||||
Integer id;// Only for grid
|
||||
String id;// Only for grid
|
||||
String description;
|
||||
Boolean valid;
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class Validations implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
public Validations(Integer id, String description, Boolean valid) {
|
||||
public Validations(String id, String description, Boolean valid) {
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.valid = valid;
|
||||
|
@ -39,11 +39,11 @@ public class Validations implements Serializable {
|
|||
this.valid = valid;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations;
|
|||
public class TabValidationsMetadata implements TabMetadata {
|
||||
|
||||
private static final long serialVersionUID = 3321995330377334019L;
|
||||
String id="ValidationsMetadata";
|
||||
String id="TabValidationsMetadata";
|
||||
String title="Validations";
|
||||
ArrayList<Validations> validations;
|
||||
|
||||
|
|
Loading…
Reference in New Issue