Revision 4b7cdff8 web_client/src/gr/grnet/pithos/web/client/foldertree/AccountResource.java

b/web_client/src/gr/grnet/pithos/web/client/foldertree/AccountResource.java
64 64

  
65 65
    private long bytesUsed = 0;
66 66

  
67
    private long bytesRemaining = 0;
67
    private long quota = 0;
68 68

  
69 69
    private Date lastLogin = null;
70 70

  
......
76 76

  
77 77
    private List<Group> groups = new ArrayList<Group>();
78 78

  
79
    public long getBytesRemaining() {
80
        return bytesRemaining;
79
    public long getQuota() {
80
        return quota;
81 81
    }
82 82

  
83
    public void setBytesRemaining(long bytesRemaining) {
84
        this.bytesRemaining = bytesRemaining;
83
    public void setQuota(long quota) {
84
        this.quota = quota;
85 85
    }
86 86

  
87 87
    public long getBytesUsed() {
......
159 159
		        else if (name.equals("X-Account-Bytes-Used")) {
160 160
		            bytesUsed = Long.valueOf(h.getValue());
161 161
		        }
162
		        else if (name.equals("X-Account-Bytes-Remaining")) {
163
		            bytesRemaining = Long.valueOf(h.getValue());
162
		        else if (name.equals("X-Account-Policy-Quota")) {
163
		            quota = Long.valueOf(h.getValue());
164 164
		        }
165 165
		        else if (name.equals("X-Account-Last-Login")) {
166 166
		            lastLogin = df.parse(h.getValue());
......
214 214
    }
215 215

  
216 216
    public String getQuotaAsString() {
217
    	long quota = bytesUsed + bytesRemaining;
218 217
        if (quota < 1024)
219 218
            return String.valueOf(quota) + "B";
220 219
        else if (quota < 1024 * 1024)
......
259 258
	}
260 259

  
261 260
	public double getUsedPercentage() {
262
		return ((double) bytesUsed) / (bytesUsed + bytesRemaining);
261
		if (quota == 0)
262
			return 0;
263
		return ((double) bytesUsed) / quota;
263 264
	}
264 265

  
265 266
	public Folder getPithos() {

Also available in: Unified diff