use of org.thingsboard.server.dao.device.DeviceCredentialsService in project thingsboard by thingsboard.
the class PreviousDeviceCredentialsIdKeyGenerator method generate.
@Override
public Object generate(Object o, Method method, Object... objects) {
DeviceCredentialsService deviceCredentialsService = (DeviceCredentialsService) o;
DeviceCredentials deviceCredentials = (DeviceCredentials) objects[0];
if (deviceCredentials.getDeviceId() != null) {
DeviceCredentials oldDeviceCredentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(deviceCredentials.getDeviceId());
if (oldDeviceCredentials != null) {
return oldDeviceCredentials.getCredentialsId();
}
}
return NOT_VALID_DEVICE;
}
Aggregations