|
16 | 16 | * |
17 | 17 | */ |
18 | 18 |
|
19 | | -package com.cloud.network.security; |
20 | | - |
| 19 | +package com.cloud.network.security; |
| 20 | + |
21 | 21 | import javax.persistence.Column; |
22 | 22 | import javax.persistence.Entity; |
23 | 23 | import javax.persistence.GeneratedValue; |
|
29 | 29 | import javax.persistence.Table; |
30 | 30 |
|
31 | 31 | import com.cloud.vm.VirtualMachine.State; |
32 | | - |
33 | | -@Entity |
34 | | -@Table(name=("security_group_vm_map")) |
35 | | -@SecondaryTables({ |
36 | | -@SecondaryTable(name="user_vm", |
37 | | - pkJoinColumns={@PrimaryKeyJoinColumn(name="instance_id", referencedColumnName="id")}), |
38 | | -@SecondaryTable(name="vm_instance", |
39 | | - pkJoinColumns={@PrimaryKeyJoinColumn(name="instance_id", referencedColumnName="id")}), |
40 | | -@SecondaryTable(name="security_group", |
41 | | - pkJoinColumns={@PrimaryKeyJoinColumn(name="security_group_id", referencedColumnName="id")}) |
42 | | - }) |
43 | | -public class SecurityGroupVMMapVO { |
44 | | - @Id |
45 | | - @GeneratedValue(strategy=GenerationType.IDENTITY) |
46 | | - @Column(name="id") |
47 | | - private Long id; |
48 | | - |
49 | | - @Column(name="security_group_id") |
50 | | - private long securityGroupId; |
51 | | - |
52 | | - @Column(name="instance_id") |
| 32 | + |
| 33 | +@Entity |
| 34 | +@Table(name = ("security_group_vm_map")) |
| 35 | +@SecondaryTables({ @SecondaryTable(name = "nics", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "instance_id", referencedColumnName = "instance_id") }), |
| 36 | + @SecondaryTable(name = "vm_instance", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "instance_id", referencedColumnName = "id") }), |
| 37 | + @SecondaryTable(name = "security_group", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "security_group_id", referencedColumnName = "id") }) }) |
| 38 | +public class SecurityGroupVMMapVO { |
| 39 | + @Id |
| 40 | + @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 41 | + @Column(name = "id") |
| 42 | + private Long id; |
| 43 | + |
| 44 | + @Column(name = "security_group_id") |
| 45 | + private long securityGroupId; |
| 46 | + |
| 47 | + @Column(name = "instance_id") |
53 | 48 | private long instanceId; |
54 | | - |
55 | | - @Column(name="guest_ip_address", table="user_vm", insertable=false, updatable=false) |
| 49 | + |
| 50 | + @Column(name = "ip4_address", table = "nics", insertable = false, updatable = false) |
56 | 51 | private String guestIpAddress; |
57 | | - |
58 | | - @Column(name="state", table="vm_instance", insertable=false, updatable=false) |
| 52 | + |
| 53 | + @Column(name = "state", table = "vm_instance", insertable = false, updatable = false) |
59 | 54 | private State vmState; |
60 | | - |
61 | | - @Column(name="name", table="security_group", insertable=false, updatable=false) |
62 | | - private String groupName; |
63 | | - |
64 | | - public SecurityGroupVMMapVO() { } |
65 | | - |
66 | | - public SecurityGroupVMMapVO(long securityGroupId, long instanceId) { |
67 | | - this.securityGroupId = securityGroupId; |
68 | | - this.instanceId = instanceId; |
69 | | - } |
70 | | - |
71 | | - public Long getId() { |
72 | | - return id; |
73 | | - } |
74 | | - |
75 | | - public long getSecurityGroupId() { |
76 | | - return securityGroupId; |
77 | | - } |
78 | | - |
79 | | - public String getGuestIpAddress() { |
80 | | - return guestIpAddress; |
81 | | - } |
82 | | - |
83 | | - public long getInstanceId() { |
84 | | - return instanceId; |
| 55 | + |
| 56 | + @Column(name = "name", table = "security_group", insertable = false, updatable = false) |
| 57 | + private String groupName; |
| 58 | + |
| 59 | + public SecurityGroupVMMapVO() { |
| 60 | + } |
| 61 | + |
| 62 | + public SecurityGroupVMMapVO(long securityGroupId, long instanceId) { |
| 63 | + this.securityGroupId = securityGroupId; |
| 64 | + this.instanceId = instanceId; |
85 | 65 | } |
86 | 66 |
|
87 | | - public State getVmState() { |
88 | | - return vmState; |
89 | | - } |
| 67 | + public Long getId() { |
| 68 | + return id; |
| 69 | + } |
| 70 | + |
| 71 | + public long getSecurityGroupId() { |
| 72 | + return securityGroupId; |
| 73 | + } |
| 74 | + |
| 75 | + public String getGuestIpAddress() { |
| 76 | + return guestIpAddress; |
| 77 | + } |
90 | 78 |
|
91 | | - public String getGroupName() { |
92 | | - return groupName; |
93 | | - } |
94 | | -} |
| 79 | + public long getInstanceId() { |
| 80 | + return instanceId; |
| 81 | + } |
| 82 | + |
| 83 | + public State getVmState() { |
| 84 | + return vmState; |
| 85 | + } |
| 86 | + |
| 87 | + public String getGroupName() { |
| 88 | + return groupName; |
| 89 | + } |
| 90 | +} |
0 commit comments