use of org.apache.nifi.web.api.dto.NodeSystemDiagnosticsSnapshotDTO in project nifi by apache.
the class StatusMerger method merge.
public static void merge(final SystemDiagnosticsDTO target, final SystemDiagnosticsDTO toMerge, final String nodeId, final String nodeAddress, final Integer nodeApiPort) {
merge(target.getAggregateSnapshot(), toMerge.getAggregateSnapshot());
List<NodeSystemDiagnosticsSnapshotDTO> nodeSnapshots = target.getNodeSnapshots();
if (nodeSnapshots == null) {
nodeSnapshots = new ArrayList<>();
}
final NodeSystemDiagnosticsSnapshotDTO nodeSnapshot = new NodeSystemDiagnosticsSnapshotDTO();
nodeSnapshot.setAddress(nodeAddress);
nodeSnapshot.setApiPort(nodeApiPort);
nodeSnapshot.setNodeId(nodeId);
nodeSnapshot.setSnapshot(toMerge.getAggregateSnapshot());
nodeSnapshots.add(nodeSnapshot);
target.setNodeSnapshots(nodeSnapshots);
}
use of org.apache.nifi.web.api.dto.NodeSystemDiagnosticsSnapshotDTO in project nifi by apache.
the class SystemDiagnosticsEndpointMerger method mergeResponses.
@Override
protected void mergeResponses(SystemDiagnosticsDTO clientDto, Map<NodeIdentifier, SystemDiagnosticsDTO> dtoMap, NodeIdentifier selectedNodeId) {
final SystemDiagnosticsDTO mergedSystemDiagnostics = clientDto;
mergedSystemDiagnostics.setNodeSnapshots(new ArrayList<NodeSystemDiagnosticsSnapshotDTO>());
final NodeSystemDiagnosticsSnapshotDTO selectedNodeSnapshot = new NodeSystemDiagnosticsSnapshotDTO();
selectedNodeSnapshot.setSnapshot(clientDto.getAggregateSnapshot().clone());
selectedNodeSnapshot.setAddress(selectedNodeId.getApiAddress());
selectedNodeSnapshot.setApiPort(selectedNodeId.getApiPort());
selectedNodeSnapshot.setNodeId(selectedNodeId.getId());
mergedSystemDiagnostics.getNodeSnapshots().add(selectedNodeSnapshot);
for (final Map.Entry<NodeIdentifier, SystemDiagnosticsDTO> entry : dtoMap.entrySet()) {
final NodeIdentifier nodeId = entry.getKey();
final SystemDiagnosticsDTO toMerge = entry.getValue();
if (toMerge == clientDto) {
continue;
}
StatusMerger.merge(mergedSystemDiagnostics, toMerge, nodeId.getId(), nodeId.getApiAddress(), nodeId.getApiPort());
}
}
Aggregations