This commit is contained in:
crusader 2018-06-15 12:16:24 +09:00
parent b08d513524
commit 1afea3de2f
8 changed files with 29 additions and 53 deletions

View File

@ -13,7 +13,7 @@
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<packaging>jar</packaging>
<version>1.0.71-SNAPSHOT</version>
<version>1.0.72-SNAPSHOT</version>
<name>com.loafle.overflow.commons-java</name>
<properties>

View File

@ -6,6 +6,10 @@ import javax.persistence.*;
import com.loafle.overflow.model.meta.MetaTargetHostType;
import org.codehaus.jackson.annotate.JsonBackReference;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
/**
* Created by root on 17. 6. 22.
*/
@ -18,8 +22,11 @@ public class InfraHost extends Infra {
private InfraHostMachine infraHostMachine;
private InfraHostOS infraHostOS;
@JsonBackReference
private List<InfraHostIP> infraHostIPs;
private List<InfraHostPort> infraHostPorts;
private InfraHost containerInfraHost;
public InfraHost() {
super();
@ -30,7 +37,7 @@ public class InfraHost extends Infra {
}
@ManyToOne
@JoinColumn(name = "INFRA_ZONE_ID", nullable = true)
@JoinColumn(name = "INFRA_ZONE_ID", nullable = false)
public InfraZone getInfraZone() {
return infraZone;
}
@ -85,7 +92,7 @@ public class InfraHost extends Infra {
* @return the infraHostIPs
*/
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "infraHost")
@OrderColumn(name = "ID")
@Fetch(FetchMode.SELECT)
public List<InfraHostIP> getInfraHostIPs() {
return infraHostIPs;
}
@ -98,18 +105,19 @@ public class InfraHost extends Infra {
}
/**
* @return the infraHostPorts
* @return the containerInfraHost
*/
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "infraHost")
@OrderColumn(name = "PORT")
public List<InfraHostPort> getInfraHostPorts() {
return infraHostPorts;
@ManyToOne
@JoinColumn(name = "CONTAINER_INFRA_HOST_ID", nullable = true)
public InfraHost getContainerInfraHost() {
return containerInfraHost;
}
/**
* @param infraHostPorts the infraHostPorts to set
* @param containerInfraHost the containerInfraHost to set
*/
public void setInfraHostPorts(List<InfraHostPort> infraHostPorts) {
this.infraHostPorts = infraHostPorts;
public void setContainerInfraHost(InfraHost containerInfraHost) {
this.containerInfraHost = containerInfraHost;
}
}

View File

@ -4,6 +4,8 @@ import javax.persistence.*;
import com.loafle.overflow.model.meta.MetaIPType;
import org.codehaus.jackson.annotate.JsonManagedReference;
import java.util.Date;
/**
@ -13,6 +15,7 @@ import java.util.Date;
@Table(name = "INFRA_HOST_IP", schema = "public")
public class InfraHostIP {
private Long id;
@JsonManagedReference
private InfraHost infraHost;
private MetaIPType metaIPType;
private String address;

View File

@ -11,7 +11,6 @@ import java.util.Date;
@Table(name = "INFRA_HOST_MACHINE", schema = "public")
public class InfraHostMachine {
private Long id;
private InfraHost infraHost;
private String meta;
private Date createDate;
@ -25,16 +24,6 @@ public class InfraHostMachine {
this.id = id;
}
@OneToOne
@JoinColumn(name = "INFRA_HOST_ID", nullable = false)
public InfraHost getInfraHost() {
return infraHost;
}
public void setInfraHost(InfraHost infraHost) {
this.infraHost = infraHost;
}
@Basic
@Column(name = "META", nullable = true, length = 2000)
public String getMeta() {
@ -45,7 +34,6 @@ public class InfraHostMachine {
this.meta = meta;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Date getCreateDate() {

View File

@ -11,7 +11,6 @@ import java.util.Date;
@Table(name = "INFRA_HOST_OS", schema = "public")
public class InfraHostOS {
private Long id;
private InfraHost infraHost;
private String name;
private String os;
private String platform;
@ -32,16 +31,6 @@ public class InfraHostOS {
this.id = id;
}
@OneToOne
@JoinColumn(name = "INFRA_HOST_ID", nullable = false)
public InfraHost getInfraHost() {
return infraHost;
}
public void setInfraHost(InfraHost infraHost) {
this.infraHost = infraHost;
}
/**
* @return the name
*/

View File

@ -13,7 +13,7 @@ import java.util.Date;
@Table(name = "INFRA_HOST_PORT", schema = "public")
public class InfraHostPort {
private Long id;
private InfraHost infraHost;
private InfraHostIP infraHostIP;
private MetaPortType metaPortType;
private Integer port;
private Date createDate;
@ -29,13 +29,13 @@ public class InfraHostPort {
}
@ManyToOne
@JoinColumn(name = "INFRA_HOST_ID", nullable = false)
public InfraHost getInfraHost() {
return infraHost;
@JoinColumn(name = "INFRA_HOST_IP_ID", nullable = false)
public InfraHostIP getInfraHostIP() {
return infraHostIP;
}
public void setInfraHost(InfraHost infraHost) {
this.infraHost = infraHost;
public void setInfraHostIP(InfraHostIP infraHostIP) {
this.infraHostIP = infraHostIP;
}
@ManyToOne

View File

@ -14,7 +14,6 @@ import com.loafle.overflow.model.meta.MetaTargetServiceType;
public class InfraService extends Infra {
private MetaTargetServiceType metaTargetServiceType;
private InfraHostIP infraHostIP;
private InfraHostPort infraHostPort;
private MetaCryptoType metaCryptoType;
@ -36,16 +35,6 @@ public class InfraService extends Infra {
this.metaTargetServiceType = metaTargetServiceType;
}
@ManyToOne
@JoinColumn(name = "INFRA_HOST_IP_ID", nullable = true)
public InfraHostIP getInfraHostIP() {
return infraHostIP;
}
public void setInfraHostIP(InfraHostIP infraHostIP) {
this.infraHostIP = infraHostIP;
}
@OneToOne
@JoinColumn(name = "INFRA_HOST_PORT_ID", nullable = true)
public InfraHostPort getInfraHostPort() {

View File

@ -38,7 +38,6 @@ public class InfraZone extends Infra {
this.metaTargetZoneType = metaTargetZoneType;
}
@Basic
@Column(name = "NETWORK", nullable = true)
public String getNetwork() {