|
|
@ -199,10 +199,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
@QueryParam("limit") int limit) {
|
|
|
|
@QueryParam("limit") int limit) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (!StringUtils.isEmpty(name) && !StringUtils.isEmpty(role)) {
|
|
|
|
if (!StringUtils.isEmpty(name) && !StringUtils.isEmpty(role)) {
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
String msg = "Request contains both name and role parameters. Only one is allowed at once.";
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage("Request contains both name and role " +
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
"parameters. Only one is allowed " +
|
|
|
|
|
|
|
|
"at once.").build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status);
|
|
|
|
// RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status);
|
|
|
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
|
|
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
|
|
@ -291,9 +289,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
sinceDate = format.parse(ifModifiedSince);
|
|
|
|
sinceDate = format.parse(ifModifiedSince);
|
|
|
|
} catch (ParseException e) {
|
|
|
|
} catch (ParseException e) {
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
String msg = "Invalid date string is provided in [If-Modified-Since] header";
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage("Invalid date " +
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
"string is provided in 'If-Modified-Since' header").build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
request.setSince(sinceDate);
|
|
|
|
request.setSince(sinceDate);
|
|
|
|
if (requireDeviceInfo) {
|
|
|
|
if (requireDeviceInfo) {
|
|
|
@ -312,9 +309,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
sinceDate = format.parse(since);
|
|
|
|
sinceDate = format.parse(since);
|
|
|
|
} catch (ParseException e) {
|
|
|
|
} catch (ParseException e) {
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
String msg = "Invalid date string is provided in [since] filter";
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage("Invalid date " +
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
"string is provided in 'since' filter").build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
request.setSince(sinceDate);
|
|
|
|
request.setSince(sinceDate);
|
|
|
|
if (requireDeviceInfo) {
|
|
|
|
if (requireDeviceInfo) {
|
|
|
@ -547,6 +543,10 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
String msg = "Error occurred while retrieving role list of user '" + authorizedUser + "'";
|
|
|
|
String msg = "Error occurred while retrieving role list of user '" + authorizedUser + "'";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
|
|
|
|
|
|
|
}catch (BadRequestException e){
|
|
|
|
|
|
|
|
String msg = "Error occurred while validating the device group.";
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PaginationResult result = dms.getAllDevices(request, false);
|
|
|
|
PaginationResult result = dms.getAllDevices(request, false);
|
|
|
@ -563,7 +563,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Response.status(Response.Status.OK).entity(devices).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(devices).build();
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
String msg = "Invalid type, use either 'path' or 'full'";
|
|
|
|
String msg = "Invalid type, use either [path] or [full]";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (UnAuthorizedException e) {
|
|
|
|
} catch (UnAuthorizedException e) {
|
|
|
@ -597,12 +597,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
boolean response = deviceManagementProviderService.disenrollDevice(deviceIdentifier);
|
|
|
|
boolean response = deviceManagementProviderService.disenrollDevice(deviceIdentifier);
|
|
|
|
return Response.status(Response.Status.OK).entity(response).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(response).build();
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
String msg = "Error encountered while deleting device of type : " + deviceType + " and " +
|
|
|
|
String msg = "Error encountered while deleting requested device of type : " + deviceType ;
|
|
|
|
"ID : " + deviceId;
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()
|
|
|
|
|
|
|
|
).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -620,11 +617,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
return Response.status(Response.Status.CREATED).entity(response).build();
|
|
|
|
return Response.status(Response.Status.CREATED).entity(response).build();
|
|
|
|
|
|
|
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
log.error("Error encountered while updating device of type : " + deviceType + " and " +
|
|
|
|
String msg = "Error encountered while updating requested device of type : " + deviceType ;
|
|
|
|
"ID : " + deviceId);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage("Error while updating " +
|
|
|
|
|
|
|
|
"device of type " + deviceType + " and ID : " + deviceId).build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -665,10 +660,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
sinceDate = format.parse(ifModifiedSince);
|
|
|
|
sinceDate = format.parse(ifModifiedSince);
|
|
|
|
deviceData.setLastModifiedDate(sinceDate);
|
|
|
|
deviceData.setLastModifiedDate(sinceDate);
|
|
|
|
} catch (ParseException e) {
|
|
|
|
} catch (ParseException e) {
|
|
|
|
String msg = "Invalid date string is provided in 'If-Modified-Since' header";
|
|
|
|
String msg = "Invalid date string is provided in [If-Modified-Since] header";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -695,9 +689,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " +
|
|
|
|
return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " +
|
|
|
|
"after the timestamp provided in 'If-Modified-Since' header").build();
|
|
|
|
"after the timestamp provided in 'If-Modified-Since' header").build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(
|
|
|
|
String msg = "Requested device of type " + type + " does not exist";
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_NOT_FOUND).setMessage("Requested device of type '" +
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
type + "', which carries id '" + id + "' does not exist").build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Response.status(Response.Status.OK).entity(device).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(device).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -718,7 +711,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
dms);
|
|
|
|
dms);
|
|
|
|
return Response.status(Response.Status.OK).entity(snapshotWrapper).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(snapshotWrapper).build();
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
} catch (BadRequestException e) {
|
|
|
|
String msg = "Invalid type, use either 'path' or 'full'";
|
|
|
|
String msg = "Invalid type, use either [path] or [full]";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (UnAuthorizedException e) {
|
|
|
|
} catch (UnAuthorizedException e) {
|
|
|
@ -764,12 +757,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
sinceDate = format.parse(ifModifiedSince);
|
|
|
|
sinceDate = format.parse(ifModifiedSince);
|
|
|
|
} catch (ParseException e) {
|
|
|
|
} catch (ParseException e) {
|
|
|
|
String message = "Error occurred while parse the since date.Invalid date string is provided in " +
|
|
|
|
String message = "Invalid date string is provided in [If-Modified-Since] header";
|
|
|
|
"'If-Modified-Since' header";
|
|
|
|
|
|
|
|
log.error(message, e);
|
|
|
|
log.error(message, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(message).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage("Invalid date " +
|
|
|
|
|
|
|
|
"string is provided in 'If-Modified-Since' header").build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sinceDate != null) {
|
|
|
|
if (sinceDate != null) {
|
|
|
@ -778,16 +768,15 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
String message = "No device is modified after the timestamp provided in 'If-Modified-Since' header";
|
|
|
|
String message = "No device is modified after the timestamp provided in 'If-Modified-Since' header";
|
|
|
|
log.error(message);
|
|
|
|
log.error(message);
|
|
|
|
return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " +
|
|
|
|
return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " +
|
|
|
|
"after the timestamp provided in 'If-Modified-Since' header").build();
|
|
|
|
"after the timestamp provided in [If-Modified-Since] header").build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
device = dms.getDevice(id, requireDeviceInfo);
|
|
|
|
device = dms.getDevice(id, requireDeviceInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (device == null) {
|
|
|
|
if (device == null) {
|
|
|
|
String message = "Device does not exist with id '" + id + "'";
|
|
|
|
String message = "Device does not exist";
|
|
|
|
log.error(message);
|
|
|
|
log.error(message);
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(message).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(message).build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(id, device.getType());
|
|
|
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(id, device.getType());
|
|
|
|
// check whether the user is authorized
|
|
|
|
// check whether the user is authorized
|
|
|
@ -819,7 +808,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
DeviceManagementProviderService deviceManagementProviderService =
|
|
|
|
DeviceManagementProviderService deviceManagementProviderService =
|
|
|
|
DeviceMgtAPIUtils.getDeviceManagementService();
|
|
|
|
DeviceMgtAPIUtils.getDeviceManagementService();
|
|
|
|
if (deviceIds == null || deviceIds.isEmpty()) {
|
|
|
|
if (deviceIds == null || deviceIds.isEmpty()) {
|
|
|
|
String msg = "Required values of device identifiers are not set..";
|
|
|
|
String msg = "Required values of device identifiers are not set.";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -901,9 +890,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
fm = dms.getFeatureManager(type);
|
|
|
|
fm = dms.getFeatureManager(type);
|
|
|
|
} catch (DeviceTypeNotFoundException e) {
|
|
|
|
} catch (DeviceTypeNotFoundException e) {
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(
|
|
|
|
String msg = "No device type found with name : " + type ;
|
|
|
|
new ErrorResponse.ErrorResponseBuilder()
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
.setMessage("No device type found with name '" + type + "'").build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (fm != null) {
|
|
|
|
if (fm != null) {
|
|
|
|
features = fm.getFeatures();
|
|
|
|
features = fm.getFeatures();
|
|
|
@ -1125,8 +1113,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
return Response.serverError().entity(
|
|
|
|
return Response.serverError().entity(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
} catch (InputValidationException e) {
|
|
|
|
} catch (InputValidationException e) {
|
|
|
|
String msg = "Error occurred while fetching the operations for the '" + type + "' device, which " +
|
|
|
|
String msg = "Error occurred while fetching the operations for the type : " + type + " device";
|
|
|
|
"carries the id '" + id + "'";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
@ -1135,7 +1122,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
} catch (DeviceTypeNotFoundException e) {
|
|
|
|
} catch (DeviceTypeNotFoundException e) {
|
|
|
|
String msg = "No device type found with name '" + type + "'";
|
|
|
|
String msg = "No device type found with name : " + type ;
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1245,11 +1232,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
boolean response = deviceManagementProviderService.changeDeviceStatus(deviceIdentifier, newsStatus);
|
|
|
|
boolean response = deviceManagementProviderService.changeDeviceStatus(deviceIdentifier, newsStatus);
|
|
|
|
return Response.status(Response.Status.OK).entity(response).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(response).build();
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
String msg = "Error occurred while changing device status of type : " + type + " and " +
|
|
|
|
String msg = "Error occurred while changing device status of device type : " + type ;
|
|
|
|
"device id : " + id;
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1277,11 +1262,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
List<DeviceStatus> deviceStatusHistory = deviceManagementProviderService.getDeviceStatusHistory(persistedDevice);
|
|
|
|
List<DeviceStatus> deviceStatusHistory = deviceManagementProviderService.getDeviceStatusHistory(persistedDevice);
|
|
|
|
return Response.status(Response.Status.OK).entity(deviceStatusHistory).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(deviceStatusHistory).build();
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
String msg = "Error occurred while retreiving device status history for device of type : " + type + " and " +
|
|
|
|
String msg = "Error occurred while retrieving device status history for device of type : " + type ;
|
|
|
|
"device id : " + id;
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1309,11 +1292,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
List<DeviceStatus> deviceStatusHistory = deviceManagementProviderService.getDeviceCurrentEnrolmentStatusHistory(persistedDevice);
|
|
|
|
List<DeviceStatus> deviceStatusHistory = deviceManagementProviderService.getDeviceCurrentEnrolmentStatusHistory(persistedDevice);
|
|
|
|
return Response.status(Response.Status.OK).entity(deviceStatusHistory).build();
|
|
|
|
return Response.status(Response.Status.OK).entity(deviceStatusHistory).build();
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
String msg = "Error occurred while retreiving device status history for device of type : " + type + " and " +
|
|
|
|
String msg = "Error occurred while retrieving device status history for device of type : " + type;
|
|
|
|
"device id : " + id;
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1390,7 +1371,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
String errorMessage = "Issue in retrieving deivce management service instance";
|
|
|
|
String errorMessage = "Issue in retrieving device management service instance";
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
log.error(errorMessage, e);
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(errorMessage).build()).build();
|
|
|
@ -1590,7 +1571,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
DeviceType deviceTypeObj = DeviceManagerUtil.getDeviceType(
|
|
|
|
DeviceType deviceTypeObj = DeviceManagerUtil.getDeviceType(
|
|
|
|
deviceType, tenantId);
|
|
|
|
deviceType, tenantId);
|
|
|
|
if (deviceTypeObj == null) {
|
|
|
|
if (deviceTypeObj == null) {
|
|
|
|
String msg = "Error, device of type: " + deviceType + " does not exist";
|
|
|
|
String msg = "Device of type: " + deviceType + " does not exist";
|
|
|
|
log.error(msg);
|
|
|
|
log.error(msg);
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|