[SECARSP-149] *server side unit tests
[platform/core/security/suspicious-activity-monitor.git] / server / samserver / src / main / java / com / samsung / samserver / web / rest / service / ui / GetDevicesRestService.java
index cfc2ef9..fc47461 100644 (file)
@@ -39,19 +39,20 @@ public class GetDevicesRestService {
         Page<Device> devices = deviceService.findAll(pageable);
         List<UIDevice> uiDevices = new ArrayList<>();
         for (Device device: devices) {
-            UIDevice uiDevice = new UIDevice();
-            uiDevice.setId(device.getId());
-            uiDevice.setDuid(device.getDuid());
-            uiDevice.setCtime(device.getCtime());
-            uiDevice.setModel(device.getModel());
-            uiDevice.setIpaddr(device.getIpaddr());
-            uiDevice.setSn(device.getSn());
-            uiDevice.setDescr(device.getDescr());
-            uiDevice.setLocked(device.getLocked()!=null && !device.getLocked().equals("0") ? 1:0);
-            uiDevice.setUiDeviceOS(new UIDevice.UIDeviceOS(device.getSw(), device.getOsname(), device.getOsver()));
-            uiDevice.setUiDeviceType(new UIDevice.UIDeviceType(device.getDtype().getName(), device.getDtype().getDescr()));
-            uiDevice.setGeoIP(geoIPService.getGeo(device.getIpaddr()));
-            uiDevices.add(uiDevice);
+            uiDevices.add(UIDevice.builder()
+                .id(device.getId())
+                .duid(device.getDuid())
+                .ctime(device.getCtime())
+                .model(device.getModel())
+                .ipaddr(device.getIpaddr())
+                .sn(device.getSn())
+                .descr(device.getDescr())
+                .locked(device.getLocked()!=null && !device.getLocked().equals("0") ? 1:0)
+                .uiDeviceOS(new UIDevice.UIDeviceOS(device.getSw(), device.getOsname(), device.getOsver()))
+                .uiDeviceType(new UIDevice.UIDeviceType(device.getDtype().getName(), device.getDtype().getDescr()))
+                .geoIP(geoIPService.getGeo(device.getIpaddr()))
+                .build()
+            );
         }
         Page<UIDevice> page = new PageImpl(uiDevices, pageable, devices.getTotalPages());
         HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/dashboard/devices");