import com.fasterxml.jackson.annotation.JsonProperty;
import com.samsung.samserver.domain.Device;
import com.samsung.samserver.service.DeviceService;
+import com.samsung.samserver.service.impl.GeoIPService;
import com.samsung.samserver.web.rest.util.PaginationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.*;
import java.util.*;
import lombok.*;
+import static com.samsung.samserver.service.impl.GeoIPService.GeoIP;
+
/**
* REST service implementation for get updates.
*
@Autowired
private DeviceService deviceService;
+ @Autowired
+ private GeoIPService geoIPService;
+
public ResponseEntity<List<GetDevicesUIRestService.UIDevice>> getAllDevices(Pageable pageable) {
log.debug("UI request to get all devices"); //NOSONAR
Page<Device> devices = deviceService.findAll(pageable);
uiDevice.setLocked(device.getLocked()!=null && !device.getLocked().equals("0") ? 1:0);
uiDevice.setUiDeviceOS(new UIDeviceOS(device.getSw(), device.getOsname(), device.getOsver()));
uiDevice.setUiDeviceType(new UIDeviceType (device.getDtype().getName(), device.getDtype().getDescr()));
+ uiDevice.setGeoIP(geoIPService.getGeo(device.getIpaddr()));
uiDevices.add(uiDevice);
}
Page<UIDevice> page = new PageImpl(uiDevices, pageable, devices.getTotalPages());
@JsonProperty("os")
private UIDeviceOS uiDeviceOS;
+
+ @JsonProperty("geo")
+ private GeoIP geoIP;
}
@Getter @Setter @ToString