Merge with develop/3.5
This commit is contained in:
		
							parent
							
								
									d9add9bdf8
								
							
						
					
					
						commit
						022aee36d0
					
				@ -561,7 +561,7 @@ public class DefaultDataUpdateService implements DataUpdateService {
 | 
			
		||||
        while (hasNext) {
 | 
			
		||||
            for (Alarm alarm : alarms.getData()) {
 | 
			
		||||
                if (alarm.getCustomerId() == null && alarm.getOriginator() != null) {
 | 
			
		||||
                    alarm.setCustomerId(entityService.fetchEntityCustomerId(tenantId, alarm.getOriginator()).get());
 | 
			
		||||
                    alarm.setCustomerId(entityService.fetchEntityCustomerId(tenantId, alarm.getOriginator()));
 | 
			
		||||
                    alarmDao.save(tenantId, alarm);
 | 
			
		||||
                }
 | 
			
		||||
                if (processed.incrementAndGet() % 1000 == 0) {
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@ public interface EntityService {
 | 
			
		||||
 | 
			
		||||
    Optional<String> fetchEntityLabel(TenantId tenantId, EntityId entityId);
 | 
			
		||||
 | 
			
		||||
    Optional<CustomerId> fetchEntityCustomerId(TenantId tenantId, EntityId entityId);
 | 
			
		||||
    CustomerId fetchEntityCustomerId(TenantId tenantId, EntityId entityId);
 | 
			
		||||
 | 
			
		||||
    long countEntitiesByQuery(TenantId tenantId, CustomerId customerId, EntityCountQuery query);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -122,7 +122,7 @@ public class BaseAlarmService extends AbstractEntityService implements AlarmServ
 | 
			
		||||
            if (alarm.getEndTs() == 0L) {
 | 
			
		||||
                alarm.setEndTs(alarm.getStartTs());
 | 
			
		||||
            }
 | 
			
		||||
            alarm.setCustomerId(entityService.fetchEntityCustomerId(alarm.getTenantId(), alarm.getOriginator()).get());
 | 
			
		||||
            alarm.setCustomerId(entityService.fetchEntityCustomerId(alarm.getTenantId(), alarm.getOriginator()));
 | 
			
		||||
            if (alarm.getId() == null) {
 | 
			
		||||
                Alarm existing = alarmDao.findLatestByOriginatorAndType(alarm.getTenantId(), alarm.getOriginator(), alarm.getType());
 | 
			
		||||
                if (existing == null || existing.getStatus().isCleared()) {
 | 
			
		||||
@ -172,7 +172,7 @@ public class BaseAlarmService extends AbstractEntityService implements AlarmServ
 | 
			
		||||
        log.debug("New Alarm : {}", alarm);
 | 
			
		||||
        Alarm saved = alarmDao.save(alarm.getTenantId(), alarm);
 | 
			
		||||
        List<EntityId> propagatedEntitiesList = createEntityAlarmRecords(saved);
 | 
			
		||||
        AlarmInfo alarmInfo = getAlarmInfo(alarm.getTenantId(), alarm);
 | 
			
		||||
        AlarmInfo alarmInfo = getAlarmInfo(alarm.getTenantId(), saved);
 | 
			
		||||
        return new AlarmOperationResult(alarmInfo, true, true, propagatedEntitiesList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -463,7 +463,7 @@ public class BaseAlarmService extends AbstractEntityService implements AlarmServ
 | 
			
		||||
        String assigneeLastName = null;
 | 
			
		||||
        String assigneeEmail = null;
 | 
			
		||||
 | 
			
		||||
        originatorName = entityService.fetchEntityName(tenantId, alarm.getOriginator()).orElse("Deleted");
 | 
			
		||||
        originatorName = entityService.fetchEntityName(tenantId, alarm.getOriginator()).orElse(null);
 | 
			
		||||
        originatorLabel = entityService.fetchEntityLabel(tenantId, alarm.getOriginator()).orElse(null);
 | 
			
		||||
 | 
			
		||||
        if (alarm.getAssigneeId() != null) {
 | 
			
		||||
 | 
			
		||||
@ -96,7 +96,7 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe
 | 
			
		||||
    public Optional<String> fetchEntityLabel(TenantId tenantId, EntityId entityId) {
 | 
			
		||||
        log.trace("Executing fetchEntityLabel [{}]", entityId);
 | 
			
		||||
        EntityDaoService entityDaoService = entityServiceRegistry.getServiceByEntityType(entityId.getEntityType());
 | 
			
		||||
        Optional<HasId<?>> entityOpt = entityDaoService.fetchEntity(tenantId, entityId);
 | 
			
		||||
        Optional<HasId<?>> entityOpt = entityDaoService.findEntity(tenantId, entityId);
 | 
			
		||||
        String entityLabel = null;
 | 
			
		||||
        if (entityOpt.isPresent()) {
 | 
			
		||||
            HasId<?> entity = entityOpt.get();
 | 
			
		||||
@ -117,7 +117,7 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Optional<CustomerId> fetchEntityCustomerId(TenantId tenantId, EntityId entityId) {
 | 
			
		||||
    public CustomerId fetchEntityCustomerId(TenantId tenantId, EntityId entityId) {
 | 
			
		||||
        log.trace("Executing fetchEntityCustomerId [{}]", entityId);
 | 
			
		||||
        EntityDaoService entityDaoService = entityServiceRegistry.getServiceByEntityType(entityId.getEntityType());
 | 
			
		||||
        Optional<HasId<?>> hasIdOpt = entityDaoService.findEntity(tenantId, entityId);
 | 
			
		||||
@ -125,14 +125,10 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe
 | 
			
		||||
            HasId<?> hasId = hasIdOpt.get();
 | 
			
		||||
            if (hasId instanceof HasCustomerId) {
 | 
			
		||||
                HasCustomerId hasCustomerId = (HasCustomerId) hasId;
 | 
			
		||||
                CustomerId customerId = hasCustomerId.getCustomerId();
 | 
			
		||||
                if (customerId == null) {
 | 
			
		||||
                    customerId = NULL_CUSTOMER_ID;
 | 
			
		||||
                }
 | 
			
		||||
                return Optional.of(customerId);
 | 
			
		||||
                return hasCustomerId.getCustomerId();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return Optional.of(NULL_CUSTOMER_ID);
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void validateEntityCountQuery(EntityCountQuery query) {
 | 
			
		||||
 | 
			
		||||
@ -163,7 +163,7 @@ public abstract class AbstractAlarmEntity<T extends Alarm> extends BaseSqlEntity
 | 
			
		||||
        if (!CollectionUtils.isEmpty(alarm.getPropagateRelationTypes())) {
 | 
			
		||||
            this.propagateRelationTypes = String.join(",", alarm.getPropagateRelationTypes());
 | 
			
		||||
        } else {
 | 
			
		||||
            this.propagateRelationTypes = null;
 | 
			
		||||
            this.propagateRelationTypes = "";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user