class ClusterDataSetListResponseBody implements ResponseBody {

	public static ClusterDataSetListResponseBody from(Map<IntermediateDataSetID, DataSetMetaInfo> dataSets) {
		final List<ClusterDataSetEntry> convertedInfo = dataSets.entrySet().stream()
			.map(entry -> {
				DataSetMetaInfo metaInfo = entry.getValue();
				int numRegisteredPartitions = metaInfo.getNumRegisteredPartitions().orElse(0);
				int numTotalPartition = metaInfo.getNumTotalPartitions();
				return new ClusterDataSetEntry(entry.getKey(), numRegisteredPartitions == numTotalPartition);
			})
			.collect(Collectors.toList());
		return new ClusterDataSetListResponseBody(convertedInfo);
	}

	@JsonCreator private  ClusterDataSetListResponseBody(@JsonProperty(FIELD_NAME_PARTITIONS) List<ClusterDataSetEntry> dataSets);

}