List of usage examples for org.springframework.data.domain Slice getNumberOfElements
int getNumberOfElements();
From source file:org.eclipse.hawkbit.repository.jpa.JpaRolloutManagement.java
private void deleteScheduledActions(final JpaRollout rollout, final Slice<JpaAction> scheduledActions) { final boolean hasScheduledActions = scheduledActions.getNumberOfElements() > 0; if (hasScheduledActions) { try {/* w w w .ja v a2 s.c o m*/ final Iterable<JpaAction> iterable = scheduledActions::iterator; final List<Long> actionIds = StreamSupport.stream(iterable.spliterator(), false).map(Action::getId) .collect(Collectors.toList()); actionRepository.deleteByIdIn(actionIds); afterCommit.afterCommit(() -> eventPublisher.publishEvent( new RolloutUpdatedEvent(rollout, EventPublisherHolder.getInstance().getApplicationId()))); } catch (final RuntimeException e) { LOGGER.error("Exception during deletion of actions of rollout {}", rollout, e); } } }