From 86b3b06e5f3d862da536515fa4195a423c86a528 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 28 Jun 2017 15:56:10 +0900 Subject: [PATCH] arranging --- .../module/crawler/dao/CrawlerDAO.java | 15 ---- .../crawler/dao/CrawlerInputItemDAO.java | 12 --- .../dao/CrawlerInputItemMappingDAO.java | 15 ---- .../module/crawler/dao/JPACrawlerDAO.java | 27 ------ .../crawler/dao/JPACrawlerInputItemDAO.java | 10 --- .../dao/JPACrawlerInputItemMappingDAO.java | 29 ------- .../module/crawler/model/Crawler.java | 76 ---------------- .../crawler/model/CrawlerInputItem.java | 75 ---------------- .../model/CrawlerInputItemMapping.java | 86 ------------------- .../sensor/service/SensorItemService.java | 35 ++++++++ .../service/TargetDiscoveryService.java | 8 -- .../module/websocket/UiWebsocket.java | 19 ---- 12 files changed, 35 insertions(+), 372 deletions(-) delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerDAO.java delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemDAO.java delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemMappingDAO.java delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerDAO.java delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemDAO.java delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemMappingDAO.java delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/model/Crawler.java delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItem.java delete mode 100644 src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItemMapping.java create mode 100644 src/main/java/com/loafle/overflow/module/sensor/service/SensorItemService.java delete mode 100644 src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java diff --git a/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerDAO.java b/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerDAO.java deleted file mode 100644 index 774ba22..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.loafle.overflow.module.crawler.dao;//package com.loafle.overflow.module.crawler.dao; -// -//import com.loafle.overflow.module.crawler.model.Crawler; -//import org.springframework.data.jpa.repository.JpaRepository; -//import org.springframework.stereotype.Repository; -// -//import java.util.List; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//@Repository -//public interface CrawlerDAO extends JpaRepository { -//// public List findAll(); -//} diff --git a/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemDAO.java b/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemDAO.java deleted file mode 100644 index 7441b9b..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.loafle.overflow.module.crawler.dao;//package com.loafle.overflow.module.crawler.dao; -// -//import com.loafle.overflow.module.crawler.model.CrawlerInputItem; -//import org.springframework.data.jpa.repository.JpaRepository; -//import org.springframework.stereotype.Repository; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//@Repository -//public interface CrawlerInputItemDAO extends JpaRepository { -//} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemMappingDAO.java b/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemMappingDAO.java deleted file mode 100644 index 38d0306..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemMappingDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.loafle.overflow.module.crawler.dao;//package com.loafle.overflow.module.crawler.dao; -// -//import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping; -//import org.springframework.data.jpa.repository.JpaRepository; -//import org.springframework.stereotype.Repository; -// -//import java.util.List; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//@Repository -//public interface CrawlerInputItemMappingDAO extends JpaRepository { -//// public List findByCrawlerId(Crawler crawler); -//} diff --git a/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerDAO.java b/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerDAO.java deleted file mode 100644 index dc83433..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerDAO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.loafle.overflow.module.crawler.dao;//package com.loafle.overflow.module.crawler.dao; -// -//import com.loafle.overflow.commons.dao.JPABaseDAO; -//import com.loafle.overflow.module.crawler.model.Crawler; -// -//import javax.persistence.Query; -//import java.util.List; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//public class JPACrawlerDAO extends JPABaseDAO implements CrawlerDAO { -// @Override -// public List findAll() { -// Query query = getEntityManager().createNativeQuery("SELECT c.* FROM CRAWLER c ", Crawler.class); -// -// List crs = null; -// -// try { -// crs = (List)query.getResultList(); -// } catch (Exception e) { -// e.printStackTrace(); -// } finally { -// return crs; -// } -// } -//} diff --git a/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemDAO.java b/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemDAO.java deleted file mode 100644 index dcfc640..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemDAO.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.loafle.overflow.module.crawler.dao;//package com.loafle.overflow.module.crawler.dao; -// -//import com.loafle.overflow.commons.dao.JPABaseDAO; -//import com.loafle.overflow.module.crawler.model.CrawlerInputItem; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//public class JPACrawlerInputItemDAO extends JPABaseDAO implements CrawlerInputItemDAO { -//} diff --git a/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemMappingDAO.java b/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemMappingDAO.java deleted file mode 100644 index 732c12d..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemMappingDAO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.loafle.overflow.module.crawler.dao;//package com.loafle.overflow.module.crawler.dao; -// -//import com.loafle.overflow.commons.dao.JPABaseDAO; -//import com.loafle.overflow.module.crawler.model.Crawler; -//import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping; -// -//import javax.persistence.Query; -//import java.util.List; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//public class JPACrawlerInputItemMappingDAO extends JPABaseDAO implements CrawlerInputItemMappingDAO { -// @Override -// public List findByCrawlerId(Crawler crawler) { -// Query query = getEntityManager().createNativeQuery("SELECT m.* FROM CRAWLER_INPUT_ITEM_MAPPING m WHERE m.crawler_id = :crawler_id", CrawlerInputItemMapping.class); -// query.setParameter("crawler_id", crawler.getId()); -// -// List crs = null; -// -// try { -// crs = (List)query.getResultList(); -// } catch (Exception e) { -// e.printStackTrace(); -// } finally { -// return crs; -// } -// } -//} diff --git a/src/main/java/com/loafle/overflow/module/crawler/model/Crawler.java b/src/main/java/com/loafle/overflow/module/crawler/model/Crawler.java deleted file mode 100644 index 9e2467e..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/model/Crawler.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.loafle.overflow.module.crawler.model;//package com.loafle.overflow.module.crawler.model; -// -//import javax.persistence.*; -//import java.io.Serializable; -//import java.util.Date; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//@SuppressWarnings("serial") -////@Entity(name="CRAWLER") -//public class Crawler implements Serializable { -// -// @Id -// @GeneratedValue(strategy= GenerationType.IDENTITY) -// private Long id; -// -// @Column(name="NAME", nullable=false) -// private String name; -// -// @Column(name="DESCRIPTION") -// private String description; -// -// @Column(name="CRAWLER_TYPE") -// private String crawlerType; -// -// @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) -// private Date createDate; -// -// public Crawler() { -// } -// -// public Crawler(Long id) { -// this.id = id; -// } -// -// public Long getId() { -// return id; -// } -// -// public void setId(Long id) { -// this.id = id; -// } -// -// public String getName() { -// return name; -// } -// -// public void setName(String name) { -// this.name = name; -// } -// -// public String getDescription() { -// return description; -// } -// -// public void setDescription(String description) { -// this.description = description; -// } -// -// public String getCrawlerType() { -// return crawlerType; -// } -// -// public void setCrawlerType(String crawlerType) { -// this.crawlerType = crawlerType; -// } -// -// public Date getCreateDate() { -// return createDate; -// } -// -// public void setCreateDate(Date createDate) { -// this.createDate = createDate; -// } -//} diff --git a/src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItem.java b/src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItem.java deleted file mode 100644 index 0210d79..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItem.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.loafle.overflow.module.crawler.model;//package com.loafle.overflow.module.crawler.model; -// -//import javax.persistence.*; -//import java.io.Serializable; -//import java.util.Date; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//@SuppressWarnings("serial") -////@Entity(name="CRAWLER_INPUT_ITEM") -//public class CrawlerInputItem implements Serializable { -// @Id -// @GeneratedValue(strategy= GenerationType.IDENTITY) -// private Long id; -// -// @Column(name = "NAME") -// private String name; -// -// @Column(name = "DESCRIPTION") -// private String description; -// -// @Column(name = "DATA_TYPE") -// private String dataType; -// -// @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) -// private Date createDate; -// -// -// public CrawlerInputItem(){} -// -// public CrawlerInputItem(Long id) { -// this.id = id; -// } -// -// public Long getId() { -// return id; -// } -// -// public void setId(Long id) { -// this.id = id; -// } -// -// public String getName() { -// return name; -// } -// -// public void setName(String name) { -// this.name = name; -// } -// -// public String getDescription() { -// return description; -// } -// -// public void setDescription(String description) { -// this.description = description; -// } -// -// public String getDataType() { -// return dataType; -// } -// -// public void setDataType(String dataType) { -// this.dataType = dataType; -// } -// -// public Date getCreateDate() { -// return createDate; -// } -// -// public void setCreateDate(Date createDate) { -// this.createDate = createDate; -// } -//} diff --git a/src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItemMapping.java b/src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItemMapping.java deleted file mode 100644 index da74d31..0000000 --- a/src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItemMapping.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.loafle.overflow.module.crawler.model;//package com.loafle.overflow.module.crawler.model; -// -//import javax.persistence.*; -//import java.io.Serializable; -//import java.util.Date; -// -///** -// * Created by geek@loafle.com on 17. 6. 8. -// */ -//@SuppressWarnings("serial") -////@Entity(name="CRAWLER_INPUT_ITEM_MAPPING") -//public class CrawlerInputItemMapping implements Serializable { -// @Id -// @GeneratedValue(strategy= GenerationType.IDENTITY) -// private Long id; -// -// @ManyToOne -// @JoinColumn(name = "CRAWLER_ID", nullable=false) -// private Crawler crawler; -// -// @ManyToOne -// @JoinColumn(name = "CRAWLER_INPUT_ITEM_ID", nullable=false) -// private CrawlerInputItem crawlerInputItem; -// -// @Column(name = "PRIORITY") -// private short priority; -// -// @Column(name = "REQUIRED_TYPE") -// private boolean requiredType; -// -// @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) -// private Date createDate; -// -// public CrawlerInputItemMapping(){} -// public CrawlerInputItemMapping(Long id){ -// this.id = id; -// } -// -// public Long getId() { -// return id; -// } -// -// public void setId(Long id) { -// this.id = id; -// } -// -// public Crawler getCrawler() { -// return crawler; -// } -// -// public void setCrawler(Crawler crawler) { -// this.crawler = crawler; -// } -// -// public CrawlerInputItem getCrawlerInputItem() { -// return crawlerInputItem; -// } -// -// public void setCrawlerInputItem(CrawlerInputItem crawlerInputItem) { -// this.crawlerInputItem = crawlerInputItem; -// } -// -// public short getPriority() { -// return priority; -// } -// -// public void setPriority(short priority) { -// this.priority = priority; -// } -// -// public boolean isRequiredType() { -// return requiredType; -// } -// -// public void setRequiredType(boolean requiredType) { -// this.requiredType = requiredType; -// } -// -// public Date getCreateDate() { -// return createDate; -// } -// -// public void setCreateDate(Date createDate) { -// this.createDate = createDate; -// } -//} diff --git a/src/main/java/com/loafle/overflow/module/sensor/service/SensorItemService.java b/src/main/java/com/loafle/overflow/module/sensor/service/SensorItemService.java new file mode 100644 index 0000000..d0f7dca --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/sensor/service/SensorItemService.java @@ -0,0 +1,35 @@ +package com.loafle.overflow.module.sensor.service; + +import com.loafle.overflow.module.sensor.dao.SensorItemDAO; +import com.loafle.overflow.module.sensor.model.Sensor; +import com.loafle.overflow.module.sensor.model.SensorItem; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * Created by insanity on 17. 6. 28. + */ +@Service +public class SensorItemService { + + @Autowired + private SensorItemDAO sensorItemDAO; + + public SensorItem regist(SensorItem sensorItem) { + return this.sensorItemDAO.save(sensorItem); + } + + public SensorItem read(String id) { + return this.sensorItemDAO.findOne(Long.valueOf(id)); + } + + public List readAllBySensor(Sensor sensor) { + return this.sensorItemDAO.findAllBySensor(sensor); + } + + public void remove(SensorItem sensorItem) { + this.sensorItemDAO.delete(sensorItem); + } +} diff --git a/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java b/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java deleted file mode 100644 index 8b9a100..0000000 --- a/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.loafle.overflow.module.target.service; - -/** - * Created by insanity on 17. 6. 28. - */ -public class TargetDiscoveryService { - -} diff --git a/src/main/java/com/loafle/overflow/module/websocket/UiWebsocket.java b/src/main/java/com/loafle/overflow/module/websocket/UiWebsocket.java index 6ba781f..3dcb466 100644 --- a/src/main/java/com/loafle/overflow/module/websocket/UiWebsocket.java +++ b/src/main/java/com/loafle/overflow/module/websocket/UiWebsocket.java @@ -32,23 +32,4 @@ public class UiWebsocket { this.createDate = createDate; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - UiWebsocket that = (UiWebsocket) o; - - if (id != that.id) return false; - if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = (int) (id ^ (id >>> 32)); - result = 31 * result + (createDate != null ? createDate.hashCode() : 0); - return result; - } }