This commit is contained in:
crusader 2018-06-13 20:12:35 +09:00
parent 588cca4212
commit d99a5a716b
4 changed files with 37 additions and 50 deletions

View File

@ -51,7 +51,7 @@
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<version>1.0.57-SNAPSHOT</version>
<version>1.0.58-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -90,11 +90,8 @@ public class CentralInfraService implements InfraService {
throw new OverflowException("Iface is not valid");
}
MetaIPType metaIPType = new MetaIPType();
metaIPType.setKey(zone.getMetaIPTypeKey());
InfraHostIP infraHostIP = new InfraHostIP();
infraHostIP.setMetaIPType(metaIPType);
infraHostIP.setMetaIPType(zone.getMetaIPType());
infraHostIP.setAddress(zone.getAddress());
infraHostIP.setMac(zone.getMac());
@ -137,22 +134,18 @@ public class CentralInfraService implements InfraService {
InfraZone infraZone = this.registByZone(probeID, zone);
MetaIPType metaIPType = new MetaIPType();
metaIPType.setKey(host.getMetaIPTypeKey());
InfraHostIP infraHostIP = new InfraHostIP();
infraHostIP.setMetaIPType(metaIPType);
infraHostIP.setMetaIPType(host.getMetaIPType());
infraHostIP.setAddress(host.getAddress());
infraHostIP.setMac(host.getMac());
infraHostIP = infraHostIPService.validate(infraHostIP);
metaIPType = infraHostIP.getMetaIPType();
InfraHostIP eInfraHostIP = this.infraHostIPService.readByInfraHostInfraZoneIDAndMetaIPTypeKeyAndAddress(
infraZone.getId(), metaIPType.getKey(), host.getAddress());
infraZone.getId(), infraHostIP.getMetaIPType().getKey(), host.getAddress());
if (null != eInfraHostIP) {
throw new OverflowException(String.format("IP[%s(%s)] of Zone[%s] is exist already", host.getAddress(),
metaIPType.getName(), infraZone.getNetwork()));
infraHostIP.getMetaIPType().getName(), infraZone.getNetwork()));
}
InfraHost infraHost = new InfraHost();
@ -174,13 +167,14 @@ public class CentralInfraService implements InfraService {
throw new OverflowException("Service is not valid");
}
if (null == service.getMetaCryptoTypeKey()) {
throw new OverflowException("MetaCryptoTypeKey is not valid");
if (null == service.getMetaCryptoType()) {
throw new OverflowException("MetaCryptoType is not valid");
}
MetaCryptoType metaCryptoType = this.metaCryptoTypeService.readByKey(service.getMetaCryptoTypeKey());
MetaCryptoType metaCryptoType = this.metaCryptoTypeService.readByKey(service.getMetaCryptoType().getKey());
if (null == metaCryptoType) {
throw new OverflowException(String.format("MetaCryptoTypeKey[%s] is not valid", service.getMetaCryptoTypeKey()));
throw new OverflowException(
String.format("MetaCryptoTypeKey[%s] is not valid", service.getMetaCryptoType().getKey()));
}
Probe probe = this.probeService.read(probeID);
@ -203,43 +197,36 @@ public class CentralInfraService implements InfraService {
throw new OverflowException("Zone is not valid");
}
MetaIPType metaIPType = new MetaIPType();
metaIPType.setKey(host.getMetaIPTypeKey());
InfraHostIP infraHostIP = new InfraHostIP();
infraHostIP.setMetaIPType(metaIPType);
infraHostIP.setMetaIPType(host.getMetaIPType());
infraHostIP.setAddress(host.getAddress());
infraHostIP.setMac(host.getMac());
infraHostIP = this.infraHostIPService.validate(infraHostIP);
metaIPType = infraHostIP.getMetaIPType();
MetaPortType metaPortType = new MetaPortType();
metaPortType.setKey(port.getMetaPortTypeKey());
InfraHostPort infraHostPort = new InfraHostPort();
infraHostPort.setMetaPortType(metaPortType);
infraHostPort.setMetaPortType(port.getMetaPortType());
infraHostPort.setPort(port.getPortNumber());
infraHostPort = this.infraHostPortService.validate(infraHostPort);
metaPortType = infraHostPort.getMetaPortType();
InfraZone infraZone = this.registByZone(probeID, zone);
InfraHost infraHost = this.registByHost(probeID, host);
infraHostIP = this.infraHostIPService.readByInfraHostIDAndMetaIPTypeKeyAndAddress(infraHost.getId(),
metaIPType.getKey(), infraHostIP.getAddress());
if (null == infraHostIP) {
InfraHostIP eInfraHostIP = this.infraHostIPService.readByInfraHostIDAndMetaIPTypeKeyAndAddress(infraHost.getId(),
infraHostIP.getMetaIPType().getKey(), infraHostIP.getAddress());
if (null == eInfraHostIP) {
throw new OverflowException(String.format("IP[%s(%s)] of Zone[%s] is not exist", host.getAddress(),
metaIPType.getName(), infraZone.getNetwork()));
infraHostIP.getMetaIPType().getName(), infraZone.getNetwork()));
}
infraHostIP = eInfraHostIP;
InfraHostPort eInfraHostPort = this.infraHostPortService
.readByInfraHostIDAndMetaPortTypeKeyAndPort(infraHost.getId(), metaPortType.getKey(), infraHostPort.getPort());
InfraHostPort eInfraHostPort = this.infraHostPortService.readByInfraHostIDAndMetaPortTypeKeyAndPort(
infraHost.getId(), infraHostPort.getMetaPortType().getKey(), infraHostPort.getPort());
if (null != eInfraHostPort) {
throw new OverflowException(
String.format("Port[%d(%s)] of Zone[%s].Host[%s(%s)] is not exist", host.getAddress(), metaPortType.getName(),
infraZone.getNetwork(), infraHostIP.getAddress(), infraHostIP.getMetaIPType().getName()));
throw new OverflowException(String.format("Port[%d(%s)] of Zone[%s].Host[%s(%s)] is not exist", host.getAddress(),
infraHostPort.getMetaPortType().getName(), infraZone.getNetwork(), infraHostIP.getAddress(),
infraHostIP.getMetaIPType().getName()));
}
infraHostPort = this.infraHostPortService.regist(infraHostPort);
@ -294,7 +281,8 @@ public class CentralInfraService implements InfraService {
return this.infraZoneDAO.save(infraZone);
}
public InfraHost registInfraHostByInfraHost(Long probeID, Long infraZoneID, InfraHost oriInfraHost) throws OverflowException {
public InfraHost registInfraHostByInfraHost(Long probeID, Long infraZoneID, InfraHost oriInfraHost)
throws OverflowException {
InfraHost infraHost = new InfraHost();
infraHost.setProbe(new Probe(probeID));
infraHost.setInfraZone(new InfraZone(infraZoneID));
@ -302,7 +290,8 @@ public class CentralInfraService implements InfraService {
InfraHostOS infraHostOS = oriInfraHost.getInfraHostOS();
if (null != infraHostOS) {
// MetaTargetHostType metaTargetHostType = this.metaTargetHostTypeService.readByInfraHostOS(infraHostOS);
// MetaTargetHostType metaTargetHostType =
// this.metaTargetHostTypeService.readByInfraHostOS(infraHostOS);
infraHost.setMetaTargetHostType(MetaTargetHostType.Enum.UNKNOWN.to());
infraHost.setInfraHostOS(infraHostOS);
} else {

View File

@ -59,7 +59,7 @@ public class CentralMemberService implements MemberService {
throw new OverflowException("EmailNotConfirmedException()", new Throwable());
}
Boolean match = passwordEncoder.matches(signinPw, m.getPw());
Boolean match = passwordEncoder.matches(signinPw, m.getPassword());
if (!match) {
if (m.getSigninFailCount() > 10) {
throw new OverflowException("SigninOverFailedException()", new Throwable());
@ -95,7 +95,7 @@ public class CentralMemberService implements MemberService {
// "special character, lowercase letter, and number, " +
// "and must be at least 6 characters long.");
}
member.setPw(passwordEncoder.encode(pw));
member.setPassword(passwordEncoder.encode(pw));
if (member.getMetaMemberStatus() == null) {
member.setMetaMemberStatus(new MetaMemberStatus((short) 1));
@ -162,7 +162,7 @@ public class CentralMemberService implements MemberService {
// "special character, lowercase letter, and number, " +
// "and must be at least 6 characters long.");
}
member.setPw(passwordEncoder.encode(pw));
member.setPassword(passwordEncoder.encode(pw));
return this.modify(member);
}
@ -178,7 +178,6 @@ public class CentralMemberService implements MemberService {
return this.domainMemberService.readAllMemberByDomainID(probe.getDomain().getId());
}
public void signout(Member member) {
// Todo websocket session remove
}
@ -201,12 +200,12 @@ public class CentralMemberService implements MemberService {
// "and must be at least 6 characters long.");
}
Boolean match = passwordEncoder.matches(member.getPw(), preMember.getPw());
Boolean match = passwordEncoder.matches(member.getPassword(), preMember.getPassword());
if (!match) {
member.setPw(passwordEncoder.encode(pw));
member.setPassword(passwordEncoder.encode(pw));
}
} else {
member.setPw(preMember.getPw());
member.setPassword(preMember.getPassword());
}
if (member.getMetaMemberStatus() == null || member.getMetaMemberStatus().getId() <= 0) {
@ -224,7 +223,7 @@ public class CentralMemberService implements MemberService {
Member preMember = this.memberDAO.findByEmail(signinId);
String encodePw = passwordEncoder.encode(signinPw);
Boolean match = passwordEncoder.matches(encodePw, preMember.getPw());
Boolean match = passwordEncoder.matches(encodePw, preMember.getPassword());
if (!match) {
throw new OverflowException("SignInPwNotMatchException", new Throwable());
@ -260,7 +259,6 @@ public class CentralMemberService implements MemberService {
// Todo DB delete?
}
public List<Member> readAllByApiKey(String apikey) throws OverflowException {
ApiKey apiKey = this.apiKeyService.readByApiKey(apikey);

View File

@ -869,16 +869,16 @@ INSERT INTO meta_sensor_display_mapping (id,meta_sensor_display_item_id,meta_sen
INSERT INTO public."member" (company_name,email,"name",phone,pw,meta_member_status_id) VALUES (
INSERT INTO public."member" (company_name,email,"name",phone,password,meta_member_status_id) VALUES (
'loafle','overflow@loafle.com','overFlow','000-000-0000','$2a$10$G2bbjoX9.fOnxJx/8DZqPujFYrEQtIEB.f98/8K20XiGWEhwPakZ.',2);
INSERT INTO public."member" (company_name,email,"name",phone,pw,meta_member_status_id) VALUES (
INSERT INTO public."member" (company_name,email,"name",phone,password,meta_member_status_id) VALUES (
'loafle','insanity@loafle.com','overFlow','000-000-0000','$2a$10$G2bbjoX9.fOnxJx/8DZqPujFYrEQtIEB.f98/8K20XiGWEhwPakZ.',2);
INSERT INTO public."member" (company_name,email,"name",phone,pw,meta_member_status_id) VALUES (
INSERT INTO public."member" (company_name,email,"name",phone,password,meta_member_status_id) VALUES (
'loafle','snoop@loafle.com','overFlow','000-000-0000','$2a$10$G2bbjoX9.fOnxJx/8DZqPujFYrEQtIEB.f98/8K20XiGWEhwPakZ.',2);
INSERT INTO public."member" (company_name,email,"name",phone,pw,meta_member_status_id) VALUES (
INSERT INTO public."member" (company_name,email,"name",phone,password,meta_member_status_id) VALUES (
'loafle','geekdev@naver.com','geek','000-000-0000','$2a$10$G2bbjoX9.fOnxJx/8DZqPujFYrEQtIEB.f98/8K20XiGWEhwPakZ.',2);
INSERT INTO public.email_auth (auth_confirm_date,email_auth_key,member_id, meta_email_type_id) VALUES (