X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/16baf609bb746ccbc6cd8da7213ee74cf474f2a9..d032a4f42c6fb404979a33662fbd774fcaa5e8f2:/src/gr/ebs/gss/server/domain/dto/StatsDTO.java diff --git a/src/gr/ebs/gss/server/domain/dto/StatsDTO.java b/src/gr/ebs/gss/server/domain/dto/StatsDTO.java index f7a649a..397b2b5 100644 --- a/src/gr/ebs/gss/server/domain/dto/StatsDTO.java +++ b/src/gr/ebs/gss/server/domain/dto/StatsDTO.java @@ -33,25 +33,16 @@ public class StatsDTO implements Serializable{ 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; } /** @@ -66,10 +57,10 @@ public class StatsDTO implements Serializable{ /** * 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; } /** @@ -84,10 +75,10 @@ public class StatsDTO implements Serializable{ /** * 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; } /** @@ -102,11 +93,33 @@ public class StatsDTO implements Serializable{ /** * 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"; @@ -127,6 +140,16 @@ public class StatsDTO implements Serializable{ 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("######.#"); @@ -136,5 +159,4 @@ public class StatsDTO implements Serializable{ public long percentOfFreeSpace(){ return quotaLeftSize*100/(fileSize+quotaLeftSize); } - }