blob: 529d1cfb5fe86cab38ff18603bf60899b4edf9bd [file] [log] [blame]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.dc;
import com.cloud.bgp.ASNumber;
import com.cloud.utils.db.GenericDao;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;
import java.util.UUID;
@Entity
@Table(name = "as_number")
public class ASNumberVO implements ASNumber {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(name = "uuid")
private String uuid;
@Column(name = "account_id")
private Long accountId;
@Column(name = "domain_id")
private Long domainId;
@Column(name = "as_number")
private long asNumber;
@Column(name = "as_number_range_id")
private long asNumberRangeId;
@Column(name = "data_center_id")
private long dataCenterId;
@Column(name = "allocated")
@Temporal(value = TemporalType.TIMESTAMP)
private Date allocatedTime;
@Column(name = "is_allocated")
private boolean allocated;
@Column(name = "network_id")
private Long networkId;
@Column(name = "vpc_id")
private Long vpcId;
@Column(name = GenericDao.REMOVED_COLUMN)
private Date removed;
@Column(name = GenericDao.CREATED_COLUMN)
private Date created;
public ASNumberVO() {
this.uuid = UUID.randomUUID().toString();
this.created = new Date();
}
public ASNumberVO(long asNumber, long asNumberRangeId, long dataCenterId) {
this();
this.asNumber = asNumber;
this.asNumberRangeId = asNumberRangeId;
this.dataCenterId = dataCenterId;
}
@Override
public long getId() {
return id;
}
@Override
public String getUuid() {
return uuid;
}
public void setAccountId(Long accountId) {
this.accountId = accountId;
}
@Override
public Long getAccountId() {
return accountId;
}
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
@Override
public Long getDomainId() {
return domainId;
}
@Override
public long getAsNumber() {
return asNumber;
}
@Override
public long getAsNumberRangeId() {
return asNumberRangeId;
}
@Override
public long getDataCenterId() {
return dataCenterId;
}
public void setAllocatedTime(Date date) {
this.allocatedTime = date;
}
@Override
public Date getAllocatedTime() {
return allocatedTime;
}
public void setAllocated(boolean allocated) {
this.allocated = allocated;
}
@Override
public boolean isAllocated() {
return allocated;
}
public void setNetworkId(Long networkId) {
this.networkId = networkId;
}
@Override
public Long getNetworkId() {
return networkId;
}
@Override
public Date getRemoved() {
return removed;
}
@Override
public Date getCreated() {
return created;
}
public Long getVpcId() {
return vpcId;
}
public void setVpcId(Long vpcId) {
this.vpcId = vpcId;
}
}