use of org.talend.dataprep.api.dataset.DatasetDetailsDTO in project data-prep by Talend.
the class DataSetAPI method getPreparation.
/**
* Return the list of preparation using a dataset
*
* @param id the wanted dataset.
* @return the list of preparation using the dataset
*/
@RequestMapping(value = "/api/datasets/{id}/preparations", method = GET, produces = APPLICATION_JSON_VALUE)
@ApiOperation(value = "Get the list of preparation using a dataset by the dataset id.", produces = APPLICATION_JSON_VALUE, notes = "Get the list of preparation using a dataset by the dataset id.")
@Timed
public List<DatasetDetailsDTO.Preparation> getPreparation(@ApiParam(value = "Id of the data set to get") @PathVariable(value = "id") String id) {
if (LOG.isDebugEnabled()) {
LOG.debug("Requesting preparations using dataset #{} (pool: {})...", id, getConnectionStats());
}
try {
DatasetDetailsDTO details = datasetClient.getDataSetDetails(id);
// Add the related preparations list to the given dataset metadata.
final PreparationSearchByDataSetId getPreparations = getCommand(PreparationSearchByDataSetId.class, details.getId());
List<DatasetDetailsDTO.Preparation> preps = new ArrayList<>();
//
toStream(PreparationDTO.class, mapper, getPreparations).filter(p -> p.getSteps() != null).forEach(p -> preps.add(new DatasetDetailsDTO.Preparation(p.getId(), p.getName(), (long) p.getSteps().size(), p.getLastModificationDate())));
return preps;
} finally {
if (LOG.isDebugEnabled()) {
LOG.debug("Request preparations using dataset #{} (pool: {}) done.", id, getConnectionStats());
}
}
}
use of org.talend.dataprep.api.dataset.DatasetDetailsDTO in project data-prep by Talend.
the class DataSetAPI method getDetails.
/**
* Return the dataset details.
*
* @param id the wanted dataset details.
* @return the dataset datails or no content if not found.
*/
@RequestMapping(value = "/api/datasets/{id}/details", method = GET, produces = APPLICATION_JSON_VALUE)
@ApiOperation(value = "Get a data set detail by id.", produces = APPLICATION_JSON_VALUE, notes = "Get a data set metadata based on given id.")
@Timed
public DatasetDetailsDTO getDetails(@ApiParam(value = "Id of the data set to get") @PathVariable(value = "id") String id) {
if (LOG.isDebugEnabled()) {
LOG.debug("Requesting dataset details #{} (pool: {})...", id, getConnectionStats());
}
try {
DatasetDetailsDTO details = datasetClient.getDataSetDetails(id);
List<DatasetDetailsDTO.Preparation> preps = getPreparation(details.getId());
details.setPreparations(preps);
return details;
} finally {
if (LOG.isDebugEnabled()) {
LOG.debug("Request dataset details #{} (pool: {}) done.", id, getConnectionStats());
}
}
}
Aggregations