|
|
@ -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) {
|
|
|
@ -646,6 +642,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);
|
|
|
@ -662,7 +662,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) {
|
|
|
@ -696,12 +696,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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -719,11 +716,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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -764,10 +759,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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -794,9 +788,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();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -817,7 +810,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) {
|
|
|
@ -863,12 +856,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) {
|
|
|
@ -877,16 +867,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
|
|
|
@ -918,7 +907,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();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1000,9 +989,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();
|
|
|
@ -1224,8 +1212,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) {
|
|
|
@ -1234,7 +1221,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();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1344,11 +1331,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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1376,11 +1361,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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1408,11 +1391,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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1489,7 +1470,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();
|
|
|
@ -1689,7 +1670,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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|