ing
This commit is contained in:
parent
e34aed3474
commit
e731aedf33
12
pom.xml
12
pom.xml
@ -24,12 +24,13 @@
|
|||||||
<caffeine.version>2.5.6</caffeine.version>
|
<caffeine.version>2.5.6</caffeine.version>
|
||||||
<protoc.version>3.5.1</protoc.version>
|
<protoc.version>3.5.1</protoc.version>
|
||||||
<spring.version>5.0.6.RELEASE</spring.version>
|
<spring.version>5.0.6.RELEASE</spring.version>
|
||||||
|
<spring.data.commons.version>2.0.7.RELEASE</spring.data.commons.version>
|
||||||
<spring.data.jpa.version>2.0.7.RELEASE</spring.data.jpa.version>
|
<spring.data.jpa.version>2.0.7.RELEASE</spring.data.jpa.version>
|
||||||
<spring.data.redis.version>2.0.7.RELEASE</spring.data.redis.version>
|
<spring.data.redis.version>2.0.7.RELEASE</spring.data.redis.version>
|
||||||
<spring.crypto.version>5.0.5.RELEASE</spring.crypto.version>
|
<spring.crypto.version>5.0.5.RELEASE</spring.crypto.version>
|
||||||
<!-- <gson.version>2.8.2</gson.version> -->
|
<!-- <gson.version>2.8.2</gson.version> -->
|
||||||
<jackson.mapper.version>1.9.13</jackson.mapper.version>
|
<jackson.mapper.version>1.9.13</jackson.mapper.version>
|
||||||
<hibernate.version>5.2.10.Final</hibernate.version>
|
<hibernate.version>5.3.1.Final</hibernate.version>
|
||||||
<javax.mail.version>1.4.7</javax.mail.version>
|
<javax.mail.version>1.4.7</javax.mail.version>
|
||||||
<javax.mail-api.version>1.6.0</javax.mail-api.version>
|
<javax.mail-api.version>1.6.0</javax.mail-api.version>
|
||||||
<apache.velocity.version>1.7</apache.velocity.version>
|
<apache.velocity.version>1.7</apache.velocity.version>
|
||||||
@ -49,7 +50,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.loafle.overflow</groupId>
|
<groupId>com.loafle.overflow</groupId>
|
||||||
<artifactId>commons-java</artifactId>
|
<artifactId>commons-java</artifactId>
|
||||||
<version>1.0.9-SNAPSHOT</version>
|
<version>1.0.10-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -81,6 +82,13 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring Dependency-->
|
<!-- Spring Dependency-->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.data</groupId>
|
||||||
|
<artifactId>spring-data-commons</artifactId>
|
||||||
|
<version>${spring.data.jpa.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-jpa</artifactId>
|
<artifactId>spring-data-jpa</artifactId>
|
||||||
|
@ -48,7 +48,7 @@ public class EmailAuthService {
|
|||||||
// "http://127.0.0.1:4200/auth/";
|
// "http://127.0.0.1:4200/auth/";
|
||||||
|
|
||||||
public EmailAuth read(Long id) {
|
public EmailAuth read(Long id) {
|
||||||
return this.emailAuthDAO.findOne(id);
|
return this.emailAuthDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmailAuth readBySignupAuthKey(String token) throws OverflowException {
|
public EmailAuth readBySignupAuthKey(String token) throws OverflowException {
|
||||||
|
@ -22,7 +22,7 @@ public class CentralInfraHostService implements InfraHostService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InfraHost read(Long id) throws OverflowException {
|
public InfraHost read(Long id) throws OverflowException {
|
||||||
return this.infraHostDAO.findOne(id);
|
return this.infraHostDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InfraHost readByProbeIdAndIpv4(Long probeId, String ip) throws OverflowException {
|
public InfraHost readByProbeIdAndIpv4(Long probeId, String ip) throws OverflowException {
|
||||||
|
@ -20,6 +20,6 @@ public class CentralInfraMachineService implements InfraMachineService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InfraMachine read(Long id) {
|
public InfraMachine read(Long id) {
|
||||||
return this.infraMachineDAO.findOne(id);
|
return this.infraMachineDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,6 @@ public class CentralInfraOSApplicationService implements InfraOSApplicationServi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InfraOSApplication read(Long id) throws OverflowException {
|
public InfraOSApplication read(Long id) throws OverflowException {
|
||||||
return this.infraOSApplicationDAO.findOne(id);
|
return this.infraOSApplicationDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,6 @@ public class CentralInfraOSDaemonService implements InfraOSDaemonService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InfraOSDaemon read(Long id) throws OverflowException {
|
public InfraOSDaemon read(Long id) throws OverflowException {
|
||||||
return this.infraOSDaemonDAO.findOne(id);
|
return this.infraOSDaemonDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class CentralInfraOSPortService implements InfraOSPortService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InfraOSPort read(Long id) throws OverflowException {
|
public InfraOSPort read(Long id) throws OverflowException {
|
||||||
return this.infraOSPortDAO.findOne(id);
|
return this.infraOSPortDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InfraOSPort readByInfraOSIDAndPortAndPortType(Long infraOSID, Integer port, String portType)
|
public InfraOSPort readByInfraOSIDAndPortAndPortType(Long infraOSID, Integer port, String portType)
|
||||||
|
@ -21,6 +21,6 @@ public class CentralInfraOSService implements InfraOSService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InfraOS read(Long id) throws OverflowException {
|
public InfraOS read(Long id) throws OverflowException {
|
||||||
return this.infraOSDAO.findOne(id);
|
return this.infraOSDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class CentralInfraService implements InfraService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Infra read(Long id) throws OverflowException {
|
public Infra read(Long id) throws OverflowException {
|
||||||
Infra infra = this.infraDAO.findOne(id);
|
Infra infra = this.infraDAO.findById(id).get();
|
||||||
return infra;
|
return infra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class CentralInfraServiceService implements InfraServiceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InfraService read(Long id) throws OverflowException {
|
public InfraService read(Long id) throws OverflowException {
|
||||||
return this.infraServiceDAO.findOne(id);
|
return this.infraServiceDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InfraService readByInfraHostIDAndPortAndPortType(Long infraHostID, int port, String portType)
|
public InfraService readByInfraHostIDAndPortAndPortType(Long infraHostID, int port, String portType)
|
||||||
|
@ -245,7 +245,7 @@ public class CentralMemberService implements MemberService {
|
|||||||
throw new OverflowException("SignInIdNotExistException()", new Throwable());
|
throw new OverflowException("SignInIdNotExistException()", new Throwable());
|
||||||
}
|
}
|
||||||
|
|
||||||
Member resMember = this.memberDAO.findOne(memberId);
|
Member resMember = this.memberDAO.findById(memberId).get();
|
||||||
return resMember;
|
return resMember;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,11 +51,11 @@ public class CentralMemberTotpService implements MemberTotpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Long id) throws OverflowException {
|
public void remove(Long id) throws OverflowException {
|
||||||
this.totpDAO.delete(id);
|
this.totpDAO.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemberTotp read(Long id) throws OverflowException {
|
public MemberTotp read(Long id) throws OverflowException {
|
||||||
return this.totpDAO.findOne(id);
|
return this.totpDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkCodeForMember(String memberEmail, String code) throws OverflowException {
|
public boolean checkCodeForMember(String memberEmail, String code) throws OverflowException {
|
||||||
|
@ -28,6 +28,6 @@ public class CentralMetaHistoryTypeService implements MetaHistoryTypeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<MetaHistoryType> registAll(List<MetaHistoryType> metaHistoryTypes) throws OverflowException {
|
public List<MetaHistoryType> registAll(List<MetaHistoryType> metaHistoryTypes) throws OverflowException {
|
||||||
return (List<MetaHistoryType>)this.hisotyTypeDAO.save(metaHistoryTypes);
|
return (List<MetaHistoryType>)this.hisotyTypeDAO.saveAll(metaHistoryTypes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class CentralMetaSensorDisplayItemService implements MetaSensorDisplayIte
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MetaSensorDisplayItem read(Long id) throws OverflowException {
|
public MetaSensorDisplayItem read(Long id) throws OverflowException {
|
||||||
return this.displayItemDAO.findOne(id);
|
return this.displayItemDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MetaSensorDisplayItem> readAllByCrawlerID(Short metaCrawlerID) throws OverflowException {
|
public List<MetaSensorDisplayItem> readAllByCrawlerID(Short metaCrawlerID) throws OverflowException {
|
||||||
|
@ -28,6 +28,6 @@ public class CentralMetaSensorItemTypeService implements MetaSensorItemTypeServi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<MetaSensorItemType> registAll(List<MetaSensorItemType> list) throws OverflowException {
|
public List<MetaSensorItemType> registAll(List<MetaSensorItemType> list) throws OverflowException {
|
||||||
return (List<MetaSensorItemType>)this.sensorItemTypeDAO.save(list);
|
return (List<MetaSensorItemType>)this.sensorItemTypeDAO.saveAll(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,13 +98,13 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public NoAuthProbe read(Long id) {
|
public NoAuthProbe read(Long id) {
|
||||||
return this.noAuthProbeDAO.findOne(id);
|
return this.noAuthProbeDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@WebappAPI
|
@WebappAPI
|
||||||
@Transactional
|
@Transactional
|
||||||
public List<NoAuthProbe> acceptNoAuthProbe(Long noAuthProbeID) throws OverflowException {
|
public List<NoAuthProbe> acceptNoAuthProbe(Long noAuthProbeID) throws OverflowException {
|
||||||
NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID);
|
NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findById(noAuthProbeID).get();
|
||||||
|
|
||||||
NoAuthProbeDescription noAuthProbeDescription = null;
|
NoAuthProbeDescription noAuthProbeDescription = null;
|
||||||
try {
|
try {
|
||||||
@ -205,7 +205,7 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
|
|||||||
|
|
||||||
@WebappAPI
|
@WebappAPI
|
||||||
public List<NoAuthProbe> denyNoauthProbe(Long noAuthProbeID) throws OverflowException {
|
public List<NoAuthProbe> denyNoauthProbe(Long noAuthProbeID) throws OverflowException {
|
||||||
NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findOne(noAuthProbeID);
|
NoAuthProbe noAuthProbe = this.noAuthProbeDAO.findById(noAuthProbeID).get();
|
||||||
|
|
||||||
noAuthProbe.setMetaNoAuthProbeStatus(new MetaNoAuthProbeStatus((short) 2));
|
noAuthProbe.setMetaNoAuthProbeStatus(new MetaNoAuthProbeStatus((short) 2));
|
||||||
this.noAuthProbeDAO.save(noAuthProbe);
|
this.noAuthProbeDAO.save(noAuthProbe);
|
||||||
|
@ -48,7 +48,7 @@ public class CentralNotificationService implements NotificationService {
|
|||||||
for (Notification n : list) {
|
for (Notification n : list) {
|
||||||
n.setConfirmDate(new Date());
|
n.setConfirmDate(new Date());
|
||||||
}
|
}
|
||||||
this.notificationDAO.save(list);
|
this.notificationDAO.saveAll(list);
|
||||||
return this.readAllByMemberEmail(memberEmail, pageParams);
|
return this.readAllByMemberEmail(memberEmail, pageParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,12 +58,12 @@ public class CentralNotificationService implements NotificationService {
|
|||||||
for (Notification n : list) {
|
for (Notification n : list) {
|
||||||
n.setConfirmDate(null);
|
n.setConfirmDate(null);
|
||||||
}
|
}
|
||||||
this.notificationDAO.save(list);
|
this.notificationDAO.saveAll(list);
|
||||||
return this.readAllByMemberEmail(memberEmail, pageParams);
|
return this.readAllByMemberEmail(memberEmail, pageParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Notification markAsRead(Long notificationID) throws OverflowException {
|
public Notification markAsRead(Long notificationID) throws OverflowException {
|
||||||
Notification notification = this.notificationDAO.findOne(notificationID);
|
Notification notification = this.notificationDAO.findById(notificationID).get();
|
||||||
notification.setConfirmDate(new Date());
|
notification.setConfirmDate(new Date());
|
||||||
return this.notificationDAO.save(notification);
|
return this.notificationDAO.save(notification);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class CentralProbeHostService implements ProbeHostService {
|
|||||||
private ProbeHostDAO probeHostDAO;
|
private ProbeHostDAO probeHostDAO;
|
||||||
|
|
||||||
public ProbeHost read(Long id) throws OverflowException {
|
public ProbeHost read(Long id) throws OverflowException {
|
||||||
return this.probeHostDAO.findOne(id);
|
return this.probeHostDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProbeHost readByProbeID(Long probeID) throws OverflowException {
|
public ProbeHost readByProbeID(Long probeID) throws OverflowException {
|
||||||
|
@ -28,7 +28,7 @@ public class CentralProbeService implements ProbeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Probe> regist(List<Probe> probes) throws OverflowException {
|
public List<Probe> regist(List<Probe> probes) throws OverflowException {
|
||||||
return (List<Probe>)this.probeDAO.save(probes);
|
return (List<Probe>)this.probeDAO.saveAll(probes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Probe> readAllByDomainID(Long domainID) throws OverflowException {
|
public List<Probe> readAllByDomainID(Long domainID) throws OverflowException {
|
||||||
@ -37,7 +37,7 @@ public class CentralProbeService implements ProbeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Probe read(Long id) throws OverflowException {
|
public Probe read(Long id) throws OverflowException {
|
||||||
return this.probeDAO.findOne(id);
|
return this.probeDAO.findById(id).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Probe readByProbeKey(String probeKey) throws OverflowException {
|
public Probe readByProbeKey(String probeKey) throws OverflowException {
|
||||||
@ -49,18 +49,18 @@ public class CentralProbeService implements ProbeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean remove(Long id) throws OverflowException {
|
public boolean remove(Long id) throws OverflowException {
|
||||||
this.probeDAO.delete(id);
|
this.probeDAO.deleteById(id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Probe increaseTargetCount(Probe probe) {
|
public Probe increaseTargetCount(Probe probe) {
|
||||||
Probe p = this.probeDAO.findOne(probe.getId());
|
Probe p = this.probeDAO.findById(probe.getId()).get();
|
||||||
p.setTargetCount(p.getTargetCount() + 1);
|
p.setTargetCount(p.getTargetCount() + 1);
|
||||||
return this.probeDAO.save(p);
|
return this.probeDAO.save(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Probe decreaseTargetCount(Probe probe) {
|
public Probe decreaseTargetCount(Probe probe) {
|
||||||
Probe p = this.probeDAO.findOne(probe.getId());
|
Probe p = this.probeDAO.findById(probe.getId()).get();
|
||||||
int count = p.getTargetCount();
|
int count = p.getTargetCount();
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
p.setTargetCount(count - 1);
|
p.setTargetCount(count - 1);
|
||||||
@ -69,7 +69,7 @@ public class CentralProbeService implements ProbeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Probe modifyDisplayName(Long probeId, String displayName) {
|
public Probe modifyDisplayName(Long probeId, String displayName) {
|
||||||
Probe probe = this.probeDAO.findOne(probeId);
|
Probe probe = this.probeDAO.findById(probeId).get();
|
||||||
probe.setDisplayName(displayName);
|
probe.setDisplayName(displayName);
|
||||||
return this.probeDAO.save(probe);
|
return this.probeDAO.save(probe);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class CentralSensorItemService implements SensorItemService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public SensorItem regist(SensorItem sensorItem) throws OverflowException {
|
public SensorItem regist(SensorItem sensorItem) throws OverflowException {
|
||||||
Sensor s = sensorDAO.findOne(sensorItem.getSensor().getId());
|
Sensor s = sensorDAO.findById(sensorItem.getSensor().getId()).get();
|
||||||
s.setItemCount((short) (s.getItemCount() + 1));
|
s.setItemCount((short) (s.getItemCount() + 1));
|
||||||
this.sensorDAO.save(s);
|
this.sensorDAO.save(s);
|
||||||
return this.sensorItemDAO.save(sensorItem);
|
return this.sensorItemDAO.save(sensorItem);
|
||||||
@ -37,15 +37,15 @@ public class CentralSensorItemService implements SensorItemService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean registAll(List<SensorItem> sensorItemList) throws OverflowException {
|
public boolean registAll(List<SensorItem> sensorItemList) throws OverflowException {
|
||||||
Sensor s = sensorDAO.findOne(sensorItemList.get(0).getSensor().getId());
|
Sensor s = sensorDAO.findById(sensorItemList.get(0).getSensor().getId()).get();
|
||||||
s.setItemCount((short) sensorItemList.size());
|
s.setItemCount((short) sensorItemList.size());
|
||||||
this.sensorDAO.save(s);
|
this.sensorDAO.save(s);
|
||||||
this.sensorItemDAO.save(sensorItemList);
|
this.sensorItemDAO.saveAll(sensorItemList);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SensorItem read(String id) throws OverflowException {
|
public SensorItem read(String id) throws OverflowException {
|
||||||
return this.sensorItemDAO.findOne(Long.valueOf(id));
|
return this.sensorItemDAO.findById(Long.valueOf(id)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<SensorItem> readAllBySensorID(Long sensorID, PageParams pageParams) throws OverflowException {
|
public Page<SensorItem> readAllBySensorID(Long sensorID, PageParams pageParams) throws OverflowException {
|
||||||
|
@ -86,25 +86,25 @@ public class CentralSensorService implements SensorService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Sensor read(Long id) throws OverflowException {
|
public Sensor read(Long id) throws OverflowException {
|
||||||
return this.sensorDAO.findOne(Long.valueOf(id));
|
return this.sensorDAO.findById(Long.valueOf(id)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void remove(Long sensorID) throws OverflowException {
|
public void remove(Long sensorID) throws OverflowException {
|
||||||
Sensor sensor = this.sensorDAO.findOne(sensorID);
|
Sensor sensor = this.sensorDAO.findById(sensorID).get();
|
||||||
this.targetService.decreaseSensorCount(sensor.getTarget());
|
this.targetService.decreaseSensorCount(sensor.getTarget());
|
||||||
this.sensorDAO.delete(sensor);
|
this.sensorDAO.delete(sensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Sensor start(Long sensorID) throws OverflowException {
|
public Sensor start(Long sensorID) throws OverflowException {
|
||||||
Sensor sensor = this.sensorDAO.findOne(sensorID);
|
Sensor sensor = this.sensorDAO.findById(sensorID).get();
|
||||||
MetaSensorStatus status = new MetaSensorStatus((short) 1);
|
MetaSensorStatus status = new MetaSensorStatus((short) 1);
|
||||||
sensor.setMetaSensorStatus(status);
|
sensor.setMetaSensorStatus(status);
|
||||||
return this.sensorDAO.save(sensor);
|
return this.sensorDAO.save(sensor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Sensor stop(Long sensorID) throws OverflowException {
|
public Sensor stop(Long sensorID) throws OverflowException {
|
||||||
Sensor sensor = this.sensorDAO.findOne(sensorID);
|
Sensor sensor = this.sensorDAO.findById(sensorID).get();
|
||||||
MetaSensorStatus status = new MetaSensorStatus((short) 2);
|
MetaSensorStatus status = new MetaSensorStatus((short) 2);
|
||||||
sensor.setMetaSensorStatus(status);
|
sensor.setMetaSensorStatus(status);
|
||||||
return this.sensorDAO.save(sensor);
|
return this.sensorDAO.save(sensor);
|
||||||
|
@ -50,7 +50,7 @@ public class CentralTargetService implements TargetService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Target read(String id) throws OverflowException {
|
public Target read(String id) throws OverflowException {
|
||||||
return this.targetDAO.findOne(Long.valueOf(id));
|
return this.targetDAO.findById(Long.valueOf(id)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Target modify(Target target) throws OverflowException {
|
public Target modify(Target target) throws OverflowException {
|
||||||
@ -68,13 +68,13 @@ public class CentralTargetService implements TargetService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Target increaseSensorCount(Target target) throws OverflowException {
|
public Target increaseSensorCount(Target target) throws OverflowException {
|
||||||
Target t = this.targetDAO.findOne(target.getId());
|
Target t = this.targetDAO.findById(target.getId()).get();
|
||||||
t.setSensorCount(t.getSensorCount() + 1);
|
t.setSensorCount(t.getSensorCount() + 1);
|
||||||
return this.targetDAO.save(t);
|
return this.targetDAO.save(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Target decreaseSensorCount(Target target) throws OverflowException {
|
public Target decreaseSensorCount(Target target) throws OverflowException {
|
||||||
Target t = this.targetDAO.findOne(target.getId());
|
Target t = this.targetDAO.findById(target.getId()).get();
|
||||||
int count = t.getSensorCount();
|
int count = t.getSensorCount();
|
||||||
if (t.getSensorCount() > 0) {
|
if (t.getSensorCount() > 0) {
|
||||||
t.setSensorCount(count - 1);
|
t.setSensorCount(count - 1);
|
||||||
|
@ -5,11 +5,15 @@ import com.loafle.overflow.central.redis.service.RedisMessagePublisher;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||||
|
import org.springframework.data.redis.connection.jedis.JedisClientConfiguration;
|
||||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.connection.jedis.JedisClientConfiguration.JedisClientConfigurationBuilder;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.listener.ChannelTopic;
|
import org.springframework.data.redis.listener.ChannelTopic;
|
||||||
import org.springframework.data.redis.serializer.GenericToStringSerializer;
|
import org.springframework.data.redis.serializer.GenericToStringSerializer;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -25,9 +29,22 @@ public class RedisConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
JedisConnectionFactory jedisConnectionFactory() {
|
JedisConnectionFactory jedisConnectionFactory() {
|
||||||
JedisConnectionFactory jedisConFactory = new JedisConnectionFactory();
|
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration();
|
||||||
jedisConFactory.setHostName(host);
|
redisStandaloneConfiguration.setHostName(host);
|
||||||
jedisConFactory.setPort(port);
|
redisStandaloneConfiguration.setPort(port);
|
||||||
|
// redisStandaloneConfiguration.setDatabase(0);
|
||||||
|
// redisStandaloneConfiguration.setPassword(RedisPassword.of("password"));
|
||||||
|
|
||||||
|
JedisClientConfigurationBuilder jedisClientConfiguration = JedisClientConfiguration.builder();
|
||||||
|
jedisClientConfiguration.connectTimeout(Duration.ofSeconds(60));// 60s connection timeout
|
||||||
|
|
||||||
|
JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(redisStandaloneConfiguration,
|
||||||
|
jedisClientConfiguration.build());
|
||||||
|
|
||||||
|
|
||||||
|
// JedisConnectionFactory jedisConFactory = new JedisConnectionFactory();
|
||||||
|
// jedisConFactory.setHostName(host);
|
||||||
|
// jedisConFactory.setPort(port);
|
||||||
return jedisConFactory;
|
return jedisConFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user