Search in sources :

Example 1 with NULL_UUID

use of org.thingsboard.server.dao.model.ModelConstants.NULL_UUID in project thingsboard by thingsboard.

the class JpaUserDaoTest method saveUser.

private void saveUser(UUID tenantId, UUID customerId) {
    User user = new User();
    UUID id = UUIDs.timeBased();
    user.setId(new UserId(id));
    user.setTenantId(new TenantId(tenantId));
    user.setCustomerId(new CustomerId(customerId));
    if (customerId == NULL_UUID) {
        user.setAuthority(Authority.TENANT_ADMIN);
    } else {
        user.setAuthority(Authority.CUSTOMER_USER);
    }
    String idString = id.toString();
    String email = idString.substring(0, idString.indexOf('-')) + "@thingsboard.org";
    user.setEmail(email);
    userDao.save(user);
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) User(org.thingsboard.server.common.data.User) UserId(org.thingsboard.server.common.data.id.UserId) CustomerId(org.thingsboard.server.common.data.id.CustomerId) NULL_UUID(org.thingsboard.server.dao.model.ModelConstants.NULL_UUID) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 User (org.thingsboard.server.common.data.User)1 CustomerId (org.thingsboard.server.common.data.id.CustomerId)1 TenantId (org.thingsboard.server.common.data.id.TenantId)1 UserId (org.thingsboard.server.common.data.id.UserId)1 NULL_UUID (org.thingsboard.server.dao.model.ModelConstants.NULL_UUID)1