diff --git a/pom.xml b/pom.xml index c963206..66fc2fb 100644 --- a/pom.xml +++ b/pom.xml @@ -149,7 +149,7 @@ org.gcube.common csv4j - [1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT) + @@ -164,12 +164,12 @@ org.gcube.contentmanagement storage-manager-core - [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) + org.gcube.contentmanagement storage-manager-wrapper - [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT) + diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java index c4f1cdf..0bd9c7d 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTService.java @@ -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 getValidationColumns(TRId trId, String columnName) throws TDGWTServiceException; + //RollBack /** * Call rollback on tabular resource diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java index 047b8c5..72e533b 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/client/rpc/TDGWTServiceAsync.java @@ -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 callback); void getTable(TRId trId, AsyncCallback callback); void getTableMetadata(TRId trId, AsyncCallback> callback); - void getTableValidationsMetadata(TRId trId,AsyncCallback callback); void getTRMetadata(TRId trId, AsyncCallback> callback); void getColumns(AsyncCallback> callback); void getColumns(TRId trId, AsyncCallback> callback); void getColumnsForDimension(TRId trId, AsyncCallback> callback); void getColumn(TRId trId, String columnName, AsyncCallback callback); void getColumn(String columnLocalId,TRId trId, AsyncCallback callback); + + //Validations + void getValidationsTasksMetadata(TRId trId,AsyncCallback callback); + void getTableValidationsMetadata(TRId trId,AsyncCallback callback); void getValidationColumns(TRId trId, String columnName, AsyncCallback> callback); //RollBack diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java index 40a9a8c..9d052f5 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java @@ -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 vList = new ArrayList(); 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 retrieveOperationExecution( TabularDataService service, DeleteColumnSession deleteColumnSession) throws TDGWTServiceException { - + logger.debug(deleteColumnSession.toString()); List capabilities = service.getCapabilities(); OperationDefinition operationDefinition; operationDefinition = OperationDefinitionMap.map( OperationsId.RemoveColumn.toString(), capabilities); Map map = new HashMap(); - + ArrayList invocations = new ArrayList(); 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 invocation = retrieveOperationExecution(service, - deleteColumnSession); + + ArrayList 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 taskSList = new ArrayList(); + List tasks = service.getTasks(tabularResourceId); + for (Task task : tasks) { + ArrayList jobSList = new ArrayList(); + int j = 1; + for (Job job : task.getTaskJobs()) { + int i = 1; + ArrayList validations = new ArrayList(); + 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()); + } + } + } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/JobS.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/JobS.java new file mode 100644 index 0000000..a1c150d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/JobS.java @@ -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; + + public JobS() { + + } + + public JobS(String id, float progress, String humaReadableStatus, String description, + ArrayList 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 getValidations() { + return validations; + } + + public void setValidations(ArrayList validations) { + this.validations = validations; + } + + @Override + public String toString() { + return "JobS [id=" + id + ", progress=" + progress + + ", humaReadableStatus=" + humaReadableStatus + + ", description=" + description + ", validations=" + + validations + "]"; + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/TaskS.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/TaskS.java new file mode 100644 index 0000000..6569c6e --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/TaskS.java @@ -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; + + public TaskS() { + + } + + public TaskS(String id, float progress, State state, String submitter, + Date startTime, Date endTime, ArrayList 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 getJobs() { + return jobs; + } + + public void setJobs(ArrayList jobs) { + this.jobs = jobs; + } + + @Override + public String toString() { + return "STask [id=" + id + ", progress=" + progress + ", state=" + + state + ", submitter=" + submitter + ", startTime=" + + startTime + ", endTime=" + endTime + ", jobs=" + jobs + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/ValidationsTasksMetadata.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/ValidationsTasksMetadata.java new file mode 100644 index 0000000..76d8842 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/task/ValidationsTasksMetadata.java @@ -0,0 +1,63 @@ +package org.gcube.portlets.user.td.gwtservice.shared.task; + +import java.io.Serializable; +import java.util.ArrayList; + + + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class ValidationsTasksMetadata implements Serializable { + + + private static final long serialVersionUID = 4767980931682849226L; + String id="ValidationsTasksMetadata"; + String title="Validations"; + ArrayList tasks; + + public ValidationsTasksMetadata(){ + + } + + public ValidationsTasksMetadata(ArrayList 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 getTasks() { + return tasks; + } + + public void setTasks(ArrayList tasks) { + this.tasks = tasks; + } + + @Override + public String toString() { + return "ValidationsTasksMetadata [id=" + id + ", title=" + title + + ", tasks=" + tasks + "]"; + } + + + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/table/Validations.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/table/Validations.java index a61ebcb..647996d 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/table/Validations.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/table/Validations.java @@ -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; } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/table/metadata/TabValidationsMetadata.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/table/metadata/TabValidationsMetadata.java index 781e19c..b0e9ccb 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/table/metadata/TabValidationsMetadata.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/table/metadata/TabValidationsMetadata.java @@ -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;