private Long fileCount = 0L;
private Long fileSize = 0L;
private Long quotaLeftSize = 0L;
+ private Long bandwithQuotaUsed=0L;
-
-
- /**
- *
- */
public StatsDTO() {
}
- /**
- * @param fileCount
- * @param fileSize
- * @param quotaLeftSize
- */
- public StatsDTO(Long fileCount, Long fileSize, Long quotaLeftSize) {
- this.fileCount = fileCount;
- this.fileSize = fileSize;
- this.quotaLeftSize = quotaLeftSize;
+ public StatsDTO(Long aFileCount, Long aFileSize, Long aQuotaLeftSize) {
+ fileCount = aFileCount;
+ fileSize = aFileSize;
+ quotaLeftSize = aQuotaLeftSize;
}
/**
/**
* Modify the fileCount.
*
- * @param fileCount the fileCount to set
+ * @param aFileCount the fileCount to set
*/
- public void setFileCount(Long fileCount) {
- this.fileCount = fileCount;
+ public void setFileCount(Long aFileCount) {
+ fileCount = aFileCount;
}
/**
/**
* Modify the fileSize.
*
- * @param fileSize the fileSize to set
+ * @param aFileSize the fileSize to set
*/
- public void setFileSize(Long fileSize) {
- this.fileSize = fileSize;
+ public void setFileSize(Long aFileSize) {
+ fileSize = aFileSize;
}
/**
/**
* Modify the quotaLeftSize.
*
- * @param quotaLeftSize the quotaLeftSize to set
+ * @param aQuotaLeftSize the quotaLeftSize to set
+ */
+ public void setQuotaLeftSize(Long aQuotaLeftSize) {
+ quotaLeftSize = aQuotaLeftSize;
+ }
+
+
+
+ /**
+ * Retrieve the bandwithQuotaUsed.
+ *
+ * @return the bandwithQuotaUsed
+ */
+ public Long getBandwithQuotaUsed() {
+ return bandwithQuotaUsed;
+ }
+
+
+ /**
+ * Modify the bandwithQuotaUsed.
+ *
+ * @param aBandwithQuotaUsed the bandwithQuotaUsed to set
*/
- public void setQuotaLeftSize(Long quotaLeftSize) {
- this.quotaLeftSize = quotaLeftSize;
+ public void setBandwithQuotaUsed(Long aBandwithQuotaUsed) {
+ bandwithQuotaUsed = aBandwithQuotaUsed;
}
+
public String getFileSizeAsString() {
if (fileSize < 1024)
return String.valueOf(fileSize) + " B";
return getSize(quotaLeftSize , (1024D*1024D*1024D)) + " GB";
}
+ public String getBandwithQuotaUsedAsString() {
+ if (bandwithQuotaUsed < 1024)
+ return String.valueOf(bandwithQuotaUsed) + " B";
+ else if (bandwithQuotaUsed <= 1024*1024)
+ return getSize(bandwithQuotaUsed, 1024D) + " KB";
+ else if (bandwithQuotaUsed <= 1024*1024*1024)
+ return getSize(bandwithQuotaUsed,(1024D*1024D)) + " MB";
+ return getSize(bandwithQuotaUsed , (1024D*1024D*1024D)) + " GB";
+ }
+
private String getSize(Long size, Double division){
Double res = Double.valueOf(size.toString())/division;
NumberFormat nf = NumberFormat.getFormat("######.#");
public long percentOfFreeSpace(){
return quotaLeftSize*100/(fileSize+quotaLeftSize);
}
-
}