Code review fixes
This commit is contained in:
		
							parent
							
								
									611995121b
								
							
						
					
					
						commit
						47361b0166
					
				@ -18,19 +18,15 @@ package org.thingsboard.server.dao.sql;
 | 
			
		||||
import com.datastax.driver.core.utils.UUIDs;
 | 
			
		||||
import com.google.common.collect.Lists;
 | 
			
		||||
import com.google.common.util.concurrent.ListenableFuture;
 | 
			
		||||
import com.google.common.util.concurrent.ListeningExecutorService;
 | 
			
		||||
import com.google.common.util.concurrent.MoreExecutors;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.data.repository.CrudRepository;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.thingsboard.server.dao.Dao;
 | 
			
		||||
import org.thingsboard.server.dao.DaoUtil;
 | 
			
		||||
import org.thingsboard.server.dao.model.BaseEntity;
 | 
			
		||||
import org.thingsboard.server.dao.model.SearchTextEntity;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.concurrent.Executors;
 | 
			
		||||
 | 
			
		||||
import static org.springframework.transaction.annotation.Propagation.REQUIRES_NEW;
 | 
			
		||||
 | 
			
		||||
@ -46,9 +42,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D>
 | 
			
		||||
 | 
			
		||||
    protected abstract CrudRepository<E, UUID> getCrudRepository();
 | 
			
		||||
 | 
			
		||||
    protected boolean isSearchTextDao() {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    protected void setSearchText(E entity) {}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(propagation = REQUIRES_NEW)
 | 
			
		||||
@ -60,9 +54,7 @@ public abstract class JpaAbstractDao<E extends BaseEntity<D>, D>
 | 
			
		||||
            log.error("Can't create entity for domain object {}", domain, e);
 | 
			
		||||
            throw new IllegalArgumentException("Can't create entity for domain object {" + domain + "}", e);
 | 
			
		||||
        }
 | 
			
		||||
        if (isSearchTextDao()) {
 | 
			
		||||
            ((SearchTextEntity) entity).setSearchText(((SearchTextEntity) entity).getSearchTextSource().toLowerCase());
 | 
			
		||||
        }
 | 
			
		||||
        setSearchText(entity);
 | 
			
		||||
        log.debug("Saving entity {}", entity);
 | 
			
		||||
        if (entity.getId() == null) {
 | 
			
		||||
            entity.setId(UUIDs.timeBased());
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,7 @@
 | 
			
		||||
package org.thingsboard.server.dao.sql;
 | 
			
		||||
 | 
			
		||||
import org.thingsboard.server.dao.model.BaseEntity;
 | 
			
		||||
import org.thingsboard.server.dao.model.SearchTextEntity;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Created by Valerii Sosliuk on 5/6/2017.
 | 
			
		||||
@ -23,7 +24,7 @@ import org.thingsboard.server.dao.model.BaseEntity;
 | 
			
		||||
public abstract class JpaAbstractSearchTextDao <E extends BaseEntity<D>, D> extends JpaAbstractDao<E, D> {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected boolean isSearchTextDao() {
 | 
			
		||||
        return true;
 | 
			
		||||
    protected void setSearchText(E entity) {
 | 
			
		||||
        ((SearchTextEntity) entity).setSearchText(((SearchTextEntity) entity).getSearchTextSource().toLowerCase());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -16,21 +16,15 @@
 | 
			
		||||
package org.thingsboard.server.extensions.api.device;
 | 
			
		||||
 | 
			
		||||
import lombok.AllArgsConstructor;
 | 
			
		||||
import lombok.Getter;
 | 
			
		||||
import lombok.ToString;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import org.thingsboard.server.common.data.id.DeviceId;
 | 
			
		||||
import org.thingsboard.server.common.data.id.TenantId;
 | 
			
		||||
 | 
			
		||||
@ToString
 | 
			
		||||
@Data
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
public class DeviceNameOrTypeUpdateMsg implements ToDeviceActorNotificationMsg {
 | 
			
		||||
 | 
			
		||||
    @Getter
 | 
			
		||||
    private final TenantId tenantId;
 | 
			
		||||
    @Getter
 | 
			
		||||
    private final DeviceId deviceId;
 | 
			
		||||
    @Getter
 | 
			
		||||
    private final String deviceName;
 | 
			
		||||
    @Getter
 | 
			
		||||
    private final String deviceType;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user