some model property changed

This commit is contained in:
insanity 2018-04-27 13:36:27 +09:00
parent becee0d2a4
commit ec87d642ec
3 changed files with 57 additions and 25 deletions

View File

@ -25,7 +25,7 @@ public class Probe {
private String cidr; private String cidr;
private Date authorizeDate; private Date authorizeDate;
private Member authorizeMember; private Member authorizeMember;
// private int targetCount = 0; private int targetCount = 0;
public Probe() { public Probe() {
@ -145,15 +145,13 @@ public class Probe {
} }
// @Column(name = "TARGET_COUNT", nullable = false) @Column(name = "TARGET_COUNT", nullable = false)
// public int getTargetCount() { public int getTargetCount() {
// return targetCount; return targetCount;
// } }
// public void setTargetCount(int targetCount) {
// this.targetCount = targetCount;
// }
public void setTargetCount(int targetCount) {
this.targetCount = targetCount;
}
} }

View File

@ -1,6 +1,7 @@
package com.loafle.overflow.model.sensor; package com.loafle.overflow.model.sensor;
import com.loafle.overflow.model.meta.MetaCrawler; import com.loafle.overflow.model.meta.MetaCrawler;
import com.loafle.overflow.model.meta.MetaSensorDisplayItem;
import com.loafle.overflow.model.meta.MetaSensorStatus; import com.loafle.overflow.model.meta.MetaSensorStatus;
import com.loafle.overflow.model.target.Target; import com.loafle.overflow.model.target.Target;
import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDelete;
@ -8,6 +9,7 @@ import org.hibernate.annotations.OnDeleteAction;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* Created by root on 17. 6. 22. * Created by root on 17. 6. 22.
@ -23,6 +25,10 @@ public class Sensor {
private MetaCrawler crawler; private MetaCrawler crawler;
private String crawlerInputItems; private String crawlerInputItems;
private short itemCount = 0; private short itemCount = 0;
private String displayName;
// Transient property
private List<MetaSensorDisplayItem> sensorItems;
@Id @Id
@GeneratedValue(strategy= GenerationType.IDENTITY) @GeneratedValue(strategy= GenerationType.IDENTITY)
@ -102,5 +108,24 @@ public class Sensor {
this.itemCount = itemCount; this.itemCount = itemCount;
} }
@Column(name = "DISPLAY_NAME", nullable = false, length = 50)
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
@Transient
public List<MetaSensorDisplayItem> getSensorItems() {
return sensorItems;
}
public void setSensorItems(List<MetaSensorDisplayItem> sensorItems) {
this.sensorItems = sensorItems;
}
} }

View File

@ -1,8 +1,9 @@
package com.loafle.overflow.model.target; package com.loafle.overflow.model.target;
import javax.persistence.*;
import com.loafle.overflow.model.sensor.Sensor; import com.loafle.overflow.model.sensor.Sensor;
import javax.persistence.*;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -17,14 +18,11 @@ public class Target {
private Date createDate; private Date createDate;
private String displayName; private String displayName;
private String description; private String description;
private int sensorCount = 0;
// Transient property
private List<Sensor> sensors; private List<Sensor> sensors;
/*
private long id;
private Date createDate;
private String displayName;
private String description;
*/
@Id @Id
@GeneratedValue(strategy= GenerationType.IDENTITY) @GeneratedValue(strategy= GenerationType.IDENTITY)
@ -65,6 +63,25 @@ public class Target {
} }
@Column(name = "SENSOR_COUNT", nullable = false)
public int getSensorCount() {
return sensorCount;
}
public void setSensorCount(int sensorCount) {
this.sensorCount = sensorCount;
}
@Transient
public List<Sensor> getSensors() {
return sensors;
}
public void setSensors(List<Sensor> sensors) {
this.sensors = sensors;
}
// @ManyToOne // @ManyToOne
// @JoinColumn(name = "PROBE_ID", nullable = false) // @JoinColumn(name = "PROBE_ID", nullable = false)
// @OnDelete(action = OnDeleteAction.CASCADE) // @OnDelete(action = OnDeleteAction.CASCADE)
@ -86,13 +103,5 @@ public class Target {
// this.infra = infra; // this.infra = infra;
// } // }
@Transient
public List<Sensor> getSensors() {
return sensors;
}
public void setSensors(List<Sensor> sensors) {
this.sensors = sensors;
}
} }