Search in sources :

Example 1 with DeviceCredentialsService

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;
}
Also used : DeviceCredentialsService(org.thingsboard.server.dao.device.DeviceCredentialsService) DeviceCredentials(org.thingsboard.server.common.data.security.DeviceCredentials)

Aggregations

DeviceCredentials (org.thingsboard.server.common.data.security.DeviceCredentials)1 DeviceCredentialsService (org.thingsboard.server.dao.device.DeviceCredentialsService)1