@Override public List<ConsoleProxyLoadInfo> getDatacenterProxyLoadMatrix() { return getDatacenterLoadMatrix(DATACENTER_PROXY_MATRIX); }
@Override public boolean remove(Long id) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); ConsoleProxyVO proxy = createForUpdate(); proxy.setPublicIpAddress(null); proxy.setPrivateIpAddress(null); UpdateBuilder ub = getUpdateBuilder(proxy); ub.set(proxy, "state", State.Destroyed); ub.set(proxy, "privateIpAddress", null); update(id, ub, proxy); boolean result = super.remove(id); txn.commit(); return result; }
@Override public void update(long id, int activeSession, Date updateTime, byte[] sessionDetails) { ConsoleProxyVO ub = createForUpdate(); ub.setActiveSession(activeSession); ub.setLastUpdateTime(updateTime); ub.setSessionDetails(sessionDetails); update(id, ub); }
@Override public List<ConsoleProxyVO> getProxyListInStates(State... states) { SearchCriteria<ConsoleProxyVO> sc = StateSearch.create(); sc.setParameters("states", (Object[])states); return listBy(sc); }
public ConsoleProxyDaoImpl() { DataCenterStatusSearch = createSearchBuilder(); DataCenterStatusSearch.and("dc", DataCenterStatusSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); DataCenterStatusSearch.and("states", DataCenterStatusSearch.entity().getState(), SearchCriteria.Op.IN); DataCenterStatusSearch.done(); StateSearch = createSearchBuilder(); StateSearch.and("states", StateSearch.entity().getState(), SearchCriteria.Op.IN); StateSearch.done(); HostSearch = createSearchBuilder(); HostSearch.and("host", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ); HostSearch.done(); LastHostSearch = createSearchBuilder(); LastHostSearch.and("lastHost", LastHostSearch.entity().getLastHostId(), SearchCriteria.Op.EQ); LastHostSearch.and("state", LastHostSearch.entity().getState(), SearchCriteria.Op.EQ); LastHostSearch.done(); HostUpSearch = createSearchBuilder(); HostUpSearch.and("host", HostUpSearch.entity().getHostId(), SearchCriteria.Op.EQ); HostUpSearch.and("states", HostUpSearch.entity().getState(), SearchCriteria.Op.NIN); HostUpSearch.done(); StateChangeSearch = createSearchBuilder(); StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ); StateChangeSearch.and("states", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ); StateChangeSearch.and("host", StateChangeSearch.entity().getHostId(), SearchCriteria.Op.EQ); StateChangeSearch.and("update", StateChangeSearch.entity().getUpdated(), SearchCriteria.Op.EQ); StateChangeSearch.done(); _updateTimeAttr = _allAttributes.get("updateTime"); assert _updateTimeAttr != null : "Couldn't get this updateTime attribute"; }
@Override public List<ConsoleProxyVO> listByHostId(long hostId) { SearchCriteria<ConsoleProxyVO> sc = HostSearch.create(); sc.setParameters("host", hostId); return listBy(sc); }
@Override public List<ConsoleProxyVO> listUpByHostId(long hostId) { SearchCriteria<ConsoleProxyVO> sc = HostUpSearch.create(); sc.setParameters("host", hostId); sc.setParameters("states", new Object[] {State.Destroyed, State.Stopped, State.Expunging}); return listBy(sc); }
@Override public List<ConsoleProxyLoadInfo> getDatacenterSessionLoadMatrix() { return getDatacenterLoadMatrix(DATACENTER_ACTIVE_SESSION_MATRIX); }
@Override public List<ConsoleProxyVO> getProxyListInStates(long dataCenterId, State... states) { SearchCriteria<ConsoleProxyVO> sc = DataCenterStatusSearch.create(); sc.setParameters("states", (Object[])states); sc.setParameters("dc", dataCenterId); return listBy(sc); }
@Override public List<ConsoleProxyLoadInfo> getDatacenterVMLoadMatrix() { return getDatacenterLoadMatrix(DATACENTER_VM_MATRIX); }
@Override public List<ConsoleProxyVO> listByLastHostId(long hostId) { SearchCriteria<ConsoleProxyVO> sc = LastHostSearch.create(); sc.setParameters("lastHost", hostId); sc.setParameters("state", State.Stopped); return listBy(sc); } }