mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixing issues with query-devices
This commit is contained in:
parent
48a0801faf
commit
82447ef865
@ -652,10 +652,13 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
List<Device> devices;
|
List<Device> devices;
|
||||||
DeviceList deviceList = new DeviceList();
|
DeviceList deviceList = new DeviceList();
|
||||||
try {
|
try {
|
||||||
|
if(map.getProperties().isEmpty()){
|
||||||
|
return Response.status(Response.Status.BAD_REQUEST).entity("No search criteria defined.").build();
|
||||||
|
}
|
||||||
DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService();
|
DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService();
|
||||||
devices = dms.getDevicesBasedOnProperties(map.getProperties());
|
devices = dms.getDevicesBasedOnProperties(map.getProperties());
|
||||||
if(devices == null || devices.isEmpty()){
|
if(devices == null || devices.isEmpty()){
|
||||||
return Response.status(Response.Status.OK).entity("No device found matching query criteria.").build();
|
return Response.status(Response.Status.NOT_FOUND).entity("No device found matching query criteria.").build();
|
||||||
}
|
}
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
String msg = "Error occurred while searching for devices that matches the provided device properties";
|
String msg = "Error occurred while searching for devices that matches the provided device properties";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user