added objectmapper
This commit is contained in:
parent
f7f29a5344
commit
86a8ee756d
|
@ -1,6 +1,5 @@
|
||||||
package com.loafle.overflow.module.noauthprobe.service;
|
package com.loafle.overflow.module.noauthprobe.service;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.utils.StringConvertor;
|
|
||||||
import com.loafle.overflow.module.domain.model.Domain;
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus;
|
import com.loafle.overflow.module.meta.model.MetaNoAuthProbeStatus;
|
||||||
|
@ -9,13 +8,14 @@ import com.loafle.overflow.module.noauthprobe.dao.NoAuthProbeDAO;
|
||||||
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
|
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
|
||||||
import com.loafle.overflow.module.probe.model.Probe;
|
import com.loafle.overflow.module.probe.model.Probe;
|
||||||
import com.loafle.overflow.module.probe.service.ProbeService;
|
import com.loafle.overflow.module.probe.service.ProbeService;
|
||||||
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
|
import org.codehaus.jackson.type.TypeReference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by snoop on 17. 6. 28.
|
* Created by snoop on 17. 6. 28.
|
||||||
|
@ -29,6 +29,9 @@ public class NoAuthProbeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProbeService probeService;
|
private ProbeService probeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
public NoAuthProbe regist(NoAuthProbe noAuthProbe) {
|
public NoAuthProbe regist(NoAuthProbe noAuthProbe) {
|
||||||
|
|
||||||
noAuthProbe.setTempProbeKey(UUID.randomUUID().toString());
|
noAuthProbe.setTempProbeKey(UUID.randomUUID().toString());
|
||||||
|
@ -47,7 +50,7 @@ public class NoAuthProbeService {
|
||||||
return this.noAuthProbeDAO.findOne(id);
|
return this.noAuthProbeDAO.findOne(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<NoAuthProbe> acceptNoAuthProbes(List<NoAuthProbe> noAuthProbes) {
|
public List<NoAuthProbe> acceptNoAuthProbes(List<NoAuthProbe> noAuthProbes) throws IOException {
|
||||||
|
|
||||||
// Todo domain injection & member injection
|
// Todo domain injection & member injection
|
||||||
List<Probe> probes = new ArrayList<>();
|
List<Probe> probes = new ArrayList<>();
|
||||||
|
@ -66,6 +69,9 @@ public class NoAuthProbeService {
|
||||||
probe.setSensorCount(0);
|
probe.setSensorCount(0);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> objMap = null;
|
||||||
|
objMap = this.objectMapper.readValue(noAuth.getDescription(), new TypeReference<HashMap<String,Object>>() {});
|
||||||
|
|
||||||
|
|
||||||
// String dispName = noAuth.getHostName().isEmpty() ?
|
// String dispName = noAuth.getHostName().isEmpty() ?
|
||||||
// StringConvertor.intToIp(noAuth.getIpAddress()) : noAuth.getHostName();
|
// StringConvertor.intToIp(noAuth.getIpAddress()) : noAuth.getHostName();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.loafle.overflow.spring;
|
package com.loafle.overflow.spring;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
@ -69,6 +70,11 @@ public class JdbcConfiguration implements TransactionManagementConfigurer {
|
||||||
return entityManagerFactoryBean;
|
return entityManagerFactoryBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ObjectMapper getObjectMapper() {
|
||||||
|
return new ObjectMapper();
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Qualifier(value = "transactionManager")
|
@Qualifier(value = "transactionManager")
|
||||||
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||||
|
|
|
@ -29,6 +29,8 @@ public class SensorServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
SensorService sensorService;
|
SensorService sensorService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
|
@ -56,7 +58,9 @@ public class SensorServiceTest {
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
String json = objectMapper.writeValueAsString(res);
|
// String json = objectMapper.writeValueAsString(res);
|
||||||
|
|
||||||
|
String json = this.objectMapper.writeValueAsString(res);
|
||||||
|
|
||||||
System.out.println(json);
|
System.out.println(json);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user