public static Long getAccountIdForGuestVlan(long vlanDbId) { List<AccountGuestVlanMapVO> accountGuestVlanMaps = s_accountGuestVlanMapDao.listAccountGuestVlanMapsByVlan(vlanDbId); if (accountGuestVlanMaps.isEmpty()) { return null; } else { return accountGuestVlanMaps.get(0).getAccountId(); } }
guestVlanMapAccountId = guestVlanMaps.get(i).getAccountId(); List<Integer> vlanTokens1 = getVlanFromRange(guestVlanMaps.get(i).getGuestVlanRange()); List<Integer> vlanTokens2 = getVlanFromRange(guestVlanMaps.get(i + 1).getGuestVlanRange()); if (endVlan == (vlanTokens2.get(0).intValue() - 1) && guestVlanMaps.get(i + 1).getAccountId() == vlanOwnerId) { _datacneterVnet.releaseDedicatedGuestVlans(guestVlanMaps.get(i + 1).getId()); _accountGuestVlanMapDao.remove(guestVlanMaps.get(i + 1).getId());
public AccountGuestVlanMapDaoImpl() { super(); AccountSearch = createSearchBuilder(); AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ); AccountSearch.done(); GuestVlanSearch = createSearchBuilder(); GuestVlanSearch.and("guestVlanId", GuestVlanSearch.entity().getId(), SearchCriteria.Op.EQ); GuestVlanSearch.done(); PhysicalNetworkSearch = createSearchBuilder(); PhysicalNetworkSearch.and("physicalNetworkId", PhysicalNetworkSearch.entity().getId(), SearchCriteria.Op.EQ); PhysicalNetworkSearch.done(); }
@Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { boolean result = super.configure(name, params); countVnetsDedicatedToAccount = createSearchBuilder(Integer.class); countVnetsDedicatedToAccount.and("dc", countVnetsDedicatedToAccount.entity().getDataCenterId(), SearchCriteria.Op.EQ); countVnetsDedicatedToAccount.and("accountGuestVlanMapId", countVnetsDedicatedToAccount.entity().getAccountGuestVlanMapId(), Op.NNULL); AccountGuestVlanMapSearch = _accountGuestVlanMapDao.createSearchBuilder(); AccountGuestVlanMapSearch.and("accountId", AccountGuestVlanMapSearch.entity().getAccountId(), SearchCriteria.Op.EQ); countVnetsDedicatedToAccount.join("AccountGuestVlanMapSearch", AccountGuestVlanMapSearch, countVnetsDedicatedToAccount.entity().getAccountGuestVlanMapId(), AccountGuestVlanMapSearch.entity().getId(), JoinBuilder.JoinType.INNER); countVnetsDedicatedToAccount.select(null, Func.COUNT, countVnetsDedicatedToAccount.entity().getId()); countVnetsDedicatedToAccount.done(); AccountGuestVlanMapSearch.done(); return result; }
final Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId(); final AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId); if (map.getAccountId() != owner.getAccountId()) { throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account");
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ); sb.and("guestVlanRange", sb.entity().getGuestVlanRange(), SearchCriteria.Op.EQ); sb.and("physicalNetworkId", sb.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);