This commit is contained in:
geek 2018-04-23 18:34:30 +09:00
parent bc9c8f9848
commit 6cb8eefe58
20 changed files with 255 additions and 52 deletions

View File

@ -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);
}
}

View File

@ -4,6 +4,7 @@ import java.util.Date;
import com.loafle.overflow.module.core.annotation.ProbeAPI; import com.loafle.overflow.module.core.annotation.ProbeAPI;
import com.loafle.overflow.module.core.annotation.WebappAPI; 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.DiscoverHost;
import com.loafle.overflow.module.discovery.model.DiscoverPort; import com.loafle.overflow.module.discovery.model.DiscoverPort;
import com.loafle.overflow.module.discovery.model.DiscoverService; import com.loafle.overflow.module.discovery.model.DiscoverService;
@ -18,24 +19,24 @@ import com.loafle.overflow.module.discovery.model.Zone;
*/ */
public interface DiscoveryService { public interface DiscoveryService {
@WebappAPI @WebappAPI
void discoverZone(String probeID, DiscoverZone discoverZone); void discoverZone(String probeID, DiscoverZone discoverZone) throws OverflowException;
@WebappAPI @WebappAPI
void discoverHost(String probeID, Zone zone, DiscoverHost discoverHost); void discoverHost(String probeID, Zone zone, DiscoverHost discoverHost) throws OverflowException;
@WebappAPI @WebappAPI
void discoverPort(String probeID, Host host, DiscoverPort discoverPort); void discoverPort(String probeID, Host host, DiscoverPort discoverPort) throws OverflowException;
@WebappAPI @WebappAPI
void discoverService(String probeID, Port port, DiscoverService discoverService); void discoverService(String probeID, Port port, DiscoverService discoverService) throws OverflowException;
@ProbeAPI @ProbeAPI
void discoverStart(String requesterSessionID, Date startDate); void discoverStart(String requesterSessionID, Date startDate) throws OverflowException;
@ProbeAPI @ProbeAPI
void discoverStop(String requesterSessionID, Date stopDate); void discoverStop(String requesterSessionID, Date stopDate) throws OverflowException;
@ProbeAPI @ProbeAPI
void discoveredZone(String requesterSessionID, Zone zone); void discoveredZone(String requesterSessionID, Zone zone) throws OverflowException;
@ProbeAPI @ProbeAPI
void discoveredHost(String requesterSessionID, Host host); void discoveredHost(String requesterSessionID, Host host) throws OverflowException;
@ProbeAPI @ProbeAPI
void discoveredPort(String requesterSessionID, Port port); void discoveredPort(String requesterSessionID, Port port) throws OverflowException;
@ProbeAPI @ProbeAPI
void discoveredService(String requesterSessionID, Service service); void discoveredService(String requesterSessionID, Service service) throws OverflowException;
} }

View File

@ -2,6 +2,7 @@ package com.loafle.overflow.module.domain.service;
import java.util.List; 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.Domain;
import com.loafle.overflow.module.domain.model.DomainMember; import com.loafle.overflow.module.domain.model.DomainMember;
import com.loafle.overflow.module.member.model.Member; 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. * Created by snoop on 17. 6. 28.
*/ */
public interface DomainMemberService { public interface DomainMemberService {
void regist(DomainMember domainMember); void regist(DomainMember domainMember) throws OverflowException;
Domain readDomainByMemberID(long id); Domain readDomainByMemberID(long id) throws OverflowException;
DomainMember readByMemberEmail(String email); DomainMember readByMemberEmail(String email) throws OverflowException;
List<Member> readAllMemberByDomain(Domain domain); List<Member> readAllMemberByDomain(Domain domain) throws OverflowException;
List<Member> readAllMemberByDomainID(final long domainID); List<Member> readAllMemberByDomainID(final long domainID) throws OverflowException;
} }

View File

@ -1,10 +1,11 @@
package com.loafle.overflow.module.domain.service; package com.loafle.overflow.module.domain.service;
import com.loafle.overflow.module.core.exception.OverflowException;
import com.loafle.overflow.module.domain.model.Domain; import com.loafle.overflow.module.domain.model.Domain;
/** /**
* Created by snoop on 17. 6. 28. * Created by snoop on 17. 6. 28.
*/ */
public interface DomainService { public interface DomainService {
void regist(Domain domain); void regist(Domain domain) throws OverflowException;
} }

View File

@ -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<EmailAuth> readByMember(long memberId);
EmailAuth modify(EmailAuth emailAuth);
EmailAuth sendEmailResetPassword(Member member) throws UnsupportedEncodingException;
}

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.infra.service; package com.loafle.overflow.module.infra.service;
import com.loafle.overflow.module.core.exception.OverflowException;
import com.loafle.overflow.module.infra.model.InfraHost; import com.loafle.overflow.module.infra.model.InfraHost;
/** /**
@ -7,7 +8,7 @@ import com.loafle.overflow.module.infra.model.InfraHost;
*/ */
public interface InfraHostService { public interface InfraHostService {
InfraHost regist(InfraHost infraHost); InfraHost regist(InfraHost infraHost) throws OverflowException;
InfraHost read(long id); InfraHost read(long id) throws OverflowException;
InfraHost readByIp(long ip); InfraHost readByIp(long ip) throws OverflowException;
} }

View File

@ -1,11 +1,12 @@
package com.loafle.overflow.module.infra.service; package com.loafle.overflow.module.infra.service;
import com.loafle.overflow.module.core.exception.OverflowException;
import com.loafle.overflow.module.infra.model.InfraMachine; import com.loafle.overflow.module.infra.model.InfraMachine;
/** /**
* Created by insanity on 17. 6. 28. * Created by insanity on 17. 6. 28.
*/ */
public interface InfraMachineService { public interface InfraMachineService {
InfraMachine regist(InfraMachine infraMachine); InfraMachine regist(InfraMachine infraMachine) throws OverflowException;
InfraMachine read(long id); InfraMachine read(long id);
} }

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.infra.service; package com.loafle.overflow.module.infra.service;
import com.loafle.overflow.module.core.exception.OverflowException;
import com.loafle.overflow.module.infra.model.InfraOSApplication; import com.loafle.overflow.module.infra.model.InfraOSApplication;
/** /**
@ -7,6 +8,6 @@ import com.loafle.overflow.module.infra.model.InfraOSApplication;
*/ */
public interface InfraOSApplicationService { public interface InfraOSApplicationService {
InfraOSApplication regist(InfraOSApplication infraOSApplication); InfraOSApplication regist(InfraOSApplication infraOSApplication) throws OverflowException;
InfraOSApplication read(long id); InfraOSApplication read(long id) throws OverflowException;
} }

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.infra.service; package com.loafle.overflow.module.infra.service;
import com.loafle.overflow.module.core.exception.OverflowException;
import com.loafle.overflow.module.infra.model.InfraOSDaemon; import com.loafle.overflow.module.infra.model.InfraOSDaemon;
/** /**
@ -7,6 +8,6 @@ import com.loafle.overflow.module.infra.model.InfraOSDaemon;
*/ */
public interface InfraOSDaemonService { public interface InfraOSDaemonService {
InfraOSDaemon regist(InfraOSDaemon infraOSDaemon); InfraOSDaemon regist(InfraOSDaemon infraOSDaemon) throws OverflowException;
InfraOSDaemon read(long id); InfraOSDaemon read(long id) throws OverflowException;
} }

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.infra.service; package com.loafle.overflow.module.infra.service;
import com.loafle.overflow.module.core.exception.OverflowException;
import com.loafle.overflow.module.infra.model.InfraOSPort; import com.loafle.overflow.module.infra.model.InfraOSPort;
/** /**
@ -7,7 +8,7 @@ import com.loafle.overflow.module.infra.model.InfraOSPort;
*/ */
public interface InfraOSPortService { public interface InfraOSPortService {
InfraOSPort regist(InfraOSPort infraOSPort); InfraOSPort regist(InfraOSPort infraOSPort) throws OverflowException;
InfraOSPort read(long id); InfraOSPort read(long id) throws OverflowException;
InfraOSPort readByPort(long osId, int portNumber, String portType); InfraOSPort readByPort(long osId, int portNumber, String portType) throws OverflowException;
} }

View File

@ -1,5 +1,6 @@
package com.loafle.overflow.module.infra.service; package com.loafle.overflow.module.infra.service;
import com.loafle.overflow.module.core.exception.OverflowException;
import com.loafle.overflow.module.infra.model.InfraOS; import com.loafle.overflow.module.infra.model.InfraOS;
/** /**
@ -7,6 +8,6 @@ import com.loafle.overflow.module.infra.model.InfraOS;
*/ */
public interface InfraOSService { public interface InfraOSService {
InfraOS regist(InfraOS infraOS); InfraOS regist(InfraOS infraOS) throws OverflowException;
InfraOS read(long id); InfraOS read(long id) throws OverflowException;
} }

View File

@ -19,6 +19,8 @@ public class Member {
private String companyName; private String companyName;
private Date createDate; private Date createDate;
private MetaMemberStatus status; private MetaMemberStatus status;
private int signinFailCount;
private boolean totpType;
public Member() { public Member() {
} }
@ -107,6 +109,23 @@ public class Member {
this.status = status; 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;
}
} }

View File

@ -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;
}
}

View File

@ -1,7 +1,39 @@
package com.loafle.overflow.module.member.service; 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. * Created by geek on 17. 11. 7.
*/ */
public interface MemberService { 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<Member> readAllByProbeKey(String probeKey) throws OverflowException;
@WebappAPI
List<Member> readAllByApiKey(String apikey) throws OverflowException;
@WebappAPI
List<Member> readAllByDomain(Domain domain) throws OverflowException;
@WebappAPI
List<Member> readAllByDomainID(final long domainID) throws OverflowException;
} }

View File

@ -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<String, String> createTotp(Member member) throws OverflowException;
}

View File

@ -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.ProbeAPI;
import com.loafle.overflow.module.core.annotation.WebappAPI; 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.Domain;
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe; import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
@ -12,12 +13,12 @@ import java.util.List;
*/ */
public interface NoAuthProbeService { public interface NoAuthProbeService {
@ProbeAPI @ProbeAPI
NoAuthProbe regist(NoAuthProbe noAuthProbe); NoAuthProbe regist(NoAuthProbe noAuthProbe) throws OverflowException;
@WebappAPI @WebappAPI
List<NoAuthProbe> readAllByDomain(Domain domain); List<NoAuthProbe> readAllByDomain(Domain domain) throws OverflowException;
@WebappAPI @WebappAPI
List<NoAuthProbe> acceptNoAuthProbe(NoAuthProbe noAuthProbe); List<NoAuthProbe> acceptNoAuthProbe(NoAuthProbe noAuthProbe) throws OverflowException;
@WebappAPI @WebappAPI
List<NoAuthProbe> denyNoauthProbe(NoAuthProbe noAuthProbe); List<NoAuthProbe> denyNoauthProbe(NoAuthProbe noAuthProbe) throws OverflowException;
} }

View File

@ -1,7 +1,27 @@
package com.loafle.overflow.module.notification.service; 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. * Created by insanity on 17. 8. 25.
*/ */
public interface NotificationService { public interface NotificationService {
@WebappAPI
Notification regist(Notification notification) throws OverflowException;
@WebappAPI
Page<Notification> readAllByMember(Member member, PageParams pageParams) throws OverflowException;
@WebappAPI
Page<Notification> readAllUnconfirmedByMember(Member member, PageParams pageParams) throws OverflowException;
@WebappAPI
int readUnconfirmedCount(Member member) throws OverflowException;
@WebappAPI
Page<Notification> markAllAsRead(Member member, PageParams pageParams) throws OverflowException;
@WebappAPI
Page<Notification> markAllAsUnread(Member member, PageParams pageParams) throws OverflowException;
@WebappAPI
Notification markAsRead(Notification notification) throws OverflowException;
} }

View File

@ -1,7 +1,10 @@
package com.loafle.overflow.module.target.model; package com.loafle.overflow.module.target.model;
import com.loafle.overflow.module.sensor.model.Sensor;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* Created by root on 17. 6. 22. * Created by root on 17. 6. 22.
@ -15,6 +18,7 @@ public class Target {
private String displayName; private String displayName;
private String description; private String description;
private List<Sensor> sensors;
/* /*
private long id; private long id;
private Date createDate; private Date createDate;
@ -82,4 +86,13 @@ public class Target {
// this.infra = infra; // this.infra = infra;
// } // }
@Transient
public List<Sensor> getSensors() {
return sensors;
}
public void setSensors(List<Sensor> sensors) {
this.sensors = sensors;
}
} }

View File

@ -1,7 +1,10 @@
package com.loafle.overflow.module.target.service; package com.loafle.overflow.module.target.service;
import com.loafle.overflow.module.target.model.Target;
/** /**
* Created by snoop on 17. 6. 28. * Created by snoop on 17. 6. 28.
*/ */
public interface TargetDiscoveryService { public interface TargetDiscoveryService {
} }

View File

@ -1,7 +1,13 @@
package com.loafle.overflow.module.target.service; 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. * Created by insanity on 17. 6. 28.
*/ */
public interface TargetService { public interface TargetService {
Target regist(Target target) throws OverflowException;
Target read(String id) throws OverflowException;
void remove(Target target) throws OverflowException;
} }