Skip to content

Commit

Permalink
fix indentation (+ one static import)
Browse files Browse the repository at this point in the history
  • Loading branch information
ePaul committed Nov 28, 2022
1 parent 5d31955 commit 4163a01
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public interface EventLogRepository {
void persist(EventLog eventLog);

default void persist(Collection<EventLog> eventLogs) {
for (EventLog eventLog : eventLogs) {
persist(eventLog);
}
for (EventLog eventLog : eventLogs) {
persist(eventLog);
}
}

void deleteAll();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.zalando.nakadiproducer.eventlog.impl;

import static java.util.stream.Collectors.toList;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.CREATE;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.DELETE;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.SNAPSHOT;
import static org.zalando.nakadiproducer.eventlog.impl.EventDataOperation.UPDATE;

import java.util.Collection;
import java.util.stream.Collectors;

import org.zalando.nakadiproducer.flowid.FlowIdComponent;
import org.zalando.nakadiproducer.eventlog.EventLogWriter;

Expand Down Expand Up @@ -38,7 +39,7 @@ public void fireCreateEvent(final String eventType, final String dataType, final
@Override
@Transactional
public void fireCreateEvents(final String eventType, final String dataType, final Collection<?> data) {
eventLogRepository.persist(createEventLogs(eventType, CREATE, dataType, data));
eventLogRepository.persist(createEventLogs(eventType, CREATE, dataType, data));
}

@Override
Expand All @@ -51,7 +52,7 @@ public void fireUpdateEvent(final String eventType, final String dataType, final
@Override
@Transactional
public void fireUpdateEvents(final String eventType, final String dataType, final Collection<?> data) {
eventLogRepository.persist(createEventLogs(eventType, UPDATE, dataType, data));
eventLogRepository.persist(createEventLogs(eventType, UPDATE, dataType, data));
}

@Override
Expand All @@ -64,7 +65,7 @@ public void fireDeleteEvent(final String eventType, final String dataType, final
@Override
@Transactional
public void fireDeleteEvents(final String eventType, final String dataType, final Collection<?> data) {
eventLogRepository.persist(createEventLogs(eventType, DELETE, dataType, data));
eventLogRepository.persist(createEventLogs(eventType, DELETE, dataType, data));
}

@Override
Expand All @@ -77,7 +78,7 @@ public void fireSnapshotEvent(final String eventType, final String dataType, fin
@Override
@Transactional
public void fireSnapshotEvents(final String eventType, final String dataType, final Collection<?> data) {
eventLogRepository.persist(createEventLogs(eventType, SNAPSHOT, dataType, data));
eventLogRepository.persist(createEventLogs(eventType, SNAPSHOT, dataType, data));
}

@Override
Expand All @@ -95,10 +96,10 @@ public void fireBusinessEvents(final String eventType, final Collection<Object>
}

private Collection<EventLog> createEventLogs(final String eventType,
final Collection<Object> eventPayloads) {
return eventPayloads.stream()
.map(payload -> createEventLog(eventType, payload))
.collect(Collectors.toList());
final Collection<Object> eventPayloads) {
return eventPayloads.stream()
.map(payload -> createEventLog(eventType, payload))
.collect(toList());
}

private EventLog createEventLog(final String eventType, final Object eventPayload) {
Expand All @@ -114,16 +115,16 @@ private EventLog createEventLog(final String eventType, final Object eventPayloa
return eventLog;
}

private Collection<EventLog> createEventLogs(
final String eventType,
final EventDataOperation eventDataOperation,
final String dataType,
final Collection<?> data
) {
return data.stream()
.map(payload -> createEventLog(eventType,
new DataChangeEventEnvelope(eventDataOperation.toString(), dataType, payload)))
.collect(Collectors.toList());
}
private Collection<EventLog> createEventLogs(
final String eventType,
final EventDataOperation eventDataOperation,
final String dataType,
final Collection<?> data
) {
return data.stream()
.map(payload -> createEventLog(eventType,
new DataChangeEventEnvelope(eventDataOperation.toString(), dataType, payload)))
.collect(toList());
}

}

0 comments on commit 4163a01

Please sign in to comment.