commit 2a33d4485784945de109e9c7c3e3426fe79326f7 Author: geek Date: Wed Jun 28 14:19:04 2017 +0900 overflow_server project shared diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57b203d --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# Created by .ignore support plugin (hsz.mobi) +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +### Maven template + +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties + +# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) +!/.mvn/wrapper/maven-wrapper.jar +### Java template +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt +14 +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +.idea/ +*.iml +/target/ +.settings/ +.classpath +.project +.vscode/settings.json + +.vscode/ \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..023ea5b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3" + +services: + # overFlow-dao: + # restart: always + # build: ./ + # container_name: overFlow-dao + # volumes: + # ports: + # - "9080:80" + + postgresql: + restart: always + image: postgres:9.6-alpine + container_name: overFlow-dao-postgres + environment: + - POSTGRES_DB=overflow + - POSTGRES_USER=overflow + - POSTGRES_PASSWORD=qwer5795 + # - POSTGRES_INITDB_ARGS="--data-checksums" + ports: + - "5432:5432" + +# docker-compose up -d +# docker-compose stop +# docker-compose rm +# or +# docker-compose -f ./docker-compose.yml up -d \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9210c47 --- /dev/null +++ b/pom.xml @@ -0,0 +1,147 @@ + + + 4.0.0 + + + com.loafle + maven_parent_jar + 1.0.0-RELEASE + + + com.loafle.overflow + overflow_server + jar + 1.0.0-SNAPSHOT + com.loafle.overflow.overflow_server + + + 1.2.0 + 3.2.0 + 4.3.9.RELEASE + 4.3.10.Final + 1.11.4.RELEASE + + + + + io.grpc + grpc-netty + ${grpc.version} + + + io.grpc + grpc-protobuf + ${grpc.version} + + + io.grpc + grpc-stub + ${grpc.version} + + + org.mockito + mockito-core + 1.9.5 + test + + + + + org.springframework.data + spring-data-jpa + ${spring-data-jpa} + + + + + org.springframework + spring-test + ${spring-test-version} + test + + + + + org.postgresql + postgresql + 9.4-1200-jdbc41 + + + + org.codehaus.jackson + jackson-mapper-asl + 1.9.13 + + + + + + org.hibernate + hibernate-entitymanager + 5.2.10.Final + + + + org.hibernate + hibernate-core + 5.2.10.Final + + + + + + + + + src/main/resources + true + + + + + src/test/resources + true + + + + + + kr.motd.maven + os-maven-plugin + 1.5.0.Final + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + 0.5.0 + + com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} + grpc-java + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} + + + + + compile + compile-custom + + + + + + com.google.protobuf + protobuf-java + ${protoc.version} + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/OFMain.java b/src/main/java/com/loafle/overflow/OFMain.java new file mode 100644 index 0000000..7fbecb6 --- /dev/null +++ b/src/main/java/com/loafle/overflow/OFMain.java @@ -0,0 +1,7 @@ +package com.loafle.overflow; + +public class OFMain { + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/apikey/dao/ApiKeyDAO.java b/src/main/java/com/loafle/overflow/module/apikey/dao/ApiKeyDAO.java new file mode 100644 index 0000000..ba511fb --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/apikey/dao/ApiKeyDAO.java @@ -0,0 +1,15 @@ +package com.loafle.overflow.module.apikey.dao; + +import com.loafle.overflow.module.apikey.model.ApiKey; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + + +/** + * Created by root on 17. 6. 1. + */ +@Repository +public interface ApiKeyDAO extends JpaRepository { + + ApiKey findByApiKey(String apiKey); +} diff --git a/src/main/java/com/loafle/overflow/module/apikey/model/ApiKey.java b/src/main/java/com/loafle/overflow/module/apikey/model/ApiKey.java new file mode 100644 index 0000000..4ada0c1 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/apikey/model/ApiKey.java @@ -0,0 +1,81 @@ +package com.loafle.overflow.module.apikey.model; + +import com.loafle.overflow.module.domain.model.Domain; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "API_KEY", schema = "public", catalog = "postgres") +public class ApiKey { + private long id; + private String apiKey; + private Date createDate; + private Domain domain; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "API_KEY", nullable = false, length = 50) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @ManyToOne + @JoinColumn(name = "DOMAIN_ID", nullable=false) + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } +// +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// TblApiKey tblApiKey = (TblApiKey) o; +// +// if (id != tblApiKey.id) return false; +// if (domainId != tblApiKey.domainId) return false; +// if (apiKey != null ? !apiKey.equals(tblApiKey.apiKey) : tblApiKey.apiKey != null) return false; +// if (createDate != null ? !createDate.equals(tblApiKey.createDate) : tblApiKey.createDate != null) return false; +// +// return true; +// } +// +// @Override +// public int hashCode() { +// int result = (int) (id ^ (id >>> 32)); +// result = 31 * result + (apiKey != null ? apiKey.hashCode() : 0); +// result = 31 * result + (createDate != null ? createDate.hashCode() : 0); +// result = 31 * result + (int) (domainId ^ (domainId >>> 32)); +// return result; +// } +} 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 new file mode 100644 index 0000000..774ba22 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerDAO.java @@ -0,0 +1,15 @@ +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 new file mode 100644 index 0000000..7441b9b --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemDAO.java @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..38d0306 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/dao/CrawlerInputItemMappingDAO.java @@ -0,0 +1,15 @@ +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 new file mode 100644 index 0000000..dc83433 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerDAO.java @@ -0,0 +1,27 @@ +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 new file mode 100644 index 0000000..dcfc640 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemDAO.java @@ -0,0 +1,10 @@ +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 new file mode 100644 index 0000000..732c12d --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/dao/JPACrawlerInputItemMappingDAO.java @@ -0,0 +1,29 @@ +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 new file mode 100644 index 0000000..9e2467e --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/model/Crawler.java @@ -0,0 +1,76 @@ +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 new file mode 100644 index 0000000..0210d79 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItem.java @@ -0,0 +1,75 @@ +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 new file mode 100644 index 0000000..da74d31 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/crawler/model/CrawlerInputItemMapping.java @@ -0,0 +1,86 @@ +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/domain/dao/DomainDAO.java b/src/main/java/com/loafle/overflow/module/domain/dao/DomainDAO.java new file mode 100644 index 0000000..f030615 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/domain/dao/DomainDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.domain.dao; + +import com.loafle.overflow.module.domain.model.Domain; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by root on 17. 6. 23. + */ +@Repository +public interface DomainDAO extends JpaRepository { +} diff --git a/src/main/java/com/loafle/overflow/module/domain/dao/DomainMemberDAO.java b/src/main/java/com/loafle/overflow/module/domain/dao/DomainMemberDAO.java new file mode 100644 index 0000000..3f9257b --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/domain/dao/DomainMemberDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.domain.dao; + +import com.loafle.overflow.module.domain.model.DomainMember; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by root on 17. 6. 23. + */ +@Repository +public interface DomainMemberDAO extends JpaRepository { +} diff --git a/src/main/java/com/loafle/overflow/module/domain/model/Domain.java b/src/main/java/com/loafle/overflow/module/domain/model/Domain.java new file mode 100644 index 0000000..7186d8a --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/domain/model/Domain.java @@ -0,0 +1,52 @@ +package com.loafle.overflow.module.domain.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "DOMAIN", schema = "public", catalog = "postgres") +public class Domain { + private long id; + private String name; + private Date createDate; + + public Domain() { + } + public Domain(long id) { + this.id = id; + } + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/domain/model/DomainMember.java b/src/main/java/com/loafle/overflow/module/domain/model/DomainMember.java new file mode 100644 index 0000000..1254e63 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/domain/model/DomainMember.java @@ -0,0 +1,59 @@ +package com.loafle.overflow.module.domain.model; + +import com.loafle.overflow.module.member.model.Member; + +import javax.persistence.*; +import java.sql.Timestamp; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "DOMAIN_MEMBER", schema = "public", catalog = "postgres") +public class DomainMember { + private long id; + private Timestamp createDate; + private Member member; + private Domain domain; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Timestamp getCreateDate() { + return createDate; + } + + public void setCreateDate(Timestamp createDate) { + this.createDate = createDate; + } + + + @ManyToOne + @JoinColumn(name = "MEMBER_ID", nullable = false) + public Member getMember() { + return member; + } + + public void setMember(Member member) { + this.member = member; + } + + @ManyToOne + @JoinColumn(name = "DOMAIN_ID", nullable = false) + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } +} diff --git a/src/main/java/com/loafle/overflow/module/email/dao/EmailAuthDAO.java b/src/main/java/com/loafle/overflow/module/email/dao/EmailAuthDAO.java new file mode 100644 index 0000000..54070bc --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/email/dao/EmailAuthDAO.java @@ -0,0 +1,23 @@ +package com.loafle.overflow.module.email.dao; + +import com.loafle.overflow.module.email.model.EmailAuth; +import com.loafle.overflow.module.member.model.Member; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * Created by geek@loafle.com on 17. 6. 6. + */ +@Repository +public interface EmailAuthDAO extends JpaRepository { + @Query("select e from EmailAuth e where e.emailAuthKey = :authKey") + EmailAuth findByEmailAuthKey(@Param("authKey") String emailAuthKey); + + List findByMember(Member member); + +} + diff --git a/src/main/java/com/loafle/overflow/module/email/model/EmailAuth.java b/src/main/java/com/loafle/overflow/module/email/model/EmailAuth.java new file mode 100644 index 0000000..c46f672 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/email/model/EmailAuth.java @@ -0,0 +1,69 @@ +package com.loafle.overflow.module.email.model; + +import com.loafle.overflow.module.member.model.Member; + +import javax.persistence.*; +import java.sql.Timestamp; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "EMAIL_AUTH", schema = "public", catalog = "postgres") +public class EmailAuth { + private long id; + private String emailAuthKey; + private Timestamp createDate; + private Timestamp authConfirmDate; + private Member member; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "EMAIL_AUTH_KEY", nullable = true, length = 50) + public String getEmailAuthKey() { + return emailAuthKey; + } + + public void setEmailAuthKey(String emailAuthKey) { + this.emailAuthKey = emailAuthKey; + } + + @Basic + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Timestamp getCreateDate() { + return createDate; + } + + public void setCreateDate(Timestamp createDate) { + this.createDate = createDate; + } + + @Basic + @Column(name = "AUTH_CONFIRM_DATE", nullable = true, insertable = true, updatable = false) + public Timestamp getAuthConfirmDate() { + return authConfirmDate; + } + + public void setAuthConfirmDate(Timestamp authConfirmDate) { + this.authConfirmDate = authConfirmDate; + } + + @ManyToOne + @JoinColumn(name = "MEMBER_ID", nullable = false) + public Member getMember() { + return member; + } + + public void setMember(Member member) { + this.member = member; + } +} diff --git a/src/main/java/com/loafle/overflow/module/history/History.java b/src/main/java/com/loafle/overflow/module/history/History.java new file mode 100644 index 0000000..f048820 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/history/History.java @@ -0,0 +1,54 @@ +package com.loafle.overflow.module.history; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "HISTORY", schema = "public", catalog = "postgres") +public class History { + private long id; + private Date createDate; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + History that = (History) 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; + } +} diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java new file mode 100644 index 0000000..dec00ed --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java @@ -0,0 +1,14 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.Infra; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraDAO extends JpaRepository { +// @Query("select m from Member m WHERE m.email = :#{#m2.email}") +// Member findByEmail(@Param("m2") Member member); +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraHostDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraHostDAO.java new file mode 100644 index 0000000..0c1eb90 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraHostDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraHost; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraHostDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraMachineDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraMachineDAO.java new file mode 100644 index 0000000..bfedb13 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraMachineDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraMachine; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraMachineDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSApplicationDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSApplicationDAO.java new file mode 100644 index 0000000..43d626a --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSApplicationDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraOSApplication; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraOSApplicationDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDAO.java new file mode 100644 index 0000000..073dda4 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraOS; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraOSDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDaemonDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDaemonDAO.java new file mode 100644 index 0000000..1a1df72 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSDaemonDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraOSDaemon; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraOSDaemonDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSPortDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSPortDAO.java new file mode 100644 index 0000000..80d4be5 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraOSPortDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraOSPort; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraOSPortDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraServiceDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraServiceDAO.java new file mode 100644 index 0000000..1c89a97 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraServiceDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.infra.dao; + +import com.loafle.overflow.module.infra.model.InfraService; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface InfraServiceDAO extends JpaRepository { +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/model/Infra.java b/src/main/java/com/loafle/overflow/module/infra/model/Infra.java new file mode 100644 index 0000000..51af665 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/model/Infra.java @@ -0,0 +1,60 @@ +package com.loafle.overflow.module.infra.model; + + +import com.loafle.overflow.module.meta.model.MetaInfraType; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "INFRA", schema = "public", catalog = "postgres") +public class Infra { + private long id; + private MetaInfraType type; + private long childId; + private Date createDate; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "TYPE_ID", nullable = false) + public MetaInfraType getType() { + return type; + } + + public void setType(MetaInfraType type) { + this.type = type; + } + + @Basic + @Column(name = "CHILD_ID", nullable = false) + public long getChildId() { + return childId; + } + + public void setChildId(long childId) { + this.childId = childId; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java new file mode 100644 index 0000000..265b0ad --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraHost.java @@ -0,0 +1,68 @@ +package com.loafle.overflow.module.infra.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "INFRA_HOST", schema = "public", catalog = "postgres") +public class InfraHost { + private long id; + private InfraOS os; + private int ip; + private int mac; + private Date createDate; + + @Id + @Column(name = "ID", nullable = false) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "OS_ID", nullable = false) + public InfraOS getOs() { + return os; + } + + public void setOs(InfraOS os) { + this.os = os; + } + + @Basic + @Column(name = "IP", nullable = false) + public int getIp() { + return ip; + } + + public void setIp(int ip) { + this.ip = ip; + } + + @Basic + @Column(name = "MAC", nullable = false) + public int getMac() { + return mac; + } + + public void setMac(int mac) { + this.mac = mac; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java new file mode 100644 index 0000000..14a44b8 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraMachine.java @@ -0,0 +1,59 @@ +package com.loafle.overflow.module.infra.model; + +import com.loafle.overflow.module.probe.model.Probe; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "INFRA_MACHINE", schema = "public", catalog = "postgres") +public class InfraMachine { + private long id; + private Probe probe; + private String meta; + private Date createDate; + + @Id + @Column(name = "ID", nullable = false) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "PROBE_ID", nullable = false) + public Probe getProbe() { + return probe; + } + + public void setProbe(Probe probe) { + this.probe = probe; + } + + @Basic + @Column(name = "META", nullable = true, length = 255) + public String getMeta() { + return meta; + } + + public void setMeta(String meta) { + this.meta = meta; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java new file mode 100644 index 0000000..4602ebc --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOS.java @@ -0,0 +1,71 @@ +package com.loafle.overflow.module.infra.model; + + +import com.loafle.overflow.module.meta.model.MetaInfraVendor; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "INFRA_OS", schema = "public", catalog = "postgres") +public class InfraOS { + private long id; + private InfraMachine machine; + private String meta; + private Date createDate; + private MetaInfraVendor vendor; + + @Id + @Column(name = "ID", nullable = false) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "MACHINE_ID", nullable = false) + public InfraMachine getMachine() { + return machine; + } + + public void setMachine(InfraMachine machine) { + this.machine = machine; + } + + @Basic + @Column(name = "META", nullable = true, length = 255) + public String getMeta() { + return meta; + } + + public void setMeta(String meta) { + this.meta = meta; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @ManyToOne + @JoinColumn(name = "VENDOR_ID", nullable = false) + public MetaInfraVendor getVendor() { + return vendor; + } + + public void setVendor(MetaInfraVendor vendor) { + this.vendor = vendor; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java new file mode 100644 index 0000000..6d7701c --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSApplication.java @@ -0,0 +1,57 @@ +package com.loafle.overflow.module.infra.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "INFRA_OS_APPLICATION", schema = "public", catalog = "postgres") +public class InfraOSApplication { + private long id; + private InfraOS os; + private String name; + private Date createDate; + + @Id + @Column(name = "ID", nullable = false) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "OS_ID", nullable = false) + public InfraOS getOs() { + return os; + } + + public void setOs(InfraOS os) { + this.os = os; + } + + @Basic + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java new file mode 100644 index 0000000..5238545 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSDaemon.java @@ -0,0 +1,56 @@ +package com.loafle.overflow.module.infra.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "INFRA_OS_DAEMON", schema = "public", catalog = "postgres") +public class InfraOSDaemon { + private long id; + private InfraOS os; + private String name; + private Date createDate; + + @Id + @Column(name = "ID", nullable = false) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "OS_ID", nullable = false) + public InfraOS getOs() { + return os; + } + + public void setOs(InfraOS os) { + this.os = os; + } + + @Basic + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } +} diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java new file mode 100644 index 0000000..46a106f --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraOSPort.java @@ -0,0 +1,93 @@ +package com.loafle.overflow.module.infra.model; + + +import com.loafle.overflow.module.meta.model.MetaInfraVendor; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "INFRA_OS_PORT", schema = "public", catalog = "postgres") +public class InfraOSPort { + private long id; + private InfraOS os; + private Date createDate; + private Integer port; + private String portType; + private MetaInfraVendor vendor; + private boolean tlsType; + + @Id + @Column(name = "ID", nullable = false) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "OS_ID", nullable = false) + public InfraOS getOs() { + return this.os; + } + + public void setOs(InfraOS os) { + this.os = os; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Basic + @Column(name = "PORT", nullable = true) + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + @Basic + @Column(name = "PORT_TYPE", nullable = false) + public String getPortType() { + return portType; + } + + public void setPortType(String portType) { + this.portType = portType; + } + + @ManyToOne + @JoinColumn(name = "VENDOR_ID", nullable = true) + public MetaInfraVendor getVendor() { + return vendor; + } + + public void setVendor(MetaInfraVendor vendor) { + this.vendor = vendor; + } + + @Basic + @Column(name = "TLS_TYPE", nullable = false) + public boolean isTlsType() { + return tlsType; + } + + public void setTlsType(boolean tlsType) { + this.tlsType = tlsType; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java b/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java new file mode 100644 index 0000000..b585918 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/infra/model/InfraService.java @@ -0,0 +1,92 @@ +package com.loafle.overflow.module.infra.model; + + +import com.loafle.overflow.module.meta.model.MetaInfraVendor; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "INFRA_SERVICE", schema = "public", catalog = "postgres") +public class InfraService { + private long id; + private InfraHost host; + private String portType; + private Integer port; + private MetaInfraVendor vendor; + private Date createDate; + private boolean tlsType; + + @Id + @Column(name = "ID", nullable = false) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "HOST_ID", nullable = false) + public InfraHost getHost() { + return host; + } + + public void setHost(InfraHost host) { + this.host = host; + } + + @Basic + @Column(name = "PORT_TYPE", nullable = false) + public String getPortType() { + return portType; + } + + public void setPortType(String portType) { + this.portType = portType; + } + + @Basic + @Column(name = "PORT", nullable = true) + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + @ManyToOne + @JoinColumn(name = "VENDOR_ID", nullable = false) + public MetaInfraVendor getVendor() { + return vendor; + } + + public void setVendor(MetaInfraVendor vendor) { + this.vendor = vendor; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Basic + @Column(name = "TLS_TYPE", nullable = false) + public boolean isTlsType() { + return tlsType; + } + + public void setTlsType(boolean tlsType) { + this.tlsType = tlsType; + } +} diff --git a/src/main/java/com/loafle/overflow/module/member/dao/MemberDAO.java b/src/main/java/com/loafle/overflow/module/member/dao/MemberDAO.java new file mode 100644 index 0000000..47cebbe --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/member/dao/MemberDAO.java @@ -0,0 +1,16 @@ +package com.loafle.overflow.module.member.dao; + +import com.loafle.overflow.module.member.model.Member; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 5. 25. + */ +@Repository +public interface MemberDAO extends JpaRepository { + @Query("select m from Member m WHERE m.email = :#{#m2.email}") + Member findByEmail(@Param("m2") Member member); +} diff --git a/src/main/java/com/loafle/overflow/module/member/model/Member.java b/src/main/java/com/loafle/overflow/module/member/model/Member.java new file mode 100644 index 0000000..18bb290 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/member/model/Member.java @@ -0,0 +1,123 @@ +package com.loafle.overflow.module.member.model; + + +import com.loafle.overflow.module.meta.model.MetaMemberStatus; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "MEMBER", schema = "public", catalog = "postgres") +public class Member { + private long id; + private String email; + private String pw; + private String pwSalt; + private String name; + private String phone; + private String companyName; + private Date createDate; + private MetaMemberStatus status; + + public Member() { + } + + public Member(long id) { + this.id = id; + } + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "EMAIL", nullable = false, length = 50) + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Basic + @Column(name = "PW", nullable = true, length = 32) + public String getPw() { + return pw; + } + + public void setPw(String pw) { + this.pw = pw; + } + + @Basic + @Column(name = "PW_SALT", nullable = true, length = 32) + public String getPwSalt() { + return pwSalt; + } + + public void setPwSalt(String pwSalt) { + this.pwSalt = pwSalt; + } + + @Basic + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Basic + @Column(name = "PHONE", nullable = true, length = 50) + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + @Basic + @Column(name = "COMPANY_NAME", nullable = true, length = 50) + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @ManyToOne + @JoinColumn(name = "STATUS_ID", nullable = false) + public MetaMemberStatus getStatus() { + return status; + } + + public void setStatus(MetaMemberStatus status) { + this.status = status; + } + + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaCrawlerDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaCrawlerDAO.java new file mode 100644 index 0000000..5b3ead6 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaCrawlerDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaCrawler; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaCrawlerDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaCrawlerInputItemDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaCrawlerInputItemDAO.java new file mode 100644 index 0000000..cf7fe2a --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaCrawlerInputItemDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaCrawlerInputItem; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaCrawlerInputItemDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaInfraTypeDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaInfraTypeDAO.java new file mode 100644 index 0000000..b6004b7 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaInfraTypeDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaInfraType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaInfraTypeDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaInfraVendorDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaInfraVendorDAO.java new file mode 100644 index 0000000..d8771d3 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaInfraVendorDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaInfraVendor; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaInfraVendorDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaInputTypeDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaInputTypeDAO.java new file mode 100644 index 0000000..cf004c3 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaInputTypeDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaInputType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaInputTypeDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaMemberStatusDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaMemberStatusDAO.java new file mode 100644 index 0000000..6ff4140 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaMemberStatusDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaMemberStatus; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaMemberStatusDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaNoAuthProbeStatusDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaNoAuthProbeStatusDAO.java new file mode 100644 index 0000000..5c7b814 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaNoAuthProbeStatusDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by snoop on 17. 6. 26. + */ +@Repository +public interface MetaNoAuthProbeStatusDAO extends JpaRepository { +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaNotificationDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaNotificationDAO.java new file mode 100644 index 0000000..bf8e6b3 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaNotificationDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaNotification; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaNotificationDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeArchitectureDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeArchitectureDAO.java new file mode 100644 index 0000000..3e27c7f --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeArchitectureDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaProbeArchitecture; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaProbeArchitectureDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeOsDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeOsDAO.java new file mode 100644 index 0000000..f5bb9ab --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeOsDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaProbeOs; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaProbeOsDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbePackageDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbePackageDAO.java new file mode 100644 index 0000000..445166f --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbePackageDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaProbePackage; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaProbePackageDAO extends JpaRepository { + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeStatusDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeStatusDAO.java new file mode 100644 index 0000000..a44ab6a --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeStatusDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaProbeStatus; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by snoop on 17. 6. 26. + */ +@Repository +public interface MetaProbeStatusDAO extends JpaRepository { +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeTaskTypeDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeTaskTypeDAO.java new file mode 100644 index 0000000..bb9b46c --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeTaskTypeDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaProbeTaskType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaProbeTaskTypeDAO extends JpaRepository{ + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeVersionDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeVersionDAO.java new file mode 100644 index 0000000..748ab54 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaProbeVersionDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaProbeVersion; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaProbeVersionDAO extends JpaRepository{ + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorItemDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorItemDAO.java new file mode 100644 index 0000000..9ebb069 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorItemDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaSensorItem; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaSensorItemDAO extends JpaRepository{ + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorItemTypeDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorItemTypeDAO.java new file mode 100644 index 0000000..8410317 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorItemTypeDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaSensorItemType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaSensorItemTypeDAO extends JpaRepository{ + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorStatusDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorStatusDAO.java new file mode 100644 index 0000000..5e2164d --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaSensorStatusDAO.java @@ -0,0 +1,12 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaSensorStatus; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by snoop on 17. 6. 26. + */ +@Repository +public interface MetaSensorStatusDAO extends JpaRepository { +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaVendorCrawlerDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaVendorCrawlerDAO.java new file mode 100644 index 0000000..ff28c2d --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaVendorCrawlerDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaVendorCrawler; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaVendorCrawlerDAO extends JpaRepository{ + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/dao/MetaVendorCrawlerSensorItemDAO.java b/src/main/java/com/loafle/overflow/module/meta/dao/MetaVendorCrawlerSensorItemDAO.java new file mode 100644 index 0000000..cf16595 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/dao/MetaVendorCrawlerSensorItemDAO.java @@ -0,0 +1,13 @@ +package com.loafle.overflow.module.meta.dao; + +import com.loafle.overflow.module.meta.model.MetaVendorCrawlerSensorItem; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Created by insanity on 17. 6. 23. + */ +@Repository +public interface MetaVendorCrawlerSensorItemDAO extends JpaRepository{ + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaCrawler.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaCrawler.java new file mode 100644 index 0000000..d3fbc66 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaCrawler.java @@ -0,0 +1,55 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_CRAWLER", schema = "public", catalog = "postgres") +public class MetaCrawler { + private short id; + private Date createDate; + private String name; + private String description; + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Column(name = "DESCRIPTION", nullable = true, length = 100) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaCrawlerInputItem.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaCrawlerInputItem.java new file mode 100644 index 0000000..f7614f1 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaCrawlerInputItem.java @@ -0,0 +1,167 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_CRAWLER_INPUT_ITEM", schema = "public", catalog = "postgres") +public class MetaCrawlerInputItem { + private int id; + private MetaInputType metaInputType; + private MetaCrawler metaCrawler; + private String description; + private String name; + private Date createDate; + private boolean required; + private String defaultValue; + private String pattern; + private String keyName; + private String keyValue; + + @Id + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + @ManyToOne + @JoinColumn(name = "TYPE_ID", nullable = false) + public MetaInputType getMetaInputType() { + return metaInputType; + } + + public void setMetaInputType(MetaInputType metaInputType) { + this.metaInputType = metaInputType; + } + + @ManyToOne + @JoinColumn(name = "CRAWLER_ID", nullable = false) + public MetaCrawler getMetaCrawler() { + return metaCrawler; + } + + public void setMetaCrawler(MetaCrawler metaCrawler) { + this.metaCrawler = metaCrawler; + } + + @Column(name = "DESCRIPTION", nullable = true, length = 50) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Column(name = "REQUIRED", nullable = false) + public boolean isRequired() { + return required; + } + + public void setRequired(boolean required) { + this.required = required; + } + + @Column(name = "DEFAULT_VALUE", nullable = true, length = 50) + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + + @Column(name = "PATTERN", nullable = true, length = 50) + public String getPattern() { + return pattern; + } + + public void setPattern(String pattern) { + this.pattern = pattern; + } + + + @Column(name = "KEY_NAME", nullable = true, length = 50) + public String getKeyName() { + return keyName; + } + + public void setKeyName(String keyName) { + this.keyName = keyName; + } + + + @Column(name = "KEY_VALUE", nullable = true, length = 50) + public String getKeyValue() { + return keyValue; + } + + public void setKeyValue(String keyValue) { + this.keyValue = keyValue; + } + +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// MetaCrawlerInputItem that = (MetaCrawlerInputItem) o; +// +// if (id != that.id) return false; +// if (typeId != that.typeId) return false; +// if (crawlerId != that.crawlerId) return false; +// if (required != that.required) return false; +// if (desc != null ? !desc.equals(that.desc) : that.desc != null) return false; +// if (name != null ? !name.equals(that.name) : that.name != null) return false; +// if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false; +// if (defaultValue != null ? !defaultValue.equals(that.defaultValue) : that.defaultValue != null) return false; +// if (pattern != null ? !pattern.equals(that.pattern) : that.pattern != null) return false; +// if (keyName != null ? !keyName.equals(that.keyName) : that.keyName != null) return false; +// if (keyValue != null ? !keyValue.equals(that.keyValue) : that.keyValue != null) return false; +// +// return true; +// } +// +// @Override +// public int hashCode() { +// int result = id; +// result = 31 * result + (int) typeId; +// result = 31 * result + (int) crawlerId; +// result = 31 * result + (desc != null ? desc.hashCode() : 0); +// result = 31 * result + (name != null ? name.hashCode() : 0); +// result = 31 * result + (createDate != null ? createDate.hashCode() : 0); +// result = 31 * result + (required ? 1 : 0); +// result = 31 * result + (defaultValue != null ? defaultValue.hashCode() : 0); +// result = 31 * result + (pattern != null ? pattern.hashCode() : 0); +// result = 31 * result + (keyName != null ? keyName.hashCode() : 0); +// result = 31 * result + (keyValue != null ? keyValue.hashCode() : 0); +// return result; +// } +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaInfraType.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaInfraType.java new file mode 100644 index 0000000..4390989 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaInfraType.java @@ -0,0 +1,45 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_INFRA_TYPE", schema = "public", catalog = "postgres") +public class MetaInfraType { + private int id; + private String name; + private Date createDate; + + @Id + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaInfraVendor.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaInfraVendor.java new file mode 100644 index 0000000..c68b7a7 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaInfraVendor.java @@ -0,0 +1,90 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_INFRA_VENDOR", schema = "public", catalog = "postgres") +public class MetaInfraVendor { + private int id; + private String name; + private Date createDate; + private MetaInfraType metaInfraType; + + @Id + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +// @Basic +// @Column(name = "TYPE_ID", nullable = false) +// public int getTypeId() { +// return typeId; +// } +// +// public void setTypeId(int typeId) { +// this.typeId = typeId; +// } + + @ManyToOne + @JoinColumn(name = "TYPE_ID", nullable=false) + public MetaInfraType getMetaInfraType() { + return metaInfraType; + } + + public void setMetaInfraType(MetaInfraType metaInfraType) { + this.metaInfraType = metaInfraType; + } + + +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// MetaInfraVendor that = (MetaInfraVendor) o; +// +// if (id != that.id) return false; +// if (typeId != that.typeId) return false; +// if (name != null ? !name.equals(that.name) : that.name != null) return false; +// if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false; +// +// return true; +// } +// +// @Override +// public int hashCode() { +// int result = id; +// result = 31 * result + (name != null ? name.hashCode() : 0); +// result = 31 * result + (createDate != null ? createDate.hashCode() : 0); +// result = 31 * result + typeId; +// return result; +// } +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaInputType.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaInputType.java new file mode 100644 index 0000000..fa86aeb --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaInputType.java @@ -0,0 +1,55 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_INPUT_TYPE", schema = "public", catalog = "postgres") +public class MetaInputType { + private short id; + private String name; + private String description; + private Date createDate; + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Column(name = "DESCRIPTION", nullable = true, length = 50) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaMemberStatus.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaMemberStatus.java new file mode 100644 index 0000000..709833d --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaMemberStatus.java @@ -0,0 +1,44 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_MEMBER_STATUS", schema = "public", catalog = "postgres") +public class MetaMemberStatus { + private short id; + private String name; + + public MetaMemberStatus() { + + } + + public MetaMemberStatus(short id) { + this.id = id; + } + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "Name", nullable = false, length = 10) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaNoAuthProbeStatus.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaNoAuthProbeStatus.java new file mode 100644 index 0000000..2c99e11 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaNoAuthProbeStatus.java @@ -0,0 +1,43 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * Created by snoop on 17. 6. 26. + */ +@Entity +@Table(name = "META_NOAUTH_PROBE_STATUS", schema = "public", catalog = "postgres") +public class MetaNoAuthProbeStatus { + private short id; + private String name; + + public MetaNoAuthProbeStatus() { + + } + + public MetaNoAuthProbeStatus(short id) { + this.id = id; + } + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "Name", nullable = false, length = 10) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaNotification.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaNotification.java new file mode 100644 index 0000000..62a6773 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaNotification.java @@ -0,0 +1,54 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_NOTIFICATION", schema = "public", catalog = "postgres") +public class MetaNotification { + private long id; + private Date createDate; + private String name; + private String description; + + @Id + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Column(name = "DESCRIPTION", nullable = true, length = 50) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeArchitecture.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeArchitecture.java new file mode 100644 index 0000000..15ae5cb --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeArchitecture.java @@ -0,0 +1,45 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_PROBE_ARCHITECTURE", schema = "public", catalog = "postgres") +public class MetaProbeArchitecture { + private short id; + private String architecture; + private Date createDate; + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "ARCHITECTURE", nullable = true, length = 10) + public String getArchitecture() { + return architecture; + } + + public void setArchitecture(String architecture) { + this.architecture = architecture; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeOs.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeOs.java new file mode 100644 index 0000000..3d6f9d9 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeOs.java @@ -0,0 +1,45 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_PROBE_OS", schema = "public", catalog = "postgres") +public class MetaProbeOs { + private short id; + private String name; + private Date createDate; + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaProbePackage.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbePackage.java new file mode 100644 index 0000000..15828ce --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbePackage.java @@ -0,0 +1,68 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_PROBE_PACKAGE", schema = "public", catalog = "postgres") +public class MetaProbePackage { + private long id; + private MetaProbeVersion version; + private MetaProbeOs os; + private MetaProbeArchitecture architecture; + private Date createDate; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "VERSION_ID", nullable = false) + public MetaProbeVersion getVersion() { + return version; + } + + public void setVersion(MetaProbeVersion version) { + this.version = version; + } + + @ManyToOne + @JoinColumn(name = "OS_ID", nullable = false) + public MetaProbeOs getOs() { + return os; + } + + public void setOs(MetaProbeOs os) { + this.os = os; + } + + @ManyToOne + @JoinColumn(name = "ARCHITECTURE_ID", nullable = false) + public MetaProbeArchitecture getArchitecture() { + return architecture; + } + + public void setArchitecture(MetaProbeArchitecture architecture) { + this.architecture = architecture; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeStatus.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeStatus.java new file mode 100644 index 0000000..a6f5572 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeStatus.java @@ -0,0 +1,43 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * Created by snoop on 17. 6. 26. + */ +@Entity +@Table(name = "META_PROBE_STATUS", schema = "public", catalog = "postgres") +public class MetaProbeStatus { + private short id; + private String name; + + public MetaProbeStatus() { + + } + + public MetaProbeStatus(short id) { + this.id = id; + } + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "Name", nullable = false, length = 10) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeTaskType.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeTaskType.java new file mode 100644 index 0000000..f90f3f0 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeTaskType.java @@ -0,0 +1,56 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_PROBE_TASK_TYPE", schema = "public", catalog = "postgres") +public class MetaProbeTaskType { + private short id; + private String name; + private String description; + private Date createDate; + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "NAME", nullable = false, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Column(name = "DESCRIPTION", nullable = false, length = 50) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeVersion.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeVersion.java new file mode 100644 index 0000000..766e62e --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaProbeVersion.java @@ -0,0 +1,46 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_PROBE_VERSION", schema = "public", catalog = "postgres") +public class MetaProbeVersion { + private short id; + private String version; + private Date createDate; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "VERSION", nullable = true, length = 10) + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorItem.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorItem.java new file mode 100644 index 0000000..54ace74 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorItem.java @@ -0,0 +1,75 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_SENSOR_ITEM", schema = "public", catalog = "postgres") +public class MetaSensorItem { + private int id; + private MetaSensorItemType metaSensorItemType; + private String key; + private String name; + private Date createDate; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + +// @Column(name = "TYPE_ID", nullable = false) +// public short getTypeId() { +// return typeId; +// } +// +// public void setTypeId(short typeId) { +// this.typeId = typeId; +// } + + @ManyToOne + @JoinColumn(name = "TYPE_ID", nullable = false) + public MetaSensorItemType getMetaSensorItemType() { + return metaSensorItemType; + } + + public void setMetaSensorItemType(MetaSensorItemType metaSensorItemType) { + this.metaSensorItemType = metaSensorItemType; + } + + @Column(name = "KEY", nullable = true, length = 50) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorItemType.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorItemType.java new file mode 100644 index 0000000..574504a --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorItemType.java @@ -0,0 +1,56 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_SENSOR_ITEM_TYPE", schema = "public", catalog = "postgres") +public class MetaSensorItemType { + private short id; + private String name; + private String description; + private Date createDate; + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "NAME", nullable = true, length = 50) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Column(name = "DESCRIPTION", nullable = true, length = 50) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorStatus.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorStatus.java new file mode 100644 index 0000000..6a2783c --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorStatus.java @@ -0,0 +1,43 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * Created by snoop on 17. 6. 26. + */ +@Entity +@Table(name = "META_SENSOR_STATUS", schema = "public", catalog = "postgres") +public class MetaSensorStatus { + private short id; + private String name; + + public MetaSensorStatus() { + + } + + public MetaSensorStatus(short id) { + this.id = id; + } + + @Id + public short getId() { + return id; + } + + public void setId(short id) { + this.id = id; + } + + + @Column(name = "Name", nullable = false, length = 10) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaVendorCrawler.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaVendorCrawler.java new file mode 100644 index 0000000..e485b51 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaVendorCrawler.java @@ -0,0 +1,76 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_VENDOR_CRAWLER", schema = "public", catalog = "postgres") +public class MetaVendorCrawler { + private int id; + private MetaCrawler metaCrawler; + private MetaInfraVendor metaInfraVendor; + private Date createDate; + + @Id + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "CRAWLER_ID", nullable = false) + public MetaCrawler getMetaCrawler() { + return metaCrawler; + } + + public void setMetaCrawler(MetaCrawler metaCrawler) { + this.metaCrawler = metaCrawler; + } + + @ManyToOne + @JoinColumn(name = "VENDOR_ID", nullable = false) + public MetaInfraVendor getMetaInfraVendor() { + return metaInfraVendor; + } + + public void setMetaInfraVendor(MetaInfraVendor metaInfraVendor) { + this.metaInfraVendor = metaInfraVendor; + } + + // @Basic +// @Column(name = "CRAWLER_ID", nullable = false) +// public short getCrawlerId() { +// return crawlerId; +// } +// +// public void setCrawlerId(short crawlerId) { +// this.crawlerId = crawlerId; +// } +// +// @Basic +// @Column(name = "VENDOR_ID", nullable = false) +// public int getVendorId() { +// return vendorId; +// } +// +// public void setVendorId(int vendorId) { +// this.vendorId = vendorId; +// } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaVendorCrawlerSensorItem.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaVendorCrawlerSensorItem.java new file mode 100644 index 0000000..863ea21 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaVendorCrawlerSensorItem.java @@ -0,0 +1,111 @@ +package com.loafle.overflow.module.meta.model; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "META_VENDOR_CRAWLER_SENSOR_ITEM", schema = "public", catalog = "postgres") +public class MetaVendorCrawlerSensorItem { + private long id; + private String interval; + private String warnCondition; + private Date createDate; + private MetaSensorItem metaSensorItem; + private MetaInfraVendor metaInfraVendor; + private short crawlerId; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + + @Column(name = "INTERVAL", nullable = true, length = 50) + public String getInterval() { + return interval; + } + + public void setInterval(String interval) { + this.interval = interval; + } + + + @Column(name = "WARN_CONDITION", nullable = true, length = 50) + public String getWarnCondition() { + return warnCondition; + } + + public void setWarnCondition(String warnCondition) { + this.warnCondition = warnCondition; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +// @Basic +// @Column(name = "ITEM_ID", nullable = false) +// public int getItemId() { +// return itemId; +// } +// +// public void setItemId(int itemId) { +// this.itemId = itemId; +// } +// +// @Basic +// @Column(name = "VENDOR_ID", nullable = false) +// public int getVendorId() { +// return vendorId; +// } +// +// public void setVendorId(int vendorId) { +// this.vendorId = vendorId; +// } + + + @ManyToOne + @JoinColumn(name = "ITEM_ID", nullable = false) + public MetaSensorItem getMetaSensorItem() { + return metaSensorItem; + } + + public void setMetaSensorItem(MetaSensorItem metaSensorItem) { + this.metaSensorItem = metaSensorItem; + } + + @ManyToOne + @JoinColumn(name = "VENDOR_ID", nullable = false) + public MetaInfraVendor getMetaInfraVendor() { + return metaInfraVendor; + } + + public void setMetaInfraVendor(MetaInfraVendor metaInfraVendor) { + this.metaInfraVendor = metaInfraVendor; + } + + @Basic + @Column(name = "CRAWLER_ID", nullable = false) + public short getCrawlerId() { + return crawlerId; + } + + public void setCrawlerId(short crawlerId) { + this.crawlerId = crawlerId; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/dao/NoAuthProbeDAO.java b/src/main/java/com/loafle/overflow/module/noauthprobe/dao/NoAuthProbeDAO.java new file mode 100644 index 0000000..fc2b722 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/dao/NoAuthProbeDAO.java @@ -0,0 +1,25 @@ +package com.loafle.overflow.module.noauthprobe.dao; + +import com.loafle.overflow.module.domain.model.Domain; +import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * Created by root on 17. 5. 30. + */ +@Repository +public interface NoAuthProbeDAO extends JpaRepository { +// NoAuthProbeDeprecate findByTempKey(NoAuthProbeDeprecate noAuthAgent); +// List findAllByNoAuth(NoAuthProbeDeprecate noAuthAgent); + +// @Query("SELECT n FROM NoAuthProbe n WHERE n.tempProbeKey = :tempProbeKey") + NoAuthProbe findByTempProbeKey(String tempProbeKey); +// @Query("select m from Member m WHERE m.email = :#{#m2.email}") + @Query("SELECT n FROM NoAuthProbe n WHERE n.domain.id = :#{#domain.id} and n.status.id = 3") // 3 = Process + List findAllByDomain(@Param("domain") Domain domain); +} diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java b/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java new file mode 100644 index 0000000..cac693c --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/model/NoAuthProbe.java @@ -0,0 +1,160 @@ +package com.loafle.overflow.module.noauthprobe.model; + + +import com.loafle.overflow.module.domain.model.Domain; +import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus; +import com.loafle.overflow.module.probe.model.Probe; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "NOAUTH_PROBE", schema = "public", catalog = "postgres") +public class NoAuthProbe { + private long id; + private String hostName; + private long macAddress; + private long ipAddress; + private MetaNoAuthProbeStatus status; + private String tempProbeKey; + private Date createDate; + private String apiKey; + private Domain domain; + private Probe probe; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "HOST_NAME", nullable = true, length = 50) + public String getHostName() { + return hostName; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } + + + @Column(name = "MAC_ADDRESS", nullable = true) + public long getMacAddress() { + return macAddress; + } + + public void setMacAddress(long macAddress) { + this.macAddress = macAddress; + } + + + @Column(name = "IP_ADDRESS", nullable = true) + public long getIpAddress() { + return ipAddress; + } + + public void setIpAddress(long ipAddress) { + this.ipAddress = ipAddress; + } + + @ManyToOne + @JoinColumn(name = "STATUS", nullable = false) + public MetaNoAuthProbeStatus getStatus() { + return status; + } + + public void setStatus(MetaNoAuthProbeStatus status) { + this.status = status; + } + + @Column(name = "TEMP_PROBE_KEY", nullable = false, length = 50, unique = true) + public String getTempProbeKey() { + return tempProbeKey; + } + + public void setTempProbeKey(String tempProbeKey) { + this.tempProbeKey = tempProbeKey; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Column(name = "API_KEY", nullable = true, length = 50) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + @ManyToOne + @JoinColumn(name = "DOMAIN_ID", nullable=false) + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } + + @ManyToOne + @JoinColumn(name = "PROBE_ID", nullable = true) + public Probe getProbe() { + return probe; + } + + public void setProbe(Probe probe) { + this.probe = probe; + } + +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// NoAuthProbe that = (NoAuthProbe) o; +// +// if (id != that.id) return false; +// if (domainId != that.domainId) return false; +// if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false; +// if (macAddress != null ? !macAddress.equals(that.macAddress) : that.macAddress != null) return false; +// if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null) return false; +// if (status != null ? !status.equals(that.status) : that.status != null) return false; +// if (tempProbeKey != null ? !tempProbeKey.equals(that.tempProbeKey) : that.tempProbeKey != null) return false; +// if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false; +// if (apiKey != null ? !apiKey.equals(that.apiKey) : that.apiKey != null) return false; +// if (probeId != null ? !probeId.equals(that.probeId) : that.probeId != null) return false; +// +// return true; +// } +// +// @Override +// public int hashCode() { +// int result = (int) (id ^ (id >>> 32)); +// result = 31 * result + (hostName != null ? hostName.hashCode() : 0); +// result = 31 * result + (macAddress != null ? macAddress.hashCode() : 0); +// result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0); +// result = 31 * result + (status != null ? status.hashCode() : 0); +// result = 31 * result + (tempProbeKey != null ? tempProbeKey.hashCode() : 0); +// result = 31 * result + (createDate != null ? createDate.hashCode() : 0); +// result = 31 * result + (apiKey != null ? apiKey.hashCode() : 0); +// result = 31 * result + (int) (domainId ^ (domainId >>> 32)); +// result = 31 * result + (probeId != null ? probeId.hashCode() : 0); +// return result; +// } +} diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/type/AuthType.java b/src/main/java/com/loafle/overflow/module/noauthprobe/type/AuthType.java new file mode 100644 index 0000000..1d58a0f --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/type/AuthType.java @@ -0,0 +1,19 @@ +package com.loafle.overflow.module.noauthprobe.type; + +/** + * Created by root on 17. 5. 31. + */ +public enum AuthType { + A("ACCEPT"), + D("DENY"), + P("PROCESS"); + + private String stringValue; + AuthType(String string) {stringValue = string;} + + @Override + public String toString() { + return stringValue; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/probe/dao/ProbeDAO.java b/src/main/java/com/loafle/overflow/module/probe/dao/ProbeDAO.java new file mode 100644 index 0000000..0badb67 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/probe/dao/ProbeDAO.java @@ -0,0 +1,21 @@ +package com.loafle.overflow.module.probe.dao; + +import com.loafle.overflow.module.domain.model.Domain; +import com.loafle.overflow.module.probe.model.Probe; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +/** + * Created by insanity on 17. 5. 29. + */ +@Repository +public interface ProbeDAO extends JpaRepository { +// public List findAgentListByMemberId(Member member); + + Probe findByProbeKey(String probeKey); + + List findAllByDomain(Domain domain); +} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAO.java b/src/main/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAO.java new file mode 100644 index 0000000..ec1a14a --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/probe/dao/ProbeTaskDAO.java @@ -0,0 +1,17 @@ +package com.loafle.overflow.module.probe.dao; + +import com.loafle.overflow.module.probe.model.Probe; +import com.loafle.overflow.module.probe.model.ProbeTask; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * Created by snoop on 17. 6. 26. + */ +@Repository +public interface ProbeTaskDAO extends JpaRepository { + + List findAllByProbe(Probe probe); +} diff --git a/src/main/java/com/loafle/overflow/module/probe/model/Probe.java b/src/main/java/com/loafle/overflow/module/probe/model/Probe.java new file mode 100644 index 0000000..26164b0 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/probe/model/Probe.java @@ -0,0 +1,139 @@ +package com.loafle.overflow.module.probe.model; + +import com.loafle.overflow.module.domain.model.Domain; +import com.loafle.overflow.module.meta.model.MetaProbeStatus; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "PROBE", schema = "public", catalog = "postgres") +public class Probe { + private long id; + private MetaProbeStatus status; + private String description; + private Date createDate; + private Date lastPollingDate; + private Date nextPollingDate; + private Domain domain; + private String probeKey; + private String encryptionKey; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "STATUS", nullable = false) + public MetaProbeStatus getStatus() { + return status; + } + + public void setStatus(MetaProbeStatus status) { + this.status = status; + } + + + @Column(name = "DESCRIPTION", nullable = true, length = 50) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "LAST_POLLING_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getLastPollingDate() { + return lastPollingDate; + } + + public void setLastPollingDate(Date lastPollingDate) { + this.lastPollingDate = lastPollingDate; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "NEXT_POLLING_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + public Date getNextPollingDate() { + return nextPollingDate; + } + + public void setNextPollingDate(Date nextPollingDate) { + this.nextPollingDate = nextPollingDate; + } + + @ManyToOne + @JoinColumn(name = "DOMAIN_ID", nullable = false) + public Domain getDomain() { + return domain; + } + + public void setDomain(Domain domain) { + this.domain = domain; + } + + + @Column(name = "PROBE_KEY", nullable = false, unique = true) + public String getProbeKey() { + return probeKey; + } + + public void setProbeKey(String probeKey) { + this.probeKey = probeKey; + } + + + @Column(name = "ENCRYPTION_KEY", nullable = false, length = 50, unique = true) + public String getEncryptionKey() { + return encryptionKey; + } + + public void setEncryptionKey(String encryptionKey) { + this.encryptionKey = encryptionKey; + } + +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// Probe tblProbe = (Probe) o; +// +// if (id != tblProbe.id) return false; +// if (domain != tblProbe.domain) return false; +// if (status != null ? !status.equals(tblProbe.status) : tblProbe.status != null) return false; +// if (description != null ? !description.equals(tblProbe.description) : tblProbe.description != null) +// return false; +// if (createDate != null ? !createDate.equals(tblProbe.createDate) : tblProbe.createDate != null) return false; +// if (lastPollingDate != null ? !lastPollingDate.equals(tblProbe.lastPollingDate) : tblProbe.lastPollingDate != null) +// return false; +// if (nextPollingDate != null ? !nextPollingDate.equals(tblProbe.nextPollingDate) : tblProbe.nextPollingDate != null) +// return false; +// if (probeKey != null ? !probeKey.equals(tblProbe.probeKey) : tblProbe.probeKey != null) return false; +// if (encryptionKey != null ? !encryptionKey.equals(tblProbe.encryptionKey) : tblProbe.encryptionKey != null) +// return false; +// +// return true; +// } + +} diff --git a/src/main/java/com/loafle/overflow/module/probe/model/ProbeTask.java b/src/main/java/com/loafle/overflow/module/probe/model/ProbeTask.java new file mode 100644 index 0000000..8e49720 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/probe/model/ProbeTask.java @@ -0,0 +1,143 @@ +package com.loafle.overflow.module.probe.model; + + +import com.loafle.overflow.module.meta.model.MetaProbeTaskType; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "PROBE_TASK", schema = "public", catalog = "postgres") +public class ProbeTask { + private long id; + private MetaProbeTaskType metaProbeTaskType; + private Probe probe; + private String data; + private Date createDate; + private Date sendDate; + private Date startDate; + private Date endDate; + private Boolean succeed; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "TYPE_ID", nullable = false) + public MetaProbeTaskType getMetaProbeTaskType() { + return metaProbeTaskType; + } + + public void setMetaProbeTaskType(MetaProbeTaskType metaProbeTaskType) { + this.metaProbeTaskType = metaProbeTaskType; + } + + @ManyToOne + @JoinColumn(name = "PROBE_ID", nullable = false) + public Probe getProbe() { + return probe; + } + + public void setProbe(Probe probe) { + this.probe = probe; + } + + @Column(name = "DATA", nullable = true, length = 255) + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Column(name = "SEND_DATE", nullable = true) + public Date getSendDate() { + return sendDate; + } + + public void setSendDate(Date sendDate) { + this.sendDate = sendDate; + } + + @Column(name = "START_DATE", nullable = true) + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + @Column(name = "END_DATE", nullable = true) + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + @Column(name = "SUCCEED", nullable = true) + public Boolean getSucceed() { + return succeed; + } + + public void setSucceed(Boolean succeed) { + this.succeed = succeed; + } + +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// ProbeTask that = (ProbeTask) o; +// +// if (id != that.id) return false; +// if (typeId != that.typeId) return false; +// if (probeId != that.probeId) return false; +// if (data != null ? !data.equals(that.data) : that.data != null) return false; +// if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false; +// if (sendDate != null ? !sendDate.equals(that.sendDate) : that.sendDate != null) return false; +// if (startDate != null ? !startDate.equals(that.startDate) : that.startDate != null) return false; +// if (endDate != null ? !endDate.equals(that.endDate) : that.endDate != null) return false; +// if (succeed != null ? !succeed.equals(that.succeed) : that.succeed != null) return false; +// +// return true; +// } +// +// @Override +// public int hashCode() { +// int result = (int) (id ^ (id >>> 32)); +// result = 31 * result + (int) typeId; +// result = 31 * result + (int) (probeId ^ (probeId >>> 32)); +// result = 31 * result + (data != null ? data.hashCode() : 0); +// result = 31 * result + (createDate != null ? createDate.hashCode() : 0); +// result = 31 * result + (sendDate != null ? sendDate.hashCode() : 0); +// result = 31 * result + (startDate != null ? startDate.hashCode() : 0); +// result = 31 * result + (endDate != null ? endDate.hashCode() : 0); +// result = 31 * result + (succeed != null ? succeed.hashCode() : 0); +// return result; +// } +} diff --git a/src/main/java/com/loafle/overflow/module/probe/type/ProbeStatusType.java b/src/main/java/com/loafle/overflow/module/probe/type/ProbeStatusType.java new file mode 100644 index 0000000..1e4c602 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/probe/type/ProbeStatusType.java @@ -0,0 +1,18 @@ +package com.loafle.overflow.module.probe.type; + +/** + * Created by root on 17. 6. 23. + */ +public enum ProbeStatusType { + I("INITIAL"), + N("NORMAL"); + + + private String stringValue; + ProbeStatusType(String string) {stringValue = string;} + + @Override + public String toString() { + return stringValue; + } +} diff --git a/src/main/java/com/loafle/overflow/module/sensor/dao/SensorDAO.java b/src/main/java/com/loafle/overflow/module/sensor/dao/SensorDAO.java new file mode 100644 index 0000000..ef7b776 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/sensor/dao/SensorDAO.java @@ -0,0 +1,17 @@ +package com.loafle.overflow.module.sensor.dao; + + +import com.loafle.overflow.module.sensor.model.Sensor; +import com.loafle.overflow.module.target.model.Target; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * Created by root on 17. 6. 9. + */ +@Repository +public interface SensorDAO extends JpaRepository { + List findAllByTarget(Target target); +} diff --git a/src/main/java/com/loafle/overflow/module/sensor/dao/SensorItemDAO.java b/src/main/java/com/loafle/overflow/module/sensor/dao/SensorItemDAO.java new file mode 100644 index 0000000..196f62f --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/sensor/dao/SensorItemDAO.java @@ -0,0 +1,16 @@ +package com.loafle.overflow.module.sensor.dao; + +import com.loafle.overflow.module.sensor.model.Sensor; +import com.loafle.overflow.module.sensor.model.SensorItem; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * Created by root on 17. 6. 9. + */ +@Repository +public interface SensorItemDAO extends JpaRepository { + List findAllBySensor(Sensor sensor); +} diff --git a/src/main/java/com/loafle/overflow/module/sensor/model/Sensor.java b/src/main/java/com/loafle/overflow/module/sensor/model/Sensor.java new file mode 100644 index 0000000..65903d8 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/sensor/model/Sensor.java @@ -0,0 +1,95 @@ +package com.loafle.overflow.module.sensor.model; + +import com.loafle.overflow.module.meta.model.MetaCrawler; +import com.loafle.overflow.module.meta.model.MetaSensorStatus; +import com.loafle.overflow.module.target.model.Target; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "SENSOR", schema = "public", catalog = "postgres") +public class Sensor { + private long id; + private Date createDate; + private String description; + private MetaSensorStatus status; + private Target target; + private MetaCrawler crawler; + private String crawlerInputItems; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @Column(name = "DESCRIPTION", nullable = true, length = 50) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @ManyToOne + @JoinColumn(name = "STATUS") + public MetaSensorStatus getStatus() { + return status; + } + + public void setStatus(MetaSensorStatus status) { + this.status = status; + } + + @ManyToOne + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinColumn(name = "TARGET_ID", nullable = false) + public Target getTarget() { + return target; + } + + public void setTarget(Target target) { + this.target = target; + } + + @ManyToOne + @JoinColumn(name = "CRAWLER_ID", nullable = false) + public MetaCrawler getCrawler() { + return crawler; + } + + public void setCrawler(MetaCrawler crawler) { + this.crawler = crawler; + } + + @Column(name = "CRAWLER_INPUT_ITEMS", nullable = true, length = 50) + public String getCrawlerInputItems() { + return crawlerInputItems; + } + + public void setCrawlerInputItems(String crawlerInputItems) { + this.crawlerInputItems = crawlerInputItems; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/sensor/model/SensorItem.java b/src/main/java/com/loafle/overflow/module/sensor/model/SensorItem.java new file mode 100644 index 0000000..843d2c4 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/sensor/model/SensorItem.java @@ -0,0 +1,62 @@ +package com.loafle.overflow.module.sensor.model; + +import com.loafle.overflow.module.meta.model.MetaSensorItem; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "SENSOR_ITEM", schema = "public", catalog = "postgres") +public class SensorItem { + private long id; + private Sensor sensor; + private MetaSensorItem item; + private Date createDate; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @ManyToOne + @JoinColumn(name = "SENSOR_ID", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) + public Sensor getSensor() { + return this.sensor; + } + + public void setSensor(Sensor sensor) { + this.sensor = sensor; + } + + @ManyToOne + @JoinColumn(name = "ITEM_ID", nullable = false) + public MetaSensorItem getItem() { + return item; + } + + public void setItem(MetaSensorItem item) { + this.item = item; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/target/dao/TargetDAO.java b/src/main/java/com/loafle/overflow/module/target/dao/TargetDAO.java new file mode 100644 index 0000000..db22668 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/target/dao/TargetDAO.java @@ -0,0 +1,15 @@ +package com.loafle.overflow.module.target.dao; + +import com.loafle.overflow.module.probe.model.Probe; +import com.loafle.overflow.module.target.model.Target; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + + +/** + * Created by root on 17. 6. 5. + */ +public interface TargetDAO extends JpaRepository { + List findAllByProbe(Probe probe); +} diff --git a/src/main/java/com/loafle/overflow/module/target/model/Target.java b/src/main/java/com/loafle/overflow/module/target/model/Target.java new file mode 100644 index 0000000..c758ee7 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/target/model/Target.java @@ -0,0 +1,64 @@ +package com.loafle.overflow.module.target.model; + +import com.loafle.overflow.module.infra.model.Infra; +import com.loafle.overflow.module.probe.model.Probe; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "TARGET", schema = "public", catalog = "postgres") +public class Target { + + private long id; + private Date createDate; + private Probe probe; + private Infra infra; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + @ManyToOne + @JoinColumn(name = "PROBE_ID", nullable = false) + @OnDelete(action = OnDeleteAction.CASCADE) + public Probe getProbe() { + return probe; + } + + public void setProbe(Probe probe) { + this.probe = probe; + } + + @ManyToOne + @JoinColumn(name = "INFRA_ID", nullable = false) + public Infra getInfra() { + return infra; + } + + public void setInfra(Infra infra) { + this.infra = infra; + } + +} diff --git a/src/main/java/com/loafle/overflow/module/websocket/UiWebsocket.java b/src/main/java/com/loafle/overflow/module/websocket/UiWebsocket.java new file mode 100644 index 0000000..6ba781f --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/websocket/UiWebsocket.java @@ -0,0 +1,54 @@ +package com.loafle.overflow.module.websocket; + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by root on 17. 6. 22. + */ +@Entity +@Table(name = "UI_WEBSOCKET", schema = "public", catalog = "postgres") +public class UiWebsocket { + private long id; + private Date createDate; + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Basic + @Column(name = "CREATE_DATE", nullable = true) + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + 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; + } +} diff --git a/src/main/java/com/loafle/overflow/spring/AppConfig.java b/src/main/java/com/loafle/overflow/spring/AppConfig.java new file mode 100644 index 0000000..552e0bc --- /dev/null +++ b/src/main/java/com/loafle/overflow/spring/AppConfig.java @@ -0,0 +1,25 @@ +package com.loafle.overflow.spring; + +import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.io.ClassPathResource; + +/** + * Created by insanity on 17. 6. 13. + */ +@Configuration +@ComponentScan(basePackages = {"com.loafle.overflow"}, excludeFilters = @ComponentScan.Filter({Configuration.class})) +@PropertySource({"classpath:database.properties"}) +public class AppConfig { + @Bean + public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { + PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); + ppc.setLocation(new ClassPathResource("database.properties")); + ppc.setIgnoreUnresolvablePlaceholders(true); + + return ppc; + } +} diff --git a/src/main/java/com/loafle/overflow/spring/JdbcConfiguration.java b/src/main/java/com/loafle/overflow/spring/JdbcConfiguration.java new file mode 100644 index 0000000..b22498d --- /dev/null +++ b/src/main/java/com/loafle/overflow/spring/JdbcConfiguration.java @@ -0,0 +1,95 @@ +package com.loafle.overflow.spring; + +import org.hibernate.cfg.Environment; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.jdbc.datasource.init.DataSourceInitializer; +import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.transaction.annotation.TransactionManagementConfigurer; + +import javax.persistence.EntityManager; +import javax.sql.DataSource; +import java.util.Properties; + + +/** + * Created by root on 17. 6. 13. + */ +@Configuration +@EnableTransactionManagement +@EnableJpaRepositories(basePackages = {"com.loafle.overflow"}) +public class JdbcConfiguration implements TransactionManagementConfigurer { + @Value("${datasource.driver-class-name}") + private String driver; + @Value("${datasource.url}") + private String url; + @Value("${datasource.username}") + private String username; + @Value("${datasource.password}") + private String password; + @Value("${jpa.hibernate.dialect}") + private String dialect; + @Value("${jpa.hibernate.ddl-auto}") + private String hbm2ddlAuto; + + @Bean + public DataSource configureDataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(driver); + dataSource.setUrl(url); + dataSource.setUsername(username); + dataSource.setPassword(password); + return dataSource; + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); + entityManagerFactoryBean.setDataSource(configureDataSource()); + entityManagerFactoryBean.setPackagesToScan("com.loafle.overflow"); + entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); + + Properties jpaProperties = new Properties(); + jpaProperties.put(Environment.DIALECT, dialect); + jpaProperties.put(Environment.HBM2DDL_AUTO, hbm2ddlAuto); + jpaProperties.put(Environment.SHOW_SQL, true); + + entityManagerFactoryBean.setJpaProperties(jpaProperties); + + return entityManagerFactoryBean; + } + + @Bean + @Qualifier(value = "transactionManager") + public PlatformTransactionManager annotationDrivenTransactionManager() { + return new JpaTransactionManager(); + } + + @Bean + public EntityManager entityManager() { + return entityManagerFactory().getObject().createEntityManager(); + } + + @Bean + public DataSourceInitializer dataSourceInitializer(DataSource dataSource) { + ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator(); + databasePopulator.addScript(new ClassPathResource("/init.sql")); + databasePopulator.setIgnoreFailedDrops(true); + + DataSourceInitializer initializer = new DataSourceInitializer(); + initializer.setDataSource(dataSource); + initializer.setDatabasePopulator(databasePopulator); + + return initializer; + } +} diff --git a/src/main/proto/grpc.proto b/src/main/proto/grpc.proto new file mode 100644 index 0000000..112553a --- /dev/null +++ b/src/main/proto/grpc.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "com.loafle.overflow.server.api"; +option java_generic_services = true; + +message DBInput { + string targetDao = 1; + string method = 2; + map params = 3; +} + +message DBOutput { + string result = 1; +} + +service DB { + rpc exec(DBInput) returns (DBOutput) {} +} + diff --git a/src/main/resources/_ b/src/main/resources/_ new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/database.properties b/src/main/resources/database.properties new file mode 100644 index 0000000..fc3beda --- /dev/null +++ b/src/main/resources/database.properties @@ -0,0 +1,11 @@ +datasource.url=jdbc:postgresql://192.168.1.103:5432/overflow +datasource.username=overflow +datasource.password=qwer5795 +datasource.driver-class-name=org.postgresql.Driver + +jpa.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +jpa.database=postgresql +jpa.hibernate.ddl-auto=create +#jpa.hibernate.ddl-auto=update +jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy +jpa.show-sql=true diff --git a/src/main/resources/init.sql b/src/main/resources/init.sql new file mode 100644 index 0000000..9b2079c --- /dev/null +++ b/src/main/resources/init.sql @@ -0,0 +1,281 @@ +INSERT INTO public.meta_member_status (id,"name") VALUES ( +1,'NOAUTH'); +INSERT INTO public.meta_member_status (id,"name") VALUES ( +2,'NORMAL'); +INSERT INTO public.meta_member_status (id,"name") VALUES ( +3,'DIAPAUSE'); +INSERT INTO public.meta_member_status (id,"name") VALUES ( +4,'WITHDRAWAL'); + +INSERT INTO public.meta_infra_type (id,create_date,"name") VALUES ( +1,'2017-06-25 17:31:42.770','MACHINE'); +INSERT INTO public.meta_infra_type (id,create_date,"name") VALUES ( +2,'2017-06-25 17:31:42.894','HOST'); +INSERT INTO public.meta_infra_type (id,create_date,"name") VALUES ( +3,'2017-06-25 17:31:42.906','OS'); +INSERT INTO public.meta_infra_type (id,create_date,"name") VALUES ( +4,'2017-06-25 17:31:42.906','OS_APPLICATION'); +INSERT INTO public.meta_infra_type (id,create_date,"name") VALUES ( +5,'2017-06-25 17:31:42.906','OS_DAEMON'); +INSERT INTO public.meta_infra_type (id,create_date,"name") VALUES ( +6,'2017-06-25 17:31:42.906','OS_PORT'); +INSERT INTO public.meta_infra_type (id,create_date,"name") VALUES ( +7,'2017-06-25 17:31:42.906','OS_SERVICE'); + + +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +1,'2017-06-25 17:31:42.916','APPLE',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +2,'2017-06-25 17:31:42.937','MICROSOFT',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +3,'2017-06-25 17:31:42.949','ASUS',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +4,'2017-06-25 17:31:42.960','HP',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +5,'2017-06-25 17:31:42.972','DELL',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +6,'2017-06-25 17:31:42.982','LENOVO',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +7,'2017-06-25 17:31:42.993','ACER',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +8,'2017-06-25 17:31:43.004','SAMSUNG',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +9,'2017-06-25 17:31:43.023','LG',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +10,'2017-06-25 17:31:43.036','CISCO',1); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +11,'2017-06-25 17:31:43.052','Windows',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +12,'2017-06-25 17:31:43.070','Mac OS',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +13,'2017-06-25 17:31:43.084','Ubuntu',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +14,'2017-06-25 17:31:43.102','Cent OS',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +15,'2017-06-25 17:31:43.116','Fedora',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +16,'2017-06-25 17:31:43.130','Red Hat',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +17,'2017-06-25 17:31:43.144','Debian',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +18,'2017-06-25 17:31:43.156','SUSE',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +19,'2017-06-25 17:31:43.169','Core OS',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +20,'2017-06-25 17:31:43.181','Amazon Linux',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +21,'2017-06-25 17:31:43.192','Kubernetes',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +22,'2017-06-25 17:31:43.202','Docker',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +23,'2017-06-25 17:31:43.214','iOS',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +24,'2017-06-25 17:31:43.229','Android',2); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +25,'2017-06-25 17:31:43.242','Windows',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +26,'2017-06-25 17:31:43.255','Mac OS',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +27,'2017-06-25 17:31:43.271','Ubuntu',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +28,'2017-06-25 17:31:43.285','Cent OS',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +29,'2017-06-25 17:31:43.298','Fedora',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +30,'2017-06-25 17:31:43.312','Red Hat',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +31,'2017-06-25 17:31:43.324','Debian',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +32,'2017-06-25 17:31:43.336','SUSE',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +33,'2017-06-25 17:31:43.347','Core OS',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +34,'2017-06-25 17:31:43.361','Amazon Linux',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +35,'2017-06-25 17:31:43.375','Kubernetes',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +36,'2017-06-25 17:31:43.387','Docker',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +37,'2017-06-25 17:31:43.399','iOS',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +38,'2017-06-25 17:31:43.410','Android',3); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +39,'2017-06-26 20:59:36.255','MySql',7); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +40,'2017-06-26 20:59:36.364','PostgreSQL',7); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +41,'2017-06-26 20:59:36.385','WMI',7); +INSERT INTO public.meta_infra_vendor (id,create_date,"name",type_id) VALUES ( +42,'2017-06-26 20:59:36.414','SNMP_V2',7); + +INSERT INTO public.meta_crawler (id,create_date,description,"name") VALUES ( +1,'2017-06-25 17:00:43.869','WMI','WMI_CRAWLER'); +INSERT INTO public.meta_crawler (id,create_date,description,"name") VALUES ( +2,'2017-06-25 17:00:43.919','SNMPV2','SNMP_V2_CRAWLER'); +INSERT INTO public.meta_crawler (id,create_date,description,"name") VALUES ( +3,'2017-06-25 17:00:43.941','SNMPV3','SNMP_V3_CRAWLER'); +INSERT INTO public.meta_crawler (id,create_date,description,"name") VALUES ( +4,'2017-06-25 17:00:43.969','MYSQL','MYSQL_CRAWLER'); + +INSERT INTO public.meta_input_type (id,create_date,description,"name") VALUES ( +1,'2017-06-25 17:00:53.861','TEXT','TEXT_TYPE'); +INSERT INTO public.meta_input_type (id,create_date,description,"name") VALUES ( +2,'2017-06-25 17:00:53.893','PASSWORD','PASSWORD_TYPE'); +INSERT INTO public.meta_input_type (id,create_date,description,"name") VALUES ( +3,'2017-06-25 17:00:53.901','NUMBER','NUMBER_TYPE'); +INSERT INTO public.meta_input_type (id,create_date,description,"name") VALUES ( +4,'2017-06-25 17:00:53.910','BOOLEAN','BOOLEAN_TYPE'); +INSERT INTO public.meta_input_type (id,create_date,description,"name") VALUES ( +5,'2017-06-25 17:00:53.920','SELECT','SELECT_TYPE'); + + +INSERT INTO public.meta_crawler_input_item (id,create_date,default_value,description,key_name,key_value,"name",pattern,required,crawler_id,type_id) VALUES ( +1,'2017-06-25 17:01:01.961','Loafle','Windows Account ID',NULL,NULL,'ID','',true,1,1); +INSERT INTO public.meta_crawler_input_item (id,create_date,default_value,description,key_name,key_value,"name",pattern,required,crawler_id,type_id) VALUES ( +2,'2017-06-25 17:01:02.008','','Windows Account PW',NULL,NULL,'PassWord','',true,1,2); +INSERT INTO public.meta_crawler_input_item (id,create_date,default_value,description,key_name,key_value,"name",pattern,required,crawler_id,type_id) VALUES ( +3,'2017-06-25 17:01:02.023','public','SNMP V2 Community',NULL,NULL,'Community','',true,2,1); +INSERT INTO public.meta_crawler_input_item (id,create_date,default_value,description,key_name,key_value,"name",pattern,required,crawler_id,type_id) VALUES ( +4,'2017-06-25 17:01:02.046','mysqldb','MYSQL DB Name',NULL,NULL,'DB Name','',true,4,1); +INSERT INTO public.meta_crawler_input_item (id,create_date,default_value,description,key_name,key_value,"name",pattern,required,crawler_id,type_id) VALUES ( +5,'2017-06-25 17:01:02.067','Loafle','MYSQL Account ID',NULL,NULL,'ID','',true,4,1); +INSERT INTO public.meta_crawler_input_item (id,create_date,default_value,description,key_name,key_value,"name",pattern,required,crawler_id,type_id) VALUES ( +6,'2017-06-25 17:01:02.078','','MYSQL Account PW',NULL,NULL,'PassWord','',true,4,2); + +INSERT INTO public.meta_probe_architecture (id,architecture,create_date) VALUES ( +1,'x86-64bit','2017-06-25 16:48:15.317'); +INSERT INTO public.meta_probe_architecture (id,architecture,create_date) VALUES ( +2,NULL,'2017-06-25 16:48:15.350'); + +INSERT INTO public.meta_probe_os (id,create_date,"name") VALUES ( +1,'2017-06-25 16:48:28.617','Windows'); +INSERT INTO public.meta_probe_os (id,create_date,"name") VALUES ( +2,'2017-06-25 16:48:28.683','Debian'); +INSERT INTO public.meta_probe_os (id,create_date,"name") VALUES ( +3,'2017-06-25 16:48:28.699','Ubuntu'); +INSERT INTO public.meta_probe_os (id,create_date,"name") VALUES ( +4,'2017-06-25 16:48:28.708','Fedora'); + + +INSERT INTO public.meta_probe_version (id,create_date,"version") VALUES ( +1,'2017-06-25 16:48:00.520','1.0.0'); +INSERT INTO public.meta_probe_version (id,create_date,"version") VALUES ( +2,'2017-06-25 16:48:00.558','1.1.0'); + + +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +1,'2017-06-25 16:59:59.194',1,1,1); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +2,'2017-06-25 16:59:59.216',1,2,1); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +3,'2017-06-25 16:59:59.255',1,3,1); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +4,'2017-06-25 16:59:59.268',1,4,1); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +5,'2017-06-25 16:59:59.279',2,1,1); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +6,'2017-06-25 16:59:59.307',2,2,1); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +7,'2017-06-25 16:59:59.317',2,3,1); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +8,'2017-06-25 16:59:59.330',2,4,1); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +9,'2017-06-25 16:59:59.363',1,1,2); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +10,'2017-06-25 16:59:59.395',1,2,2); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +11,'2017-06-25 16:59:59.416',1,3,2); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +12,'2017-06-25 16:59:59.446',1,4,2); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +13,'2017-06-25 16:59:59.468',2,1,2); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +14,'2017-06-25 16:59:59.484',2,2,2); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +15,'2017-06-25 16:59:59.507',2,3,2); +INSERT INTO public.meta_probe_package (id,create_date,architecture_id,os_id,version_id) VALUES ( +16,'2017-06-25 16:59:59.522',2,4,2); + +INSERT INTO public.meta_probe_status (id,"name") VALUES ( +1,'INITIAL'); +INSERT INTO public.meta_probe_status (id,"name") VALUES ( +2,'NORMAL'); + +INSERT INTO public.meta_noauth_probe_status (id,"name") VALUES ( +1,'ACCEPT'); +INSERT INTO public.meta_noauth_probe_status (id,"name") VALUES ( +2,'DENY'); +INSERT INTO public.meta_noauth_probe_status (id,"name") VALUES ( +3,'PROCESS'); + +INSERT INTO public.meta_probe_task_type (id,create_date,description,"name") VALUES ( +1,'2017-06-26 15:58:02.397','DISCOVERY START','DISCOVERY'); + +INSERT INTO public.meta_sensor_status (id,"name") VALUES ( +1,'RUNNING'); +INSERT INTO public.meta_sensor_status (id,"name") VALUES ( +2,'STOPPED'); + +INSERT INTO public.meta_sensor_item_type (id,create_date,description,"name") VALUES ( +1,'2017-06-26 19:49:39.690','CPU blah blah blah','CPU'); +INSERT INTO public.meta_sensor_item_type (id,create_date,description,"name") VALUES ( +2,'2017-06-26 19:49:39.811','MEMORY blah blah blah','MEMORY'); +INSERT INTO public.meta_sensor_item_type (id,create_date,description,"name") VALUES ( +3,'2017-06-26 19:49:39.824','DISK blah blah blah','DISK'); + +INSERT INTO public.meta_sensor_item (id,create_date,"key","name",type_id) VALUES ( +1,'2017-06-26 20:10:08.269','cpu.usage','CPU USAGE',1); +INSERT INTO public.meta_sensor_item (id,create_date,"key","name",type_id) VALUES ( +2,'2017-06-26 20:10:08.361','cpu.free','CPU FREE',1); +INSERT INTO public.meta_sensor_item (id,create_date,"key","name",type_id) VALUES ( +3,'2017-06-26 20:10:08.376','mem.usage','MEMORY USAGE',2); +INSERT INTO public.meta_sensor_item (id,create_date,"key","name",type_id) VALUES ( +4,'2017-06-26 20:10:08.394','mem.free','MEMORY FREE',2); + +-- +-- +-- +-- +-- +INSERT INTO public."member" (id,company_name,create_date,email,"name",phone,pw,pw_salt,status_id) VALUES ( +1,'loafle','2017-06-26 11:07:27.625','overflow@loafle.com','overFlow','000-000-0000','qwer5795','abcdabcdabcdabcd',2); + +INSERT INTO public."member" (id,company_name,create_date,email,"name",phone,pw,pw_salt,status_id) VALUES ( +2,'loafle','2017-06-26 11:07:27.625','geek@loafle.com','geek','000-000-0000','qwer5795','abcdabcdabcdabcd',1); + +INSERT INTO public.email_auth (id,auth_confirm_date,create_date,email_auth_key,member_id) VALUES ( +1,NULL,'2017-06-26 15:28:48.895','dbseogns1234',1); + +INSERT INTO public."domain" (id,create_date,"name") VALUES ( +1,'2017-06-26 11:25:44.866','overFlow''s domain'); + +INSERT INTO public.domain_member (id,create_date,domain_id,member_id) VALUES ( +1,'2017-06-26 11:27:43.023',1,1); + +INSERT INTO public.api_key (id,api_key,create_date,domain_id) VALUES ( +1,'52abd6fd57e511e7ac52080027658d13','2017-06-26 13:02:28.347',1); + +INSERT INTO public.noauth_probe (id,api_key,create_date,host_name,ip_address,mac_address,temp_probe_key,domain_id,probe_id,status) VALUES ( +1,'52abd6fd57e511e7ac52080027658d13','2017-06-26 12:43:46.877','snoop',3232235980,8796753988883,'1cf2555c57d511e79714080027658d13',1,NULL,3); + +INSERT INTO public.probe (id,create_date,description,encryption_key,last_polling_date,next_polling_date,probe_key,domain_id,status) VALUES ( +1,'2017-06-26 12:44:59.813','snoop probe','9c8d41ab57de11e7a2c9080027658d13',NULL,NULL,'a1e1710557de11e78799080027658d13',1,1); + +INSERT INTO public.infra_machine (id,create_date,meta,probe_id) VALUES ( +0,'2017-06-26 12:12:11.698',NULL,1); + +INSERT INTO public.infra (id,child_id,create_date,type_id) VALUES ( +1,0,'2017-06-26 12:12:11.809',1); + +INSERT INTO public.target (id,create_date,infra_id,probe_id) VALUES ( +1,'2017-06-26 12:37:22.854',1,1); + +INSERT INTO public.sensor (id,crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES ( +1,NULL,'2017-06-26 20:19:07.009','My sensor',1,1,1); +INSERT INTO public.sensor (id,crawler_input_items,create_date,description,crawler_id,status,target_id) VALUES ( +2,NULL,'2017-06-26 20:19:07.074','My sensor',1,1,1); + +INSERT INTO public.sensor_item (id,create_date,item_id,sensor_id) VALUES ( +1,'2017-06-26 20:21:16.626',1,1); +INSERT INTO public.sensor_item (id,create_date,item_id,sensor_id) VALUES ( +2,'2017-06-26 20:21:50.988',2,2); \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/OFMainTest.java b/src/test/java/com/loafle/overflow/OFMainTest.java new file mode 100644 index 0000000..b0ad6d2 --- /dev/null +++ b/src/test/java/com/loafle/overflow/OFMainTest.java @@ -0,0 +1,14 @@ + +package com.loafle.overflow; +import static org.junit.Assert.*; + +import org.junit.Ignore; +import org.junit.Test; + +@Ignore +public class OFMainTest { + @Test + public void testSum() { + fail("Not yet implemented"); + } +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/module/member/dao/MemberDAOTest.java b/src/test/java/com/loafle/overflow/module/member/dao/MemberDAOTest.java new file mode 100644 index 0000000..9ffaeb9 --- /dev/null +++ b/src/test/java/com/loafle/overflow/module/member/dao/MemberDAOTest.java @@ -0,0 +1,49 @@ +package com.loafle.overflow.module.member.dao; + +import com.loafle.overflow.module.member.model.Member; +import com.loafle.overflow.module.meta.model.MetaMemberStatus; +import com.loafle.overflow.spring.AppConfig; +import com.loafle.overflow.spring.JdbcConfiguration; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import static org.junit.Assert.*; + +/** + * Created by geek on 17. 6. 28. + */ + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class}) +public class MemberDAOTest { + + @Autowired + private MemberDAO repo; + + @Test + public void createMember() { + Member m = new Member(); + + m.setName("insanity2"); + m.setCompanyName("loafle"); + m.setPw("bbbbbbbbb"); + m.setPwSalt("salktttt"); + m.setPhone("000-000-0000"); + m.setEmail("insanity111@loafle.com"); + m.setStatus(new MetaMemberStatus((short)1)); + repo.save(m); + } + + @Test + public void findByEmail() throws Exception { + Member member = new Member(1); + member.setEmail("overflow@loafle.com"); + + Member rr = repo.findByEmail(member); + System.out.println("rr.getCompanyName() = " + rr.getCompanyName()); + } + +} \ No newline at end of file diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml new file mode 100644 index 0000000..ee3d43d --- /dev/null +++ b/src/test/resources/logback.xml @@ -0,0 +1,17 @@ + + + overflow_server + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{32} - %msg%n + + + + + + + + + \ No newline at end of file