tabular-data-gwt-service/src/main/java/org/gcube/portlets/user/td/gxtservice/shared/file/FileUploadMonitor.java

117 lines
2.4 KiB
Java

/**
*
*/
package org.gcube.portlets.user.td.gxtservice.shared.file;
import java.io.Serializable;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class FileUploadMonitor implements Serializable {
private static final long serialVersionUID = -1150111422206443617L;
protected long totalLenght;
protected long elaboratedLenght;
protected FileUploadState state;
protected String failureReason;
protected String failureDetails;
public FileUploadMonitor(){
state = FileUploadState.INPROGRESS;
}
public FileUploadMonitor(long totalLenght, long elaboratedLenght, FileUploadState state, String failureReason) {
this.totalLenght = totalLenght;
this.elaboratedLenght = elaboratedLenght;
this.state = state;
this.failureReason = failureReason;
}
/**
* @return the totalLenght
*/
public long getTotalLenght() {
return totalLenght;
}
/**
* @return the elaboratedLenght
*/
public long getElaboratedLenght() {
return elaboratedLenght;
}
public FileUploadState getState(){
return state;
}
/**
* @return the failureDetails
*/
public String getFailureDetails() {
return failureDetails;
}
public void setState(FileUploadState state)
{
this.state = state;
}
/**
* @return the reason
*/
public String getFailureReason() {
return failureReason;
}
/**
* @param totalLenght the totalLenght to set
*/
public void setTotalLenght(long totalLenght) {
this.totalLenght = totalLenght;
}
/**
* @param elaboratedLenght the elaboratedLenght to set
*/
public void setElaboratedLenght(long elaboratedLenght) {
this.elaboratedLenght = elaboratedLenght;
}
/**
* @param failed the failed to set
*/
public void setFailed(String failureReason, String failureDetails) {
this.state = FileUploadState.FAILED;
this.failureReason = failureReason;
this.failureDetails = failureDetails;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("OperationProgress [totalLenght=");
builder.append(totalLenght);
builder.append(", elaboratedLenght=");
builder.append(elaboratedLenght);
builder.append(", state=");
builder.append(state);
builder.append(", failureReason=");
builder.append(failureReason);
builder.append(", failureDetails=");
builder.append(failureDetails);
builder.append("]");
return builder.toString();
}
}