|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | +package com.cloud.vm.dao; |
| 18 | + |
| 19 | +import java.util.Date; |
| 20 | +import java.util.UUID; |
| 21 | + |
| 22 | +import javax.persistence.Column; |
| 23 | +import javax.persistence.Entity; |
| 24 | +import javax.persistence.GeneratedValue; |
| 25 | +import javax.persistence.GenerationType; |
| 26 | +import javax.persistence.Id; |
| 27 | +import javax.persistence.Table; |
| 28 | + |
| 29 | +import org.apache.cloudstack.api.Identity; |
| 30 | +import org.apache.cloudstack.api.InternalIdentity; |
| 31 | +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; |
| 32 | + |
| 33 | +import com.cloud.utils.db.GenericDao; |
| 34 | + |
| 35 | +@Entity |
| 36 | +@Table(name = "nic_network_map") |
| 37 | +public class NicNetworkMapVO implements Identity, InternalIdentity { |
| 38 | + |
| 39 | + @Id |
| 40 | + @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 41 | + @Column(name = "id") |
| 42 | + private long id; |
| 43 | + |
| 44 | + @Column(name = "uuid") |
| 45 | + private String uuid = UUID.randomUUID().toString(); |
| 46 | + |
| 47 | + @Column(name = "nic_id") |
| 48 | + private long nicId; |
| 49 | + |
| 50 | + @Column(name = "network_id") |
| 51 | + private long networkId; |
| 52 | + |
| 53 | + @Column(name = "ip4_address") |
| 54 | + private String ip4Address; |
| 55 | + |
| 56 | + @Column(name = "ip6_address") |
| 57 | + private String ip6Address; |
| 58 | + |
| 59 | + @Column(name = GenericDao.CREATED_COLUMN) |
| 60 | + private Date created; |
| 61 | + |
| 62 | + @Column(name = GenericDao.REMOVED_COLUMN) |
| 63 | + private Date removed; |
| 64 | + |
| 65 | + protected NicNetworkMapVO() { |
| 66 | + } |
| 67 | + |
| 68 | + public NicNetworkMapVO(long nicId, long networkId) { |
| 69 | + this.nicId = nicId; |
| 70 | + this.networkId = networkId; |
| 71 | + } |
| 72 | + |
| 73 | + public NicNetworkMapVO(long nicId, long networkId, String ip4Address, String ip6Address) { |
| 74 | + this.nicId = nicId; |
| 75 | + this.networkId = networkId; |
| 76 | + this.ip4Address = ip4Address; |
| 77 | + this.ip6Address = ip6Address; |
| 78 | + } |
| 79 | + |
| 80 | + @Override |
| 81 | + public long getId() { |
| 82 | + return id; |
| 83 | + } |
| 84 | + |
| 85 | + @Override |
| 86 | + public String getUuid() { |
| 87 | + return uuid; |
| 88 | + } |
| 89 | + |
| 90 | + public void setUuid(String uuid) { |
| 91 | + this.uuid = uuid; |
| 92 | + } |
| 93 | + |
| 94 | + public long getNicId() { |
| 95 | + return nicId; |
| 96 | + } |
| 97 | + |
| 98 | + public void setNicId(long nicId) { |
| 99 | + this.nicId = nicId; |
| 100 | + } |
| 101 | + |
| 102 | + public long getNetworkId() { |
| 103 | + return networkId; |
| 104 | + } |
| 105 | + |
| 106 | + public void setNetworkId(long networkId) { |
| 107 | + this.networkId = networkId; |
| 108 | + } |
| 109 | + |
| 110 | + public String getIp4Address() { |
| 111 | + return ip4Address; |
| 112 | + } |
| 113 | + |
| 114 | + public void setIp4Address(String ip4Address) { |
| 115 | + this.ip4Address = ip4Address; |
| 116 | + } |
| 117 | + |
| 118 | + public String getIp6Address() { |
| 119 | + return ip6Address; |
| 120 | + } |
| 121 | + |
| 122 | + public void setIp6Address(String ip6Address) { |
| 123 | + this.ip6Address = ip6Address; |
| 124 | + } |
| 125 | + |
| 126 | + public Date getCreated() { |
| 127 | + return created; |
| 128 | + } |
| 129 | + |
| 130 | + public Date getRemoved() { |
| 131 | + return removed; |
| 132 | + } |
| 133 | + |
| 134 | + @Override |
| 135 | + public String toString() { |
| 136 | + return String.format("NicNetworkMap %s", |
| 137 | + ReflectionToStringBuilderUtils.reflectOnlySelectedFields( |
| 138 | + this, "id", "uuid", "nicId", "networkId", "ip4Address", "ip6Address")); |
| 139 | + } |
| 140 | +} |
0 commit comments