Search in sources :

Example 1 with TenantProfileUpdateResult

use of org.thingsboard.server.common.transport.profile.TenantProfileUpdateResult in project thingsboard by thingsboard.

the class DefaultTransportTenantProfileCache method put.

@Override
public TenantProfileUpdateResult put(ByteString profileBody) {
    Optional<TenantProfile> profileOpt = dataDecodingEncodingService.decode(profileBody.toByteArray());
    if (profileOpt.isPresent()) {
        TenantProfile newProfile = profileOpt.get();
        log.trace("[{}] put: {}", newProfile.getId(), newProfile);
        Set<TenantId> affectedTenants = tenantProfileIds.get(newProfile.getId());
        return new TenantProfileUpdateResult(newProfile, affectedTenants != null ? affectedTenants : Collections.emptySet());
    } else {
        log.warn("Failed to decode profile: {}", profileBody.toString());
        return new TenantProfileUpdateResult(null, Collections.emptySet());
    }
}
Also used : TenantProfileUpdateResult(org.thingsboard.server.common.transport.profile.TenantProfileUpdateResult) TenantId(org.thingsboard.server.common.data.id.TenantId) TenantProfile(org.thingsboard.server.common.data.TenantProfile)

Aggregations

TenantProfile (org.thingsboard.server.common.data.TenantProfile)1 TenantId (org.thingsboard.server.common.data.id.TenantId)1 TenantProfileUpdateResult (org.thingsboard.server.common.transport.profile.TenantProfileUpdateResult)1