From f56eb5e612b369c756f369ae6d380bc9ffee099a Mon Sep 17 00:00:00 2001 From: geek Date: Thu, 17 Nov 2016 11:14:20 +0900 Subject: [PATCH] package refacrot --- .../{entity => }/DiscoveryHost.java | 45 ++++++++++--------- .../DiscoveryHostController.java | 2 +- .../DiscoveryHostRepository.java | 4 +- .../{entity => }/PortScanHistory.java | 2 +- .../bridge/discoveryport/DiscoveryPort.java | 2 +- .../DiscoveryHostRepositoryTest.java | 5 ++- 6 files changed, 32 insertions(+), 28 deletions(-) rename src/main/java/com/loafle/bridge/discoveryhost/{entity => }/DiscoveryHost.java (75%) rename src/main/java/com/loafle/bridge/discoveryhost/{controller => }/DiscoveryHostController.java (61%) rename src/main/java/com/loafle/bridge/discoveryhost/{repository => }/DiscoveryHostRepository.java (76%) rename src/main/java/com/loafle/bridge/discoveryhost/{entity => }/PortScanHistory.java (98%) diff --git a/src/main/java/com/loafle/bridge/discoveryhost/entity/DiscoveryHost.java b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java similarity index 75% rename from src/main/java/com/loafle/bridge/discoveryhost/entity/DiscoveryHost.java rename to src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java index d9a6494..ccc24fe 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/entity/DiscoveryHost.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHost.java @@ -1,4 +1,7 @@ -package com.loafle.bridge.discoveryhost.entity; +package com.loafle.bridge.discoveryhost; + +import com.loafle.bridge.discoveryport.DiscoveryPort; +import com.loafle.bridge.discoveryzone.DiscoveryZone; import javax.persistence.*; import java.util.Date; @@ -20,17 +23,17 @@ public class DiscoveryHost { @Column(name = "MAC_ADDRESS",nullable = false) private long macAddress; -// @ManyToOne -// @JoinColumn(name = "ZONE_ID", nullable = false) -// private DiscoveryZone zone; + @ManyToOne + @JoinColumn(name = "ZONE_ID", nullable = false) + private DiscoveryZone zone; -// public DiscoveryZone getZone() { -// return zone; -// } -// -// public void setZone(DiscoveryZone zone) { -// this.zone = zone; -// } + public DiscoveryZone getZone() { + return zone; + } + + public void setZone(DiscoveryZone zone) { + this.zone = zone; + } @OneToMany(mappedBy = "host") private List histories; @@ -43,16 +46,16 @@ public class DiscoveryHost { this.histories = histories; } -// @OneToMany(mappedBy = "host") -// private List ports; -// -// public List getPorts() { -// return ports; -// } -// -// public void setPorts(List ports) { -// this.ports = ports; -// } + @OneToMany(mappedBy = "host") + private List ports; + + public List getPorts() { + return ports; + } + + public void setPorts(List ports) { + this.ports = ports; + } @Column(name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) private Date createDate; diff --git a/src/main/java/com/loafle/bridge/discoveryhost/controller/DiscoveryHostController.java b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostController.java similarity index 61% rename from src/main/java/com/loafle/bridge/discoveryhost/controller/DiscoveryHostController.java rename to src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostController.java index b7b80aa..b6c7e0d 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/controller/DiscoveryHostController.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostController.java @@ -1,4 +1,4 @@ -package com.loafle.bridge.discoveryhost.controller; +package com.loafle.bridge.discoveryhost; /** * Created by root on 16. 11. 15. diff --git a/src/main/java/com/loafle/bridge/discoveryhost/repository/DiscoveryHostRepository.java b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostRepository.java similarity index 76% rename from src/main/java/com/loafle/bridge/discoveryhost/repository/DiscoveryHostRepository.java rename to src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostRepository.java index 9b7cf08..aa8ce98 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/repository/DiscoveryHostRepository.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/DiscoveryHostRepository.java @@ -1,6 +1,6 @@ -package com.loafle.bridge.discoveryhost.repository; +package com.loafle.bridge.discoveryhost; -import com.loafle.bridge.discoveryhost.entity.DiscoveryHost; +import com.loafle.bridge.discoveryhost.DiscoveryHost; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/src/main/java/com/loafle/bridge/discoveryhost/entity/PortScanHistory.java b/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java similarity index 98% rename from src/main/java/com/loafle/bridge/discoveryhost/entity/PortScanHistory.java rename to src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java index 3d4b85d..d33c744 100644 --- a/src/main/java/com/loafle/bridge/discoveryhost/entity/PortScanHistory.java +++ b/src/main/java/com/loafle/bridge/discoveryhost/PortScanHistory.java @@ -1,4 +1,4 @@ -package com.loafle.bridge.discoveryhost.entity; +package com.loafle.bridge.discoveryhost; import com.loafle.bridge.discoveryport.type.DirectionType; import com.loafle.bridge.discoveryport.type.PortType; diff --git a/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPort.java b/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPort.java index 79d6ba3..3b0b905 100644 --- a/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPort.java +++ b/src/main/java/com/loafle/bridge/discoveryport/DiscoveryPort.java @@ -1,6 +1,6 @@ package com.loafle.bridge.discoveryport; -import com.loafle.bridge.discoveryhost.entity.DiscoveryHost; +import com.loafle.bridge.discoveryhost.DiscoveryHost; import com.loafle.bridge.discoveryport.type.PortType; import com.loafle.bridge.discoveryservice.DiscoveryService; diff --git a/src/test/java/com/loafle/bridge/discoveryhost/repository/DiscoveryHostRepositoryTest.java b/src/test/java/com/loafle/bridge/discoveryhost/repository/DiscoveryHostRepositoryTest.java index 624c498..a108af0 100644 --- a/src/test/java/com/loafle/bridge/discoveryhost/repository/DiscoveryHostRepositoryTest.java +++ b/src/test/java/com/loafle/bridge/discoveryhost/repository/DiscoveryHostRepositoryTest.java @@ -1,8 +1,9 @@ package com.loafle.bridge.discoveryhost.repository; import com.loafle.bridge.Application; -import com.loafle.bridge.discoveryhost.entity.DiscoveryHost; -import com.loafle.bridge.discoveryhost.entity.PortScanHistory; +import com.loafle.bridge.discoveryhost.DiscoveryHost; +import com.loafle.bridge.discoveryhost.DiscoveryHostRepository; +import com.loafle.bridge.discoveryhost.PortScanHistory; import com.loafle.bridge.discoveryport.type.DirectionType; import com.loafle.bridge.discoveryport.type.PortType; import org.apache.log4j.Logger;