diff --git a/src/main/java/com/loafle/overflow/module/core/exception/OverflowException.java b/src/main/java/com/loafle/overflow/module/core/exception/OverflowException.java new file mode 100644 index 0000000..8e1b4c7 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/core/exception/OverflowException.java @@ -0,0 +1,7 @@ +package com.loafle.overflow.module.core.exception; + +public class OverflowException extends Exception { + public OverflowException(String s, Throwable throwable) { + super(s, throwable); + } +} diff --git a/src/main/java/com/loafle/overflow/module/discovery/service/DiscoveryService.java b/src/main/java/com/loafle/overflow/module/discovery/service/DiscoveryService.java index 644269d..06f6a21 100644 --- a/src/main/java/com/loafle/overflow/module/discovery/service/DiscoveryService.java +++ b/src/main/java/com/loafle/overflow/module/discovery/service/DiscoveryService.java @@ -4,6 +4,7 @@ import java.util.Date; import com.loafle.overflow.module.core.annotation.ProbeAPI; import com.loafle.overflow.module.core.annotation.WebappAPI; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.discovery.model.DiscoverHost; import com.loafle.overflow.module.discovery.model.DiscoverPort; import com.loafle.overflow.module.discovery.model.DiscoverService; @@ -18,24 +19,24 @@ import com.loafle.overflow.module.discovery.model.Zone; */ public interface DiscoveryService { @WebappAPI - void discoverZone(String probeID, DiscoverZone discoverZone); + void discoverZone(String probeID, DiscoverZone discoverZone) throws OverflowException; @WebappAPI - void discoverHost(String probeID, Zone zone, DiscoverHost discoverHost); + void discoverHost(String probeID, Zone zone, DiscoverHost discoverHost) throws OverflowException; @WebappAPI - void discoverPort(String probeID, Host host, DiscoverPort discoverPort); + void discoverPort(String probeID, Host host, DiscoverPort discoverPort) throws OverflowException; @WebappAPI - void discoverService(String probeID, Port port, DiscoverService discoverService); + void discoverService(String probeID, Port port, DiscoverService discoverService) throws OverflowException; @ProbeAPI - void discoverStart(String requesterSessionID, Date startDate); + void discoverStart(String requesterSessionID, Date startDate) throws OverflowException; @ProbeAPI - void discoverStop(String requesterSessionID, Date stopDate); + void discoverStop(String requesterSessionID, Date stopDate) throws OverflowException; @ProbeAPI - void discoveredZone(String requesterSessionID, Zone zone); + void discoveredZone(String requesterSessionID, Zone zone) throws OverflowException; @ProbeAPI - void discoveredHost(String requesterSessionID, Host host); + void discoveredHost(String requesterSessionID, Host host) throws OverflowException; @ProbeAPI - void discoveredPort(String requesterSessionID, Port port); + void discoveredPort(String requesterSessionID, Port port) throws OverflowException; @ProbeAPI - void discoveredService(String requesterSessionID, Service service); + void discoveredService(String requesterSessionID, Service service) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/domain/service/DomainMemberService.java b/src/main/java/com/loafle/overflow/module/domain/service/DomainMemberService.java index 0406cfd..5c232ff 100644 --- a/src/main/java/com/loafle/overflow/module/domain/service/DomainMemberService.java +++ b/src/main/java/com/loafle/overflow/module/domain/service/DomainMemberService.java @@ -2,6 +2,7 @@ package com.loafle.overflow.module.domain.service; import java.util.List; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.domain.model.Domain; import com.loafle.overflow.module.domain.model.DomainMember; import com.loafle.overflow.module.member.model.Member; @@ -10,9 +11,9 @@ import com.loafle.overflow.module.member.model.Member; * Created by snoop on 17. 6. 28. */ public interface DomainMemberService { - void regist(DomainMember domainMember); - Domain readDomainByMemberID(long id); - DomainMember readByMemberEmail(String email); - List readAllMemberByDomain(Domain domain); - List readAllMemberByDomainID(final long domainID); + void regist(DomainMember domainMember) throws OverflowException; + Domain readDomainByMemberID(long id) throws OverflowException; + DomainMember readByMemberEmail(String email) throws OverflowException; + List readAllMemberByDomain(Domain domain) throws OverflowException; + List readAllMemberByDomainID(final long domainID) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/domain/service/DomainService.java b/src/main/java/com/loafle/overflow/module/domain/service/DomainService.java index 8d7d15a..745b2b6 100644 --- a/src/main/java/com/loafle/overflow/module/domain/service/DomainService.java +++ b/src/main/java/com/loafle/overflow/module/domain/service/DomainService.java @@ -1,10 +1,11 @@ package com.loafle.overflow.module.domain.service; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.domain.model.Domain; /** * Created by snoop on 17. 6. 28. */ public interface DomainService { - void regist(Domain domain); + void regist(Domain domain) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/email/service/EmailAuthService.java b/src/main/java/com/loafle/overflow/module/email/service/EmailAuthService.java deleted file mode 100644 index a5bb8e5..0000000 --- a/src/main/java/com/loafle/overflow/module/email/service/EmailAuthService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.loafle.overflow.module.email.service; - -import java.io.UnsupportedEncodingException; -import java.util.List; - -import com.loafle.overflow.module.email.model.EmailAuth; -import com.loafle.overflow.module.member.model.Member; - -/** - * Created by geek on 17. 6. 28. - */ -public interface EmailAuthService { - EmailAuth sendEmailByMember(long memberId, String memberEmail) throws UnsupportedEncodingException; - EmailAuth read(long id); - EmailAuth readByAuthKey(String authKey) throws UnsupportedEncodingException; - List readByMember(long memberId); - EmailAuth modify(EmailAuth emailAuth); - EmailAuth sendEmailResetPassword(Member member) throws UnsupportedEncodingException; -} diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraHostService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraHostService.java index 9f4299d..7ba31a0 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraHostService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraHostService.java @@ -1,5 +1,6 @@ package com.loafle.overflow.module.infra.service; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.infra.model.InfraHost; /** @@ -7,7 +8,7 @@ import com.loafle.overflow.module.infra.model.InfraHost; */ public interface InfraHostService { - InfraHost regist(InfraHost infraHost); - InfraHost read(long id); - InfraHost readByIp(long ip); + InfraHost regist(InfraHost infraHost) throws OverflowException; + InfraHost read(long id) throws OverflowException; + InfraHost readByIp(long ip) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraMachineService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraMachineService.java index b88a573..14c5069 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraMachineService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraMachineService.java @@ -1,11 +1,12 @@ package com.loafle.overflow.module.infra.service; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.infra.model.InfraMachine; /** * Created by insanity on 17. 6. 28. */ public interface InfraMachineService { - InfraMachine regist(InfraMachine infraMachine); + InfraMachine regist(InfraMachine infraMachine) throws OverflowException; InfraMachine read(long id); } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSApplicationService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSApplicationService.java index 72dba78..8c85da9 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSApplicationService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSApplicationService.java @@ -1,5 +1,6 @@ package com.loafle.overflow.module.infra.service; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.infra.model.InfraOSApplication; /** @@ -7,6 +8,6 @@ import com.loafle.overflow.module.infra.model.InfraOSApplication; */ public interface InfraOSApplicationService { - InfraOSApplication regist(InfraOSApplication infraOSApplication); - InfraOSApplication read(long id); + InfraOSApplication regist(InfraOSApplication infraOSApplication) throws OverflowException; + InfraOSApplication read(long id) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSDaemonService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSDaemonService.java index 678883b..cd0f06b 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSDaemonService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSDaemonService.java @@ -1,5 +1,6 @@ package com.loafle.overflow.module.infra.service; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.infra.model.InfraOSDaemon; /** @@ -7,6 +8,6 @@ import com.loafle.overflow.module.infra.model.InfraOSDaemon; */ public interface InfraOSDaemonService { - InfraOSDaemon regist(InfraOSDaemon infraOSDaemon); - InfraOSDaemon read(long id); + InfraOSDaemon regist(InfraOSDaemon infraOSDaemon) throws OverflowException; + InfraOSDaemon read(long id) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSPortService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSPortService.java index 7f08df0..969ed62 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSPortService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSPortService.java @@ -1,5 +1,6 @@ package com.loafle.overflow.module.infra.service; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.infra.model.InfraOSPort; /** @@ -7,7 +8,7 @@ import com.loafle.overflow.module.infra.model.InfraOSPort; */ public interface InfraOSPortService { - InfraOSPort regist(InfraOSPort infraOSPort); - InfraOSPort read(long id); - InfraOSPort readByPort(long osId, int portNumber, String portType); + InfraOSPort regist(InfraOSPort infraOSPort) throws OverflowException; + InfraOSPort read(long id) throws OverflowException; + InfraOSPort readByPort(long osId, int portNumber, String portType) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSService.java index 35ed8e5..b3cac1b 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSService.java @@ -1,5 +1,6 @@ package com.loafle.overflow.module.infra.service; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.infra.model.InfraOS; /** @@ -7,6 +8,6 @@ import com.loafle.overflow.module.infra.model.InfraOS; */ public interface InfraOSService { - InfraOS regist(InfraOS infraOS); - InfraOS read(long id); + InfraOS regist(InfraOS infraOS) throws OverflowException; + InfraOS read(long id) throws OverflowException; } 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 index 0e9dd9d..676ad8d 100644 --- a/src/main/java/com/loafle/overflow/module/member/model/Member.java +++ b/src/main/java/com/loafle/overflow/module/member/model/Member.java @@ -19,6 +19,8 @@ public class Member { private String companyName; private Date createDate; private MetaMemberStatus status; + private int signinFailCount; + private boolean totpType; public Member() { } @@ -107,6 +109,23 @@ public class Member { this.status = status; } + @Column(name = "SIGNIN_FAIL_COUNT", nullable = true, columnDefinition = "int default 0") + public int getSigninFailCount(){ + return this.signinFailCount; + } + public void setSigninFailCount(int failCount) { + this.signinFailCount = failCount; + } + + @Basic + @Column(name = "TOTP_TYPE", nullable = false, columnDefinition = "boolean default false") + public boolean isTotpType() { + return totpType; + } + + public void setTotpType(boolean totpType) { + this.totpType = totpType; + } } diff --git a/src/main/java/com/loafle/overflow/module/member/model/MemberTotp.java b/src/main/java/com/loafle/overflow/module/member/model/MemberTotp.java new file mode 100644 index 0000000..d23bd21 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/member/model/MemberTotp.java @@ -0,0 +1,85 @@ +package com.loafle.overflow.module.member.model; + + +import javax.persistence.*; +import java.util.Date; + +/** + * Created by geek on 18. 3. 8. + */ +@Entity +@Table(name = "MEMBER_TOTP", schema = "public") +public class MemberTotp { + private long id; + private Member member; + private String secretCode; + private Date createDate; + private Date updateDate; + private String otpAuth; + + public MemberTotp() { + } + + public MemberTotp(long id) { + this.id = id; + } + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @OneToOne + @JoinColumn(name = "MEMBER_ID", nullable = false) + public Member getMember() { + return member; + } + + public void setMember(Member member) { + this.member = member; + } + + @Basic + @Column(name = "SECRET_CODE", nullable = false, length = 20) + public String getSecretCode() { + return secretCode; + } + + public void setSecretCode(String secretCode) { + this.secretCode = secretCode; + } + + @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 = "UPDATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = true) + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + + @Transient + public String getOtpAuth() { + return otpAuth; + } + + public void setOtpAuth(String otpAuthURL) { + this.otpAuth = otpAuthURL; + } +} diff --git a/src/main/java/com/loafle/overflow/module/member/service/MemberService.java b/src/main/java/com/loafle/overflow/module/member/service/MemberService.java index 926dd5c..004dc6e 100644 --- a/src/main/java/com/loafle/overflow/module/member/service/MemberService.java +++ b/src/main/java/com/loafle/overflow/module/member/service/MemberService.java @@ -1,7 +1,39 @@ package com.loafle.overflow.module.member.service; +import com.loafle.overflow.module.core.annotation.WebappAPI; +import com.loafle.overflow.module.core.exception.OverflowException; +import com.loafle.overflow.module.domain.model.Domain; +import com.loafle.overflow.module.domain.model.DomainMember; +import com.loafle.overflow.module.member.model.Member; + +import java.util.List; + /** * Created by geek on 17. 11. 7. */ public interface MemberService { + @WebappAPI + DomainMember signin(String signinId, String signinPw) throws OverflowException; + @WebappAPI + Member signup(Member member, String pw) throws OverflowException; + @WebappAPI + Member sendEmailForPassword(String email) throws OverflowException; + @WebappAPI + Member resetPassword(String encodeEmail, String pw) throws OverflowException; + @WebappAPI + Member modify(Member member, String pw) throws OverflowException; + @WebappAPI + Member forgotPassword(String signinId, String newPw) throws OverflowException; + @WebappAPI + Member read(long memberId) throws OverflowException; + @WebappAPI + void withdrawal(Member member) throws OverflowException; + @WebappAPI + List readAllByProbeKey(String probeKey) throws OverflowException; + @WebappAPI + List readAllByApiKey(String apikey) throws OverflowException; + @WebappAPI + List readAllByDomain(Domain domain) throws OverflowException; + @WebappAPI + List readAllByDomainID(final long domainID) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/member/service/MemberTotpService.java b/src/main/java/com/loafle/overflow/module/member/service/MemberTotpService.java new file mode 100644 index 0000000..a7e4418 --- /dev/null +++ b/src/main/java/com/loafle/overflow/module/member/service/MemberTotpService.java @@ -0,0 +1,27 @@ +package com.loafle.overflow.module.member.service; + +import com.loafle.overflow.module.core.annotation.WebappAPI; +import com.loafle.overflow.module.core.exception.OverflowException; +import com.loafle.overflow.module.member.model.Member; +import com.loafle.overflow.module.member.model.MemberTotp; +import java.util.Map; + +/** + * Created by geek on 18. 3. 8. + */ +public interface MemberTotpService { + @WebappAPI + void regist(Member member, String secretCode, String code) throws OverflowException; + @WebappAPI + MemberTotp modify(MemberTotp totp) throws OverflowException; + @WebappAPI + void remove(long id) throws OverflowException; + @WebappAPI + MemberTotp read(long id) throws OverflowException; + @WebappAPI + boolean checkCodeForMember(Member member, String code) throws OverflowException; + @WebappAPI + boolean checkCode(String secretCode, String code) throws OverflowException; + @WebappAPI + Map createTotp(Member member) throws OverflowException; +} diff --git a/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java b/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java index f7769f2..a2d3e27 100644 --- a/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java +++ b/src/main/java/com/loafle/overflow/module/noauthprobe/service/NoAuthProbeService.java @@ -2,6 +2,7 @@ package com.loafle.overflow.module.noauthprobe.service; import com.loafle.overflow.module.core.annotation.ProbeAPI; import com.loafle.overflow.module.core.annotation.WebappAPI; +import com.loafle.overflow.module.core.exception.OverflowException; import com.loafle.overflow.module.domain.model.Domain; import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe; @@ -12,12 +13,12 @@ import java.util.List; */ public interface NoAuthProbeService { @ProbeAPI - NoAuthProbe regist(NoAuthProbe noAuthProbe); + NoAuthProbe regist(NoAuthProbe noAuthProbe) throws OverflowException; @WebappAPI - List readAllByDomain(Domain domain); + List readAllByDomain(Domain domain) throws OverflowException; @WebappAPI - List acceptNoAuthProbe(NoAuthProbe noAuthProbe); + List acceptNoAuthProbe(NoAuthProbe noAuthProbe) throws OverflowException; @WebappAPI - List denyNoauthProbe(NoAuthProbe noAuthProbe); + List denyNoauthProbe(NoAuthProbe noAuthProbe) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/module/notification/service/NotificationService.java b/src/main/java/com/loafle/overflow/module/notification/service/NotificationService.java index 4a732af..6d85c12 100644 --- a/src/main/java/com/loafle/overflow/module/notification/service/NotificationService.java +++ b/src/main/java/com/loafle/overflow/module/notification/service/NotificationService.java @@ -1,7 +1,27 @@ package com.loafle.overflow.module.notification.service; +import com.loafle.overflow.module.core.annotation.WebappAPI; +import com.loafle.overflow.module.core.exception.OverflowException; +import com.loafle.overflow.module.core.model.PageParams; +import com.loafle.overflow.module.member.model.Member; +import com.loafle.overflow.module.notification.model.Notification; +import org.springframework.data.domain.Page; /** * Created by insanity on 17. 8. 25. */ public interface NotificationService { + @WebappAPI + Notification regist(Notification notification) throws OverflowException; + @WebappAPI + Page readAllByMember(Member member, PageParams pageParams) throws OverflowException; + @WebappAPI + Page readAllUnconfirmedByMember(Member member, PageParams pageParams) throws OverflowException; + @WebappAPI + int readUnconfirmedCount(Member member) throws OverflowException; + @WebappAPI + Page markAllAsRead(Member member, PageParams pageParams) throws OverflowException; + @WebappAPI + Page markAllAsUnread(Member member, PageParams pageParams) throws OverflowException; + @WebappAPI + Notification markAsRead(Notification notification) throws OverflowException; } 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 index 1dde87c..052f168 100644 --- a/src/main/java/com/loafle/overflow/module/target/model/Target.java +++ b/src/main/java/com/loafle/overflow/module/target/model/Target.java @@ -1,7 +1,10 @@ package com.loafle.overflow.module.target.model; +import com.loafle.overflow.module.sensor.model.Sensor; + import javax.persistence.*; import java.util.Date; +import java.util.List; /** * Created by root on 17. 6. 22. @@ -15,6 +18,7 @@ public class Target { private String displayName; private String description; + private List sensors; /* private long id; private Date createDate; @@ -82,4 +86,13 @@ public class Target { // this.infra = infra; // } + @Transient + public List getSensors() { + return sensors; + } + + public void setSensors(List sensors) { + this.sensors = sensors; + } + } diff --git a/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java b/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java index 744b9b3..d783044 100644 --- a/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java +++ b/src/main/java/com/loafle/overflow/module/target/service/TargetDiscoveryService.java @@ -1,7 +1,10 @@ package com.loafle.overflow.module.target.service; +import com.loafle.overflow.module.target.model.Target; + /** * Created by snoop on 17. 6. 28. */ public interface TargetDiscoveryService { + } diff --git a/src/main/java/com/loafle/overflow/module/target/service/TargetService.java b/src/main/java/com/loafle/overflow/module/target/service/TargetService.java index c43199e..4786fe2 100644 --- a/src/main/java/com/loafle/overflow/module/target/service/TargetService.java +++ b/src/main/java/com/loafle/overflow/module/target/service/TargetService.java @@ -1,7 +1,13 @@ package com.loafle.overflow.module.target.service; +import com.loafle.overflow.module.core.exception.OverflowException; +import com.loafle.overflow.module.target.model.Target; + /** * Created by insanity on 17. 6. 28. */ public interface TargetService { + Target regist(Target target) throws OverflowException; + Target read(String id) throws OverflowException; + void remove(Target target) throws OverflowException; }