Added JobClassifier

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@113601 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-13 15:50:42 +00:00
parent 85667e846c
commit b699cc27e8
7 changed files with 185 additions and 52 deletions

View File

@ -151,6 +151,7 @@ import org.gcube.portlets.user.td.gwtservice.server.resource.ResourceTypeMap;
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
import org.gcube.portlets.user.td.gwtservice.server.trservice.ColumnDataTypeMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractReferences;
import org.gcube.portlets.user.td.gwtservice.server.trservice.JobClassifierMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.LicenceMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.PeriodTypeMap;
@ -200,6 +201,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.source.SourceType;
import org.gcube.portlets.user.td.gwtservice.shared.statistical.StatisticalOperationSession;
import org.gcube.portlets.user.td.gwtservice.shared.task.InvocationS;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobS;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier;
import org.gcube.portlets.user.td.gwtservice.shared.task.State;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResubmitSession;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskResumeSession;
@ -4333,7 +4335,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
ArrayList<Validations> vList = new ArrayList<Validations>();
int i = 0;
for (Validation v : vals) {
valid = new Validations(String.valueOf(i),
valid = new Validations(String.valueOf(i),"",
v.getDescription(), v.isValid(), null, null);
vList.add(valid);
i++;
@ -6863,11 +6865,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
ArrayList<Validations> validations = new ArrayList<Validations>();
for (ValidationDescriptor val : job.getValidations()) {
Validations validation = new Validations(
String.valueOf(i), val.getDescription(),
String.valueOf(i),val.getTitle(), val.getDescription(),
val.isValid(),
ConditionCodeMap.mapConditionCode(val
.getConditionCode()),
val.getValidationColumn());
validations.add(validation);
i++;
}
@ -6896,8 +6899,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
operationExecution.getOperationId(), mapSent,
task.getId().getValue(), refColumn);
}
JobSClassifier jobClassifier=JobClassifierMap.map(job.getJobClassifier());
JobS jobS = new JobS(String.valueOf(j), job.getProgress(),
job.getHumaReadableStatus(), job.getDescription(),
job.getHumaReadableStatus(), jobClassifier, job.getDescription(),
validations, invocationS);
jobSList.add(jobS);
j++;

View File

@ -0,0 +1,32 @@
package org.gcube.portlets.user.td.gwtservice.server.trservice;
import org.gcube.data.analysis.tabulardata.service.operation.JobClassifier;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class JobClassifierMap {
public static JobSClassifier map(JobClassifier jobClassifier) {
if (jobClassifier == null) {
return JobSClassifier.UNKNOWN;
}
switch (jobClassifier) {
case DATAVALIDATION:
return JobSClassifier.DATAVALIDATION;
case POSTPROCESSING:
return JobSClassifier.POSTPROCESSING;
case PREPROCESSING:
return JobSClassifier.PREPROCESSING;
case PROCESSING:
return JobSClassifier.PROCESSING;
default:
return JobSClassifier.UNKNOWN;
}
}
}

View File

@ -26,6 +26,7 @@ import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.NameMetadata;
import org.gcube.portlets.user.td.gwtservice.server.SessionUtil;
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
import org.gcube.portlets.user.td.gwtservice.server.trservice.JobClassifierMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TabularResourceTypeMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.WorkerStateMap;
@ -34,6 +35,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceExcept
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobS;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskWrapper;
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsJobS;
@ -168,9 +170,11 @@ public class BackgroundOperationMonitorCreator {
validationsJobS.add(validationJ);
j++;
}
JobSClassifier jobClassifier=JobClassifierMap.map(job.getJobClassifier());
JobS jobS = new JobS(String.valueOf(i), job.getProgress(),
job.getHumaReadableStatus(), job.getDescription(),
job.getHumaReadableStatus(), jobClassifier, job.getDescription(),
WorkerStateMap.map(job.getStatus()), job.getErrorMessage(),
validationsJobS);

View File

@ -25,6 +25,7 @@ import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
import org.gcube.portlets.user.td.gwtservice.server.SessionUtil;
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
import org.gcube.portlets.user.td.gwtservice.server.trservice.JobClassifierMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TabularResourceTypeMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
import org.gcube.portlets.user.td.gwtservice.server.trservice.WorkerStateMap;
@ -33,6 +34,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceExcept
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobS;
import org.gcube.portlets.user.td.gwtservice.shared.task.JobSClassifier;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskS;
import org.gcube.portlets.user.td.gwtservice.shared.task.TaskWrapper;
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsJobS;
@ -166,9 +168,12 @@ public class OperationMonitorCreator {
validationsJobS.add(validationJ);
j++;
}
JobSClassifier jobClassifier=JobClassifierMap.map(job.getJobClassifier());
JobS jobS = new JobS(String.valueOf(i), job.getProgress(),
job.getHumaReadableStatus(), job.getDescription(),
job.getHumaReadableStatus(), jobClassifier, job.getDescription(),
WorkerStateMap.map(job.getStatus()), job.getErrorMessage(),
validationsJobS);

View File

@ -7,22 +7,24 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations;
/**
*
* @author "Giancarlo Panichi"
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
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 InvocationS invocation;
protected ArrayList<Validations> validations;
protected Throwable errorMessage;
protected WorkerState workerState;
protected ArrayList<ValidationsJobS> validationsJobS;
private String id; // For grid only
private float progress;
private String humaReadableStatus;
private JobSClassifier jobClassifier;
private String description;
private InvocationS invocation;
private ArrayList<Validations> validations;
private Throwable errorMessage;
private WorkerState workerState;
private ArrayList<ValidationsJobS> validationsJobS;
public JobS() {
@ -39,11 +41,12 @@ public class JobS implements Serializable {
* @param invocation
*/
public JobS(String id, float progress, String humaReadableStatus,
String description, ArrayList<Validations> validations,
JobSClassifier jobClassifier, String description, ArrayList<Validations> validations,
InvocationS invocation) {
this.id = id;
this.progress = progress;
this.humaReadableStatus = humaReadableStatus;
this.jobClassifier=jobClassifier;
this.description = description;
this.validations = validations;
this.invocation = invocation;
@ -64,11 +67,12 @@ public class JobS implements Serializable {
* @param validationsJobs
*/
public JobS(String id, float progress, String humaReadableStatus,
String description, WorkerState workerState,
JobSClassifier jobClassifier,String description, WorkerState workerState,
Throwable errorMessage, ArrayList<ValidationsJobS> validationsJobs) {
this.id = id;
this.progress = progress;
this.humaReadableStatus = humaReadableStatus;
this.jobClassifier=jobClassifier;
this.description = description;
this.validationsJobS = validationsJobs;
this.errorMessage = errorMessage;
@ -101,6 +105,14 @@ public class JobS implements Serializable {
this.humaReadableStatus = humaReadableStatus;
}
public JobSClassifier getJobClassifier() {
return jobClassifier;
}
public void setJobClassifier(JobSClassifier jobClassifier) {
this.jobClassifier = jobClassifier;
}
public String getDescription() {
return description;
}
@ -153,10 +165,13 @@ public class JobS implements Serializable {
public String toString() {
return "JobS [id=" + id + ", progress=" + progress
+ ", humaReadableStatus=" + humaReadableStatus
+ ", description=" + description + ", invocation=" + invocation
+ ", validations=" + validations + ", errorMessage="
+ errorMessage + ", workerState=" + workerState
+ ", validationsJobS=" + validationsJobS + "]";
+ ", jobClassifier=" + jobClassifier + ", description="
+ description + ", invocation=" + invocation + ", validations="
+ validations + ", errorMessage=" + errorMessage
+ ", workerState=" + workerState + ", validationsJobS="
+ validationsJobS + "]";
}
}

View File

@ -0,0 +1,58 @@
package org.gcube.portlets.user.td.gwtservice.shared.task;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum JobSClassifier implements Serializable{
PREPROCESSING("Preprocessing"),
PROCESSING("Processing"),
POSTPROCESSING("Postprocessing"),
DATAVALIDATION("Data Validation"),
UNKNOWN("Unknown");
/**
* @param text
*/
private JobSClassifier(final String id) {
this.id = id;
}
private final String id;
@Override
public String toString() {
return id;
}
public static List<JobSClassifier> getList(){
return Arrays.asList(values());
}
public static JobSClassifier getJobClassifierFromId(
String id) {
for(JobSClassifier jobClassifier:values()){
if (id.compareTo(jobClassifier.id) == 0) {
return jobClassifier;
}
}
return null;
}
public String getLabel(){
return id;
}
}

View File

@ -12,11 +12,12 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCode;
*/
public class Validations implements Serializable {
private static final long serialVersionUID = 4950002331717895999L;
protected String id;// Only for grid
protected String description;
protected Boolean valid;
protected ConditionCode conditionCode;
protected String validationColumnColumnId;
private String id;// Only for grid
private String title;
private String description;
private boolean valid;
private ConditionCode conditionCode;
private String validationColumnColumnId;
/**
*
@ -33,29 +34,15 @@ public class Validations implements Serializable {
* @param conditionCode
* @param validationColumnColumnId
*/
public Validations(String id, String description, Boolean valid, ConditionCode conditionCode
public Validations(String id, String title, String description, boolean valid, ConditionCode conditionCode
, String validationColumnColumnId) {
this.id = id;
this.title=title;
this.description = description;
this.valid = valid;
this.conditionCode = conditionCode;
this.validationColumnColumnId=validationColumnColumnId;
}
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 String getId() {
@ -66,6 +53,30 @@ public class Validations implements Serializable {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
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 ConditionCode getConditionCode() {
return conditionCode;
}
@ -73,9 +84,7 @@ public class Validations implements Serializable {
public void setConditionCode(ConditionCode conditionCode) {
this.conditionCode = conditionCode;
}
public String getValidationColumnColumnId() {
return validationColumnColumnId;
}
@ -86,14 +95,18 @@ public class Validations implements Serializable {
@Override
public String toString() {
return "Validations [id=" + id + ", description=" + description
+ ", valid=" + valid + ", conditionCode=" + conditionCode
+ ", validationColumnColumnId=" + validationColumnColumnId
+ "]";
return "Validations [id=" + id + ", title=" + title + ", description="
+ description + ", valid=" + valid + ", conditionCode="
+ conditionCode + ", validationColumnColumnId="
+ validationColumnColumnId + "]";
}
}