{
// TODO: Include aggregators functionality in bzengine?
Session ses = HibernateEntityManagerHelper.getSession(getEntityManager());
Criteria crit = ses.createCriteria(CloudUsage.class);
ProjectionList proList = Projections.projectionList();
proList.add(Projections.sum(CloudUsage.SERVERS_TOTAL_PROPERTY));
proList.add(Projections.sum(CloudUsage.SERVERS_RUNNING_PROPERTY));
proList.add(Projections.sum(CloudUsage.STORAGE_TOTAL_PROPERTY));
// proList.add(Projections.sum(CloudUsage.STORAGE_RESERVED_PROPERTY));
proList.add(Projections.sum(CloudUsage.STORAGE_USED_PROPERTY));
proList.add(Projections.sum(CloudUsage.PUBLIC_I_PS_TOTAL_PROPERTY));
// proList.add(Projections.sum(CloudUsage.PUBLIC_I_PS_RESERVED_PROPERTY));
proList.add(Projections.sum(CloudUsage.PUBLIC_I_PS_USED_PROPERTY));
proList.add(Projections.sum(CloudUsage.V_MACHINES_TOTAL_PROPERTY));
proList.add(Projections.sum(CloudUsage.V_MACHINES_RUNNING_PROPERTY));
// proList.add(Projections.sum(CloudUsage.V_CPU_TOTAL_PROPERTY));
// proList.add(Projections.sum(CloudUsage.V_CPU_RESERVED_PROPERTY));
proList.add(Projections.sum(CloudUsage.V_CPU_USED_PROPERTY));
// proList.add(Projections.sum(CloudUsage.V_MEMORY_TOTAL_PROPERTY));
// proList.add(Projections.sum(CloudUsage.V_MEMORY_RESERVED_PROPERTY));
proList.add(Projections.sum(CloudUsage.V_MEMORY_USED_PROPERTY));
proList.add(Projections.sum(CloudUsage.V_STORAGE_TOTAL_PROPERTY));
// proList.add(Projections.sum(CloudUsage.V_STORAGE_RESERVED_PROPERTY));
proList.add(Projections.sum(CloudUsage.V_STORAGE_USED_PROPERTY));
proList.add(Projections.sum(CloudUsage.NUM_USERS_CREATED_PROPERTY));
proList.add(Projections.sum(CloudUsage.NUM_VDC_CREATED_PROPERTY));
proList.add(Projections.sum(CloudUsage.NUM_ENTERPRISES_CREATED_PROPERTY));
crit.setProjection(proList);
Object[] obj = (Object[]) crit.uniqueResult(); // Returns Object[] ->
CloudUsage result = new CloudUsage();