iCLOUDSTACK-8592: adding accountid and domainid to quota statement

This commit is contained in:
Abhinandan Prateek 2015-07-14 14:32:39 +05:30
parent 82d9a6ac76
commit 47ffa60f9e
2 changed files with 53 additions and 14 deletions

View File

@ -31,6 +31,22 @@ public class QuotaStatementResponse extends BaseResponse {
@Param(description = "usage type")
private int usageType;
@SerializedName("accountid")
@Param(description = "account id")
private Long accountId;
@SerializedName("account")
@Param(description = "account name")
private String accountName;
@SerializedName("domain")
@Param(description = "domain id")
private Long domainId;
@SerializedName("name")
@Param(description = "usage type name")
private String usageName;
@SerializedName("unit")
@Param(description = "usage unit")
private String usageUnit;
@ -47,60 +63,80 @@ public class QuotaStatementResponse extends BaseResponse {
@Param(description = "end date")
private Date endDate = null;
public QuotaStatementResponse() {
super();
}
public Long getAccountId() {
return accountId;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public Long getDomainId() {
return domainId;
}
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
public String getUsageName() {
return usageName;
}
public void setUsageName(String usageName) {
this.usageName = usageName;
}
public int getUsageType() {
return usageType;
}
public void setUsageType(int usageType) {
this.usageType = usageType;
}
public String getUsageUnit() {
return usageUnit;
}
public void setUsageUnit(String usageUnit) {
this.usageUnit = usageUnit;
}
public BigDecimal getQuotaUsed() {
return quotaUsed;
}
public void setQuotaUsed(BigDecimal quotaUsed) {
this.quotaUsed = quotaUsed;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
}

View File

@ -83,10 +83,10 @@ public class QuotaDBUtilsImpl implements QuotaDBUtils {
}
});
HashMap<Integer, String> map = new HashMap<Integer, String>();
HashMap<Integer, QuotaMappingVO> map = new HashMap<Integer, QuotaMappingVO>();
List<QuotaMappingVO> result = _quotaMappingDao.listAll();
for (QuotaMappingVO mapping : result) {
map.put(mapping.getUsageType(), mapping.getUsageUnit());
map.put(mapping.getUsageType(), mapping);
}
List<QuotaStatementResponse> statement = new ArrayList<QuotaStatementResponse>();
@ -99,7 +99,10 @@ public class QuotaDBUtilsImpl implements QuotaDBUtils {
lineitem = new QuotaStatementResponse();
lineitem.setUsageType(type);
lineitem.setQuotaUsed(totalUsage);
lineitem.setUsageUnit(map.get(type));
lineitem.setAccountId(quotaRecord.getAccountId());
lineitem.setDomainId(quotaRecord.getDomainId());
lineitem.setUsageUnit(map.get(type).getUsageUnit());
lineitem.setUsageName(map.get(type).getUsageName());
statement.add(lineitem);
totalUsage = new BigDecimal(0);
}