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 6168bab..4f8d0db 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,8 @@ package com.loafle.overflow.module.noauthprobe.service; import com.loafle.overflow.module.domain.model.Domain; import com.loafle.overflow.module.member.model.Member; +import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus; +import com.loafle.overflow.module.meta.model.MetaProbeStatus; import com.loafle.overflow.module.noauthprobe.dao.NoAuthProbeDAO; import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe; import com.loafle.overflow.module.probe.model.Probe; @@ -9,7 +11,6 @@ import com.loafle.overflow.module.probe.service.ProbeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; import java.util.List; /** @@ -38,7 +39,7 @@ public class NoAuthProbeService { return this.noAuthProbeDAO.findOne(id); } - public void registForNoAuthProbes(List noAuthProbes) { + public List acceptNoAuthProbes(List noAuthProbes) { // Todo encryption key generation & probe key generation @@ -50,9 +51,23 @@ public class NoAuthProbeService { probe.setProbeKey(noAuth.getApiKey()); probe.setDomain(new Domain(1)); probe.setAuthorizeMember(new Member(1)); -// resProbe.add(probe); - this.probeService.regist(probe); - } + probe.setStatus(new MetaProbeStatus((short)1)); + probe.setTargetCount(0); + probe.setSensorCount(0); + probe.setEncryptionKey("111"); +// resprobe.add(probe); + this.probeService.regist(probe); + + noAuth.setStatus(new MetaNoAuthProbeStatus((short) 1)); + } + this.noAuthProbeDAO.save(noAuthProbes); + return this.readAllByDomain(noAuthProbes.get(0).getDomain()); + } + + public List denyNoauthProbes(List noAuthProbes) { + for (NoAuthProbe noAuth : noAuthProbes) noAuth.setStatus(new MetaNoAuthProbeStatus((short) 2)); + this.noAuthProbeDAO.save(noAuthProbes); + return this.readAllByDomain(noAuthProbes.get(0).getDomain()); } }