Пример #1
0
  @Override
  public boolean mark(long dcId, Ip ip) {
    SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
    sc.setParameters("dataCenterId", dcId);
    sc.setParameters("ipAddress", ip);

    IPAddressVO vo = createForUpdate();
    vo.setAllocatedTime(new Date());
    vo.setState(State.Allocated);

    return update(vo, sc) >= 1;
  }
 @Override
 public void unassignIpAddress(long ipAddressId) {
   IPAddressVO address = createForUpdate();
   address.setAllocatedToAccountId(null);
   address.setAllocatedInDomainId(null);
   address.setAllocatedTime(null);
   address.setSourceNat(false);
   address.setOneToOneNat(false);
   address.setAssociatedWithVmId(null);
   address.setState(State.Free);
   address.setAssociatedWithNetworkId(null);
   address.setVpcId(null);
   address.setSystem(false);
   update(ipAddressId, address);
 }