This commit is contained in:
insanity 2017-06-22 18:34:27 +09:00
parent d8292155ae
commit 0fe21027fb
10 changed files with 158 additions and 178 deletions

View File

@ -1,54 +0,0 @@
package com.loafle.overflow.models;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* Created by root on 17. 6. 22.
*/
@Entity
@Table(name = "TBL_DOMAIN_MEMBER", schema = "public", catalog = "postgres")
public class TblDomainMember {
private long id;
private Timestamp createDate;
@Id
@Column(name = "ID", nullable = false)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Basic
@Column(name = "CREATE_DATE", nullable = false)
public Timestamp getCreateDate() {
return createDate;
}
public void setCreateDate(Timestamp createDate) {
this.createDate = createDate;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TblDomainMember that = (TblDomainMember) 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;
}
}

View File

@ -1,82 +0,0 @@
package com.loafle.overflow.module.agent.model;
import com.loafle.overflow.module.member.model.Member;
import javax.persistence.*;
import java.io.Serializable;
/**
* Created by insanity on 17. 5. 29.
*/
@Entity(name="AGENT")
public class Agent implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "MEMBER_ID", nullable=false)
private Member member;
@Column(name="AUTHORIZED_DATE")
private Long authorizedDate;
@Column(name="DESCRIPTION")
private String description;
@Column(name="LAST_POLLING_DATE")
private Long lastPollingDate;
@Column(name="STATUS")
private String status;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Member getMember() {
return member;
}
public void setMember(Member member) {
this.member = member;
}
public Long getAuthorizedDate() {
return authorizedDate;
}
public void setAuthorizedDate(Long authorizedDate) {
this.authorizedDate = authorizedDate;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getLastPollingDate() {
return lastPollingDate;
}
public void setLastPollingDate(Long lastPollingDate) {
this.lastPollingDate = lastPollingDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

View File

@ -1,4 +1,4 @@
package com.loafle.overflow.models; package com.loafle.overflow.module.domain;
import javax.persistence.*; import javax.persistence.*;
import java.sql.Timestamp; import java.sql.Timestamp;
@ -8,13 +8,13 @@ import java.sql.Timestamp;
*/ */
@Entity @Entity
@Table(name = "TBL_DOMAIN", schema = "public", catalog = "postgres") @Table(name = "TBL_DOMAIN", schema = "public", catalog = "postgres")
public class TblDomain { public class Domain {
private long id; private long id;
private String name; private String name;
private Timestamp createDate; private Timestamp createDate;
@Id @Id
@Column(name = "ID", nullable = false) @GeneratedValue(strategy= GenerationType.IDENTITY)
public long getId() { public long getId() {
return id; return id;
} }
@ -34,7 +34,7 @@ public class TblDomain {
} }
@Basic @Basic
@Column(name = "CREATE_DATE", nullable = true) @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Timestamp getCreateDate() { public Timestamp getCreateDate() {
return createDate; return createDate;
} }
@ -48,7 +48,7 @@ public class TblDomain {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null || getClass() != o.getClass()) return false;
TblDomain tblDomain = (TblDomain) o; Domain tblDomain = (Domain) o;
if (id != tblDomain.id) return false; if (id != tblDomain.id) return false;
if (name != null ? !name.equals(tblDomain.name) : tblDomain.name != null) return false; if (name != null ? !name.equals(tblDomain.name) : tblDomain.name != null) return false;
@ -56,12 +56,4 @@ public class TblDomain {
return true; return true;
} }
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
return result;
}
} }

View File

@ -0,0 +1,35 @@
package com.loafle.overflow.module.domain;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* Created by root on 17. 6. 22.
*/
@Entity
@Table(name = "TBL_DOMAIN_MEMBER", schema = "public", catalog = "postgres")
public class DomainMember {
private long id;
private Timestamp 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 = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Timestamp getCreateDate() {
return createDate;
}
public void setCreateDate(Timestamp createDate) {
this.createDate = createDate;
}
}

View File

@ -1,11 +1,8 @@
package com.loafle.overflow.module.agent.dao; package com.loafle.overflow.module.probe.dao;
import com.loafle.overflow.module.agent.model.Agent;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* Created by insanity on 17. 5. 29. * Created by insanity on 17. 5. 29.
*/ */

View File

@ -1,6 +1,6 @@
//package com.loafle.overflow.module.agent.dao; //package com.loafle.overflow.module.agent.dao;
// //
//import com.loafle.overflow.module.agent.model.Agent; //import com.loafle.overflow.module.probe.model.Agent;
//import com.loafle.overflow.commons.dao.JPABaseDAO; //import com.loafle.overflow.commons.dao.JPABaseDAO;
//import com.loafle.overflow.module.member.model.Member; //import com.loafle.overflow.module.member.model.Member;
// //

View File

@ -1,4 +1,6 @@
package com.loafle.overflow.models; package com.loafle.overflow.module.probe.model;
import com.loafle.overflow.module.domain.Domain;
import javax.persistence.*; import javax.persistence.*;
import java.sql.Timestamp; import java.sql.Timestamp;
@ -8,19 +10,19 @@ import java.sql.Timestamp;
*/ */
@Entity @Entity
@Table(name = "TBL_PROBE", schema = "public", catalog = "postgres") @Table(name = "TBL_PROBE", schema = "public", catalog = "postgres")
public class TblProbe { public class Probe {
private long id; private long id;
private String status; private String status;
private String description; private String description;
private Timestamp createDate; private Timestamp createDate;
private Timestamp lastPollingDate; private Timestamp lastPollingDate;
private Timestamp nextPollingDate; private Timestamp nextPollingDate;
private long domainId; private Domain domain;
private String probeKey; private String probeKey;
private String encryptionKey; private String encryptionKey;
@Id @Id
@Column(name = "ID", nullable = false) @GeneratedValue(strategy= GenerationType.IDENTITY)
public long getId() { public long getId() {
return id; return id;
} }
@ -60,7 +62,7 @@ public class TblProbe {
} }
@Basic @Basic
@Column(name = "LAST_POLLING_DATE", nullable = true) @Column(name = "LAST_POLLING_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
public Timestamp getLastPollingDate() { public Timestamp getLastPollingDate() {
return lastPollingDate; return lastPollingDate;
} }
@ -81,12 +83,12 @@ public class TblProbe {
@Basic @Basic
@Column(name = "DOMAIN_ID", nullable = false) @Column(name = "DOMAIN_ID", nullable = false)
public long getDomainId() { public Domain getDomain() {
return domainId; return domain;
} }
public void setDomainId(long domainId) { public void setDomainId(Domain domainId) {
this.domainId = domainId; this.domain = domain;
} }
@Basic @Basic
@ -114,10 +116,10 @@ public class TblProbe {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null || getClass() != o.getClass()) return false;
TblProbe tblProbe = (TblProbe) o; Probe tblProbe = (Probe) o;
if (id != tblProbe.id) return false; if (id != tblProbe.id) return false;
if (domainId != tblProbe.domainId) return false; if (domain != tblProbe.domain) return false;
if (status != null ? !status.equals(tblProbe.status) : tblProbe.status != null) return false; if (status != null ? !status.equals(tblProbe.status) : tblProbe.status != null) return false;
if (description != null ? !description.equals(tblProbe.description) : tblProbe.description != null) if (description != null ? !description.equals(tblProbe.description) : tblProbe.description != null)
return false; return false;
@ -133,17 +135,4 @@ public class TblProbe {
return true; return true;
} }
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (status != null ? status.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
result = 31 * result + (lastPollingDate != null ? lastPollingDate.hashCode() : 0);
result = 31 * result + (nextPollingDate != null ? nextPollingDate.hashCode() : 0);
result = 31 * result + (int) (domainId ^ (domainId >>> 32));
result = 31 * result + (probeKey != null ? probeKey.hashCode() : 0);
result = 31 * result + (encryptionKey != null ? encryptionKey.hashCode() : 0);
return result;
}
} }

View File

@ -0,0 +1,29 @@
package com.loafle.overflow.module.target.dao;
import com.loafle.overflow.commons.dao.JPABaseDAO;
import javax.persistence.Query;
import java.util.List;
/**
* Created by root on 17. 6. 5.
*/
public class JPATargetDao extends JPABaseDAO<Target> implements TargetDao {
public List<Target> findAll(Target target) {
Query query = getEntityManager().createNativeQuery("SELECT tg.* FROM Target tg WHERE tg.MEMBER_ID = :memberId", Target.class);
query.setParameter("memberId", target.getMember().getId());
List<Target> targets = null;
try {
targets = (List<Target>)query.getResultList();
}catch(Exception e) {
e.printStackTrace();
}finally {
return targets;
}
}
}

View File

@ -0,0 +1,13 @@
package com.loafle.overflow.module.target.dao;
import com.loafle.overflow.commons.dao.BaseDAO;
import java.util.List;
/**
* Created by root on 17. 6. 5.
*/
public interface TargetDao extends BaseDAO<Target> {
List<Target> findAll(Target target);
}

View File

@ -0,0 +1,61 @@
package com.loafle.overflow.module.target.model;
import com.loafle.overflow.module.infra.Infra;
import com.loafle.overflow.module.probe.model.Probe;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* Created by root on 17. 6. 22.
*/
@Entity
@Table(name = "TBL_TARGET", schema = "public", catalog = "postgres")
public class Target {
private long id;
private Timestamp 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;
}
@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 = "PROBE_ID", nullable = false)
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;
}
}