From 2cf647d6a86a9828393157c08d5f92af74aaeff9 Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 22 Jun 2017 20:39:17 +0900 Subject: [PATCH] fixed meta --- .../overflow/meta/MetaCrawlerInputItem.java | 122 ++++++++++-------- .../overflow/meta/MetaSensorItemType.java | 11 +- .../overflow/meta/MetaVendorCrawler.java | 105 +++++++++------ .../meta/MetaVendorCrawlerSensorItem.java | 120 ++++++++++------- 4 files changed, 211 insertions(+), 147 deletions(-) diff --git a/src/main/java/com/loafle/overflow/meta/MetaCrawlerInputItem.java b/src/main/java/com/loafle/overflow/meta/MetaCrawlerInputItem.java index 17a2c6b..ab88d9a 100644 --- a/src/main/java/com/loafle/overflow/meta/MetaCrawlerInputItem.java +++ b/src/main/java/com/loafle/overflow/meta/MetaCrawlerInputItem.java @@ -11,8 +11,8 @@ import java.util.Date; @Table(name = "TBL_META_CRAWLER_INPUT_ITEM", schema = "public", catalog = "postgres") public class MetaCrawlerInputItem { private int id; - private short typeId; - private short crawlerId; + private MetaInputType metaInputType; + private MetaCrawler metaCrawler; private String desc; private String name; private Date createDate; @@ -32,24 +32,44 @@ public class MetaCrawlerInputItem { this.id = id; } - @Basic - @Column(name = "TYPE_ID", nullable = false) - public short getTypeId() { - return typeId; +// @Basic +// @Column(name = "TYPE_ID", nullable = false) +// public short getTypeId() { +// return typeId; +// } +// +// public void setTypeId(short typeId) { +// this.typeId = typeId; +// } +// +// @Basic +// @Column(name = "CRAWLER_ID", nullable = false) +// public short getCrawlerId() { +// return crawlerId; +// } +// +// public void setCrawlerId(short crawlerId) { +// this.crawlerId = crawlerId; +// } + + @ManyToOne + @JoinColumn(name = "TYPE_ID", nullable = false) + public MetaInputType getMetaInputType() { + return metaInputType; } - public void setTypeId(short typeId) { - this.typeId = typeId; + public void setMetaInputType(MetaInputType metaInputType) { + this.metaInputType = metaInputType; } - @Basic - @Column(name = "CRAWLER_ID", nullable = false) - public short getCrawlerId() { - return crawlerId; + @ManyToOne + @JoinColumn(name = "CRAWLER_ID", nullable = false) + public MetaCrawler getMetaCrawler() { + return metaCrawler; } - public void setCrawlerId(short crawlerId) { - this.crawlerId = crawlerId; + public void setMetaCrawler(MetaCrawler metaCrawler) { + this.metaCrawler = metaCrawler; } @Column(name = "DESC", nullable = true, length = 50) @@ -129,41 +149,41 @@ public class MetaCrawlerInputItem { 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; - } +// @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/meta/MetaSensorItemType.java b/src/main/java/com/loafle/overflow/meta/MetaSensorItemType.java index a4977d9..dd629b5 100644 --- a/src/main/java/com/loafle/overflow/meta/MetaSensorItemType.java +++ b/src/main/java/com/loafle/overflow/meta/MetaSensorItemType.java @@ -2,6 +2,7 @@ package com.loafle.overflow.meta; import javax.persistence.*; import java.sql.Timestamp; +import java.util.Date; /** * Created by root on 17. 6. 22. @@ -12,10 +13,10 @@ public class MetaSensorItemType { private short id; private String name; private String desc; - private Timestamp createDate; + private Date createDate; @Id - @Column(name = "ID", nullable = false) + @GeneratedValue(strategy= GenerationType.IDENTITY) public short getId() { return id; } @@ -44,13 +45,13 @@ public class MetaSensorItemType { this.desc = desc; } - @Basic + @Temporal(TemporalType.TIMESTAMP) @Column(name = "CREATE_DATE", nullable = false) - public Timestamp getCreateDate() { + public Date getCreateDate() { return createDate; } - public void setCreateDate(Timestamp createDate) { + public void setCreateDate(Date createDate) { this.createDate = createDate; } diff --git a/src/main/java/com/loafle/overflow/meta/MetaVendorCrawler.java b/src/main/java/com/loafle/overflow/meta/MetaVendorCrawler.java index 62d79ab..60eee5a 100644 --- a/src/main/java/com/loafle/overflow/meta/MetaVendorCrawler.java +++ b/src/main/java/com/loafle/overflow/meta/MetaVendorCrawler.java @@ -2,6 +2,7 @@ package com.loafle.overflow.meta; import javax.persistence.*; import java.sql.Timestamp; +import java.util.Date; /** * Created by root on 17. 6. 22. @@ -10,12 +11,12 @@ import java.sql.Timestamp; @Table(name = "TBL_META_VENDOR_CRAWLER", schema = "public", catalog = "postgres") public class MetaVendorCrawler { private int id; - private short crawlerId; - private int vendorId; - private Timestamp createDate; + private MetaCrawler metaCrawler; + private MetaInfraVendor metaInfraVendor; + private Date createDate; @Id - @Column(name = "ID", nullable = false) + @GeneratedValue(strategy= GenerationType.IDENTITY) public int getId() { return id; } @@ -24,57 +25,77 @@ public class MetaVendorCrawler { this.id = id; } - @Basic - @Column(name = "CRAWLER_ID", nullable = false) - public short getCrawlerId() { - return crawlerId; + @ManyToOne + @JoinColumn(name = "CRAWLER_ID", nullable = false) + public MetaCrawler getMetaCrawler() { + return metaCrawler; } - public void setCrawlerId(short crawlerId) { - this.crawlerId = crawlerId; + public void setMetaCrawler(MetaCrawler metaCrawler) { + this.metaCrawler = metaCrawler; } - @Basic - @Column(name = "VENDOR_ID", nullable = false) - public int getVendorId() { - return vendorId; + @ManyToOne + @JoinColumn(name = "VENDOR_ID", nullable = false) + public MetaInfraVendor getMetaInfraVendor() { + return metaInfraVendor; } - public void setVendorId(int vendorId) { - this.vendorId = vendorId; + public void setMetaInfraVendor(MetaInfraVendor metaInfraVendor) { + this.metaInfraVendor = metaInfraVendor; } - @Basic + // @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 Timestamp getCreateDate() { + public Date getCreateDate() { return createDate; } - public void setCreateDate(Timestamp 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; - - MetaVendorCrawler that = (MetaVendorCrawler) o; - - if (id != that.id) return false; - if (crawlerId != that.crawlerId) return false; - if (vendorId != that.vendorId) 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 + (int) crawlerId; - result = 31 * result + vendorId; - result = 31 * result + (createDate != null ? createDate.hashCode() : 0); - return result; - } +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// MetaVendorCrawler that = (MetaVendorCrawler) o; +// +// if (id != that.id) return false; +// if (crawlerId != that.crawlerId) return false; +// if (vendorId != that.vendorId) 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 + (int) crawlerId; +// result = 31 * result + vendorId; +// result = 31 * result + (createDate != null ? createDate.hashCode() : 0); +// return result; +// } } diff --git a/src/main/java/com/loafle/overflow/meta/MetaVendorCrawlerSensorItem.java b/src/main/java/com/loafle/overflow/meta/MetaVendorCrawlerSensorItem.java index 964a255..6f4ae4c 100644 --- a/src/main/java/com/loafle/overflow/meta/MetaVendorCrawlerSensorItem.java +++ b/src/main/java/com/loafle/overflow/meta/MetaVendorCrawlerSensorItem.java @@ -2,6 +2,7 @@ package com.loafle.overflow.meta; import javax.persistence.*; import java.sql.Timestamp; +import java.util.Date; /** * Created by root on 17. 6. 22. @@ -12,13 +13,13 @@ public class MetaVendorCrawlerSensorItem { private long id; private String interval; private String warnCondition; - private Timestamp createDate; - private int itemId; - private int vendorId; + private Date createDate; + private MetaSensorItem metaSensorItem; + private MetaInfraVendor metaInfraVendor; private short crawlerId; @Id - @Column(name = "ID", nullable = false) + @GeneratedValue(strategy= GenerationType.IDENTITY) public long getId() { return id; } @@ -47,34 +48,55 @@ public class MetaVendorCrawlerSensorItem { this.warnCondition = warnCondition; } - @Basic + @Temporal(TemporalType.TIMESTAMP) @Column(name = "CREATE_DATE", nullable = false) - public Timestamp getCreateDate() { + public Date getCreateDate() { return createDate; } - public void setCreateDate(Timestamp createDate) { + public void setCreateDate(Date createDate) { this.createDate = createDate; } - @Basic - @Column(name = "ITEM_ID", nullable = false) - public int getItemId() { - return itemId; +// @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 setItemId(int itemId) { - this.itemId = itemId; + public void setMetaSensorItem(MetaSensorItem metaSensorItem) { + this.metaSensorItem = metaSensorItem; } - @Basic - @Column(name = "VENDOR_ID", nullable = false) - public int getVendorId() { - return vendorId; + @ManyToOne + @JoinColumn(name = "VENDOR_ID", nullable = false) + public MetaInfraVendor getMetaInfraVendor() { + return metaInfraVendor; } - public void setVendorId(int vendorId) { - this.vendorId = vendorId; + public void setMetaInfraVendor(MetaInfraVendor metaInfraVendor) { + this.metaInfraVendor = metaInfraVendor; } @Basic @@ -87,34 +109,34 @@ public class MetaVendorCrawlerSensorItem { this.crawlerId = crawlerId; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - MetaVendorCrawlerSensorItem that = (MetaVendorCrawlerSensorItem) o; - - if (id != that.id) return false; - if (itemId != that.itemId) return false; - if (vendorId != that.vendorId) return false; - if (crawlerId != that.crawlerId) return false; - if (interval != null ? !interval.equals(that.interval) : that.interval != null) return false; - if (warnCondition != null ? !warnCondition.equals(that.warnCondition) : that.warnCondition != null) - 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 + (interval != null ? interval.hashCode() : 0); - result = 31 * result + (warnCondition != null ? warnCondition.hashCode() : 0); - result = 31 * result + (createDate != null ? createDate.hashCode() : 0); - result = 31 * result + itemId; - result = 31 * result + vendorId; - result = 31 * result + (int) crawlerId; - return result; - } +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// MetaVendorCrawlerSensorItem that = (MetaVendorCrawlerSensorItem) o; +// +// if (id != that.id) return false; +// if (itemId != that.itemId) return false; +// if (vendorId != that.vendorId) return false; +// if (crawlerId != that.crawlerId) return false; +// if (interval != null ? !interval.equals(that.interval) : that.interval != null) return false; +// if (warnCondition != null ? !warnCondition.equals(that.warnCondition) : that.warnCondition != null) +// 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 + (interval != null ? interval.hashCode() : 0); +// result = 31 * result + (warnCondition != null ? warnCondition.hashCode() : 0); +// result = 31 * result + (createDate != null ? createDate.hashCode() : 0); +// result = 31 * result + itemId; +// result = 31 * result + vendorId; +// result = 31 * result + (int) crawlerId; +// return result; +// } }