prePersist: count=0
This commit is contained in:
parent
c944ee2be7
commit
9c74f4ae76
|
@ -4,6 +4,8 @@ import com.loafle.overflow.model.domain.Domain;
|
|||
import com.loafle.overflow.model.member.Member;
|
||||
import com.loafle.overflow.model.meta.MetaProbeStatus;
|
||||
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -25,8 +27,7 @@ public class Probe {
|
|||
private String cidr;
|
||||
private Date authorizeDate;
|
||||
private Member authorizeMember;
|
||||
private int targetCount = 0;
|
||||
|
||||
private int targetCount;
|
||||
|
||||
public Probe() {
|
||||
|
||||
|
@ -37,7 +38,7 @@ public class Probe {
|
|||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -56,7 +57,6 @@ public class Probe {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "DESCRIPTION", nullable = true, length = 50)
|
||||
public String getDescription() {
|
||||
return description;
|
||||
|
@ -86,7 +86,6 @@ public class Probe {
|
|||
this.domain = domain;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "PROBE_KEY", nullable = false, unique = true)
|
||||
public String getProbeKey() {
|
||||
return probeKey;
|
||||
|
@ -96,7 +95,6 @@ public class Probe {
|
|||
this.probeKey = probeKey;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "ENCRYPTION_KEY", nullable = false, length = 100, unique = true)
|
||||
public String getEncryptionKey() {
|
||||
return encryptionKey;
|
||||
|
@ -144,14 +142,18 @@ public class Probe {
|
|||
this.authorizeMember = authorizeMember;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "TARGET_COUNT", nullable = false)
|
||||
public int getTargetCount() {
|
||||
return targetCount;
|
||||
}
|
||||
public int getTargetCount() {
|
||||
return targetCount;
|
||||
}
|
||||
|
||||
public void setTargetCount(int targetCount) {
|
||||
this.targetCount = targetCount;
|
||||
public void setTargetCount(int targetCount) {
|
||||
this.targetCount = targetCount;
|
||||
}
|
||||
|
||||
@PrePersist
|
||||
void preInsert() {
|
||||
this.targetCount = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -115,8 +115,12 @@ public class Sensor {
|
|||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PrePersist
|
||||
void preInsert() {
|
||||
this.itemCount = 0;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public List<MetaSensorDisplayItem> getSensorItems() {
|
||||
|
|
|
@ -18,7 +18,7 @@ public class Target {
|
|||
private Date createDate;
|
||||
private String displayName;
|
||||
private String description;
|
||||
private int sensorCount = 0;
|
||||
private int sensorCount;
|
||||
|
||||
// Transient property
|
||||
private List<Sensor> sensors;
|
||||
|
@ -79,7 +79,12 @@ public class Target {
|
|||
|
||||
public void setSensors(List<Sensor> sensors) {
|
||||
this.sensors = sensors;
|
||||
}
|
||||
}
|
||||
|
||||
@PrePersist
|
||||
void preInsert() {
|
||||
this.sensorCount = 0;
|
||||
}
|
||||
|
||||
|
||||
// @ManyToOne
|
||||
|
|
Loading…
Reference in New Issue
Block a user