use of org.openkilda.model.history.FlowStatusView in project open-kilda by telstra.
the class FermaFlowEventRepository method findFlowStatusesByFlowIdAndTimeFrame.
@Override
public List<FlowStatusView> findFlowStatusesByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) {
List<FlowStatusView> statuses = new ArrayList<>();
findByFlowIdAndTimeFrame(flowId, timeFrom, timeTo, maxCount).forEach(flowEvent -> {
for (FlowEventAction flowEventAction : flowEvent.getEventActions()) {
String action = flowEventAction.getAction();
if (action.equals(FlowEvent.FLOW_DELETED_ACTION)) {
statuses.add(new FlowStatusView(flowEventAction.getTimestamp(), "DELETED"));
}
for (String actionPart : FlowEvent.FLOW_STATUS_ACTION_PARTS) {
if (action.contains(actionPart)) {
statuses.add(new FlowStatusView(flowEventAction.getTimestamp(), action.replace(actionPart, "")));
}
}
}
});
statuses.sort(Comparator.comparing(FlowStatusView::getTimestamp));
return statuses;
}
Aggregations