use of org.apache.nifi.web.api.dto.PropertyHistoryDTO in project nifi by apache.
the class StandardNiFiServiceFacade method getComponentHistory.
@Override
public ComponentHistoryDTO getComponentHistory(final String componentId) {
final Map<String, PropertyHistoryDTO> propertyHistoryDtos = new LinkedHashMap<>();
final Map<String, List<PreviousValue>> propertyHistory = auditService.getPreviousValues(componentId);
for (final Map.Entry<String, List<PreviousValue>> entry : propertyHistory.entrySet()) {
final List<PreviousValueDTO> previousValueDtos = new ArrayList<>();
for (final PreviousValue previousValue : entry.getValue()) {
final PreviousValueDTO dto = new PreviousValueDTO();
dto.setPreviousValue(previousValue.getPreviousValue());
dto.setTimestamp(previousValue.getTimestamp());
dto.setUserIdentity(previousValue.getUserIdentity());
previousValueDtos.add(dto);
}
if (!previousValueDtos.isEmpty()) {
final PropertyHistoryDTO propertyHistoryDto = new PropertyHistoryDTO();
propertyHistoryDto.setPreviousValues(previousValueDtos);
propertyHistoryDtos.put(entry.getKey(), propertyHistoryDto);
}
}
final ComponentHistoryDTO history = new ComponentHistoryDTO();
history.setComponentId(componentId);
history.setPropertyHistory(propertyHistoryDtos);
return history;
}
Aggregations