remove notification of target deletion from management layer

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-08-01 10:24:09 +02:00
parent dfd449592c
commit 5be513422d

View File

@@ -29,7 +29,6 @@ import javax.persistence.criteria.Root;
import org.eclipse.hawkbit.repository.TargetFields;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.eventbus.event.TargetDeletedEvent;
import org.eclipse.hawkbit.repository.eventbus.event.TargetTagAssigmentResultEvent;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.jpa.configuration.Constants;
@@ -49,7 +48,6 @@ import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.data.domain.Page;
@@ -99,10 +97,6 @@ public class JpaTargetManagement implements TargetManagement {
@Autowired
private AfterTransactionCommitExecutor afterCommit;
@Autowired
private TenantAware tenantAware;
@Override
public Target findTargetByControllerID(final String controllerId) {
return targetRepository.findByControllerId(controllerId);
@@ -211,8 +205,6 @@ public class JpaTargetManagement implements TargetManagement {
if (!targetsForCurrentTenant.isEmpty()) {
targetInfoRepository.deleteByTargetIdIn(targetsForCurrentTenant);
targetRepository.deleteByIdIn(targetsForCurrentTenant);
targetsForCurrentTenant.forEach(targetId -> notifyTargetDeleted(
tenantAware.getCurrentTenant(), targetId));
}
}
@@ -660,8 +652,4 @@ public class JpaTargetManagement implements TargetManagement {
return resultList;
}
private void notifyTargetDeleted(final String tenant, final Long targetId) {
afterCommit.afterCommit(() -> eventBus.post(new TargetDeletedEvent(tenant, targetId)));
}
}