diff --git a/pom.xml b/pom.xml index 8129684..3a15278 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ com.loafle.overflow commons-java - 1.0.57-SNAPSHOT + 1.0.58-SNAPSHOT diff --git a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java index 87e60d5..35dbfdf 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/service/CentralInfraService.java @@ -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 { diff --git a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java index 0230a28..abad0ed 100644 --- a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java +++ b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java @@ -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 readAllByApiKey(String apikey) throws OverflowException { ApiKey apiKey = this.apiKeyService.readByApiKey(apikey); diff --git a/src/main/resources/local/init.sql b/src/main/resources/local/init.sql index fdf15b0..a233129 100644 --- a/src/main/resources/local/init.sql +++ b/src/main/resources/local/init.sql @@ -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 (