BigInteger vlan =
(BigInteger) getSession().createSQLQuery(COUNT_VLAN_RESOURCES)
.setParameter("datacenterId", datacenterId)
.setParameter("enterpriseId", enterpriseId).uniqueResult();
DefaultEntityCurrentUsed used = new DefaultEntityCurrentUsed(cpu.intValue(), ram, hdTot);
// Storage usage is stored in MB
used.setStorage(storage == null ? 0 : storage.longValue() * 1024 * 1024);
used.setPublicIp(publicIps == null ? 0 : publicIps.longValue());
used.setVlanCount(vlan == null ? 0 : vlan.longValue());
return used;
}