@Override @DB public boolean releaseAccountSpecificVirtualRanges(final long accountId) { final List<AccountVlanMapVO> maps = _accountVlanMapDao.listAccountVlanMapsByAccount(accountId); if (maps != null && !maps.isEmpty()) { try { Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(final TransactionStatus status) { for (final AccountVlanMapVO map : maps) { if (!releasePublicIpRange(map.getVlanDbId(), _accountMgr.getSystemUser().getId(), _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM))) { throw new CloudRuntimeException("Failed to release account specific virtual ip ranges for account id=" + accountId); } } } }); } catch (final CloudRuntimeException e) { s_logger.error(e); return false; } } else { s_logger.trace("Account id=" + accountId + " has no account specific virtual ip ranges, nothing to release"); } return true; }
public static Long getAccountIdForVlan(long vlanDbId) { List<AccountVlanMapVO> accountVlanMaps = s_accountVlanMapDao.listAccountVlanMapsByVlan(vlanDbId); if (accountVlanMaps.isEmpty()) { return null; } else { return accountVlanMaps.get(0).getAccountId(); } }
AccountVlanMapSearch = _accountVlanMapDao.createSearchBuilder(); AccountVlanMapSearch.and("accountId", AccountVlanMapSearch.entity().getAccountId(), SearchCriteria.Op.NULL); ZoneWideNonDedicatedVlanSearch.join("AccountVlanMapSearch", AccountVlanMapSearch, ZoneWideNonDedicatedVlanSearch.entity().getId(), AccountVlanMapSearch.entity() AccountVlanMapSearch = _accountVlanMapDao.createSearchBuilder(); AccountVlanMapSearch.and("accountId", AccountVlanMapSearch.entity().getAccountId(), SearchCriteria.Op.EQ); DedicatedVlanSearch.join("AccountVlanMapSearch", AccountVlanMapSearch, DedicatedVlanSearch.entity().getId(), AccountVlanMapSearch.entity().getVlanDbId(),
final List<AccountVlanMapVO> acctVln = _accountVlanMapDao.listAccountVlanMapsByVlan(vlanDbId); if (isAccountSpecific && _accountVlanMapDao.remove(acctVln.get(0).getId())) {
final List<AccountVlanMapVO> maps = _accountVlanMapDao.listAccountVlanMapsByVlan(vlanDbId); if (maps != null && !maps.isEmpty()) { throw new InvalidParameterValueException("Specified Public IP range has already been dedicated"); _accountVlanMapDao.persist(accountVlanMapVO);
_accountVlanMapDao.persist(accountVlanMapVO);
final SearchBuilder<AccountVlanMapVO> accountVlanMapSearch = _accountVlanMapDao.createSearchBuilder(); accountVlanMapSearch.and("accountId", accountVlanMapSearch.entity().getAccountId(), SearchCriteria.Op.EQ); sb.join("accountVlanMapSearch", accountVlanMapSearch, sb.entity().getId(), accountVlanMapSearch.entity().getVlanDbId(), JoinBuilder.JoinType.INNER);
@Override public List<VlanVO> listVlansForAccountByType(Long zoneId, long accountId, VlanType vlanType) { //FIXME: use a join statement to improve the performance (should be minor since we expect only one or two) List<AccountVlanMapVO> vlanMaps = _accountVlanMapDao.listAccountVlanMapsByAccount(accountId); List<VlanVO> result = new ArrayList<VlanVO>(); for (AccountVlanMapVO acvmvo : vlanMaps) { VlanVO vlan = findById(acvmvo.getVlanDbId()); if (vlan.getVlanType() == vlanType && (zoneId == null || vlan.getDataCenterId() == zoneId)) { result.add(vlan); } } return result; }
private boolean isIpDedicated(IPAddressVO addr) { List<AccountVlanMapVO> maps = _accountVlanMapDao.listAccountVlanMapsByVlan(addr.getVlanId()); if (maps != null && !maps.isEmpty()) return true; return false; }
List<AccountVlanMapVO> maps = _accountVlanMapDao.listAccountVlanMapsByAccount(owner.getId()); for (AccountVlanMapVO map : maps) { if (vlanDbIds == null || vlanDbIds.contains(map.getVlanDbId()))
@Override public Account getVlanAccount(final long vlanId) { final Vlan vlan = _vlanDao.findById(vlanId); // if vlan is Virtual Account specific, get vlan information from the // accountVlanMap; otherwise get account information // from the network if (vlan.getVlanType() == VlanType.VirtualNetwork) { final List<AccountVlanMapVO> maps = _accountVlanMapDao.listAccountVlanMapsByVlan(vlanId); if (maps != null && !maps.isEmpty()) { return _accountMgr.getAccount(maps.get(0).getAccountId()); } } return null; }
final List<AccountVlanMapVO> acctVln = _accountVlanMapDao.listAccountVlanMapsByVlan(vlanRange.getId());