Homeautomation/src/main/java/de/ph87/homeautomation/bulk/BulkExecutor.java

24 lines
688 B
Java

package de.ph87.homeautomation.bulk;
import de.ph87.homeautomation.property.PropertyWriteService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
@Transactional
@RequiredArgsConstructor
public class BulkExecutor {
private final PropertyWriteService propertyWriteService;
public void execute(final Bulk bulk) {
log.info("Executing Bulk: {}", bulk);
bulk.getEntries().forEach(entry -> propertyWriteService.writeToChannel(entry.getProperty(), entry.getValue()));
log.debug("Finished executing Bulk: {}", bulk);
}
}