workspace-task-executor-lib.../src/main/java/org/gcube/common/workspacetaskexecutor/shared/TaskExecutionStatus.java

168 lines
3.1 KiB
Java

package org.gcube.common.workspacetaskexecutor.shared;
import java.io.Serializable;
/**
* The Class TaskExecutionStatus.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Apr 27, 2018
*/
public class TaskExecutionStatus implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6733806455721902864L;
private Long errorCount;
private Status status;
private float percentCompleted = 0;
private String log;
private String currentMessage="Waiting to start..";
/**
* Instantiates a new task exection status.
*/
public TaskExecutionStatus() {
}
/**
* Instantiates a new task execution status.
*
* @param errorCount the error count
* @param status the status
* @param log the log
* @param currentMessage the current message
* @param percentCompleted the percent completed
*/
public TaskExecutionStatus(Long errorCount, Status status,
String log, String currentMessage, float percentCompleted) {
super();
this.errorCount = errorCount;
this.status = status;
this.log = log;
this.currentMessage = currentMessage;
this.percentCompleted = percentCompleted;
}
/**
* Gets the error count.
*
* @return the error count
*/
public Long getErrorCount() {
return errorCount;
}
/**
* Sets the error count.
*
* @param errorCount the new error count
*/
public void setErrorCount(Long errorCount) {
this.errorCount = errorCount;
}
/**
* Gets the status.
*
* @return the status
*/
public Status getStatus() {
return status;
}
/**
* Sets the status.
*
* @param status the new status
*/
public void setStatus(Status status) {
this.status = status;
}
/**
* Gets the log builder.
*
* @return the log builder
*/
public String getLog() {
return log;
}
/**
* Adds the log.
*
* @param logMessage the log message
*/
public void addLog(String logMessage) {
if(log==null)
this.log = logMessage;
else
log+=logMessage;
}
/**
* Gets the current message.
*
* @return the current message
*/
public String getCurrentMessage() {
return currentMessage;
}
/**
* Sets the current message.
*
* @param currentMessage the new current message
*/
public void setCurrentMessage(String currentMessage) {
this.currentMessage = currentMessage;
}
/**
* Gets the percent completed.
*
* @return the percent completed
*/
public float getPercentCompleted() {
return percentCompleted;
}
/**
* Sets the percent completed.
*
* @param percentCompleted the new percent completed
*/
public void setPercentCompleted(float percentCompleted) {
this.percentCompleted = percentCompleted;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RunningTaskStatus [errorCount=");
builder.append(errorCount);
builder.append(", status=");
builder.append(status);
builder.append(", percentCompleted=");
builder.append(percentCompleted);
builder.append(", log=");
builder.append(log);
builder.append(", currentMessage=");
builder.append(currentMessage);
builder.append("]");
return builder.toString();
}
}