Device Controller
This commit is contained in:
parent
4443fbcb27
commit
4ed34e5468
@ -218,6 +218,7 @@ public class DeviceController extends BaseController {
|
|||||||
@RequestBody SaveDeviceWithCredentialsRequest deviceAndCredentials) throws ThingsboardException {
|
@RequestBody SaveDeviceWithCredentialsRequest deviceAndCredentials) throws ThingsboardException {
|
||||||
Device device = checkNotNull(deviceAndCredentials.getDevice());
|
Device device = checkNotNull(deviceAndCredentials.getDevice());
|
||||||
DeviceCredentials credentials = checkNotNull(deviceAndCredentials.getCredentials());
|
DeviceCredentials credentials = checkNotNull(deviceAndCredentials.getCredentials());
|
||||||
|
boolean created = device.getId() == null;
|
||||||
try {
|
try {
|
||||||
device.setTenantId(getCurrentUser().getTenantId());
|
device.setTenantId(getCurrentUser().getTenantId());
|
||||||
checkEntity(device.getId(), device, Resource.DEVICE);
|
checkEntity(device.getId(), device, Resource.DEVICE);
|
||||||
@ -231,7 +232,7 @@ public class DeviceController extends BaseController {
|
|||||||
return savedDevice;
|
return savedDevice;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logEntityAction(emptyId(EntityType.DEVICE), device,
|
logEntityAction(emptyId(EntityType.DEVICE), device,
|
||||||
null, device.getId() == null ? ActionType.ADDED : ActionType.UPDATED, e);
|
null, created ? ActionType.ADDED : ActionType.UPDATED, e);
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user