use of org.talend.dataprep.command.preparation.PreparationSummaryGet in project data-prep by Talend.
the class StandardExportStrategiesIntegrationTest method initPreparationDetails.
private void initPreparationDetails() throws Exception {
doReturn(preparationDetailsGet).when(applicationContext).getBean(eq(PreparationDetailsGet.class), anyString(), anyString());
final PreparationDetailsDTO preparationDetailsDTO = mapper.readerFor(//
PreparationDetailsDTO.class).readValue(this.getClass().getResourceAsStream("preparation_details.json"));
//
when(preparationDetailsGet.execute()).thenReturn(//
preparationDetailsDTO).thenReturn(preparationDetailsDTO);
doReturn(preparationSummaryGet).when(applicationContext).getBean(eq(PreparationSummaryGet.class), anyString(), anyString());
final PreparationDTO preparationDTO = mapper.readerFor(//
PreparationDTO.class).readValue(this.getClass().getResourceAsStream("preparation_details_summary.json"));
when(preparationSummaryGet.execute()).thenReturn(preparationDTO, preparationDTO);
}
use of org.talend.dataprep.command.preparation.PreparationSummaryGet in project data-prep by Talend.
the class ExportAPI method getExportNameAndConsolidateParameters.
private String getExportNameAndConsolidateParameters(ExportParameters parameters) {
// export file name comes from :
// 1. the form parameter
// 2. the preparation name
// 3. the dataset name
String exportName = EMPTY;
if (parameters.getArguments().containsKey(PREFIX + "fileName")) {
return parameters.getArguments().get(PREFIX + "fileName");
}
// deal with preparation (update the export name and dataset id if needed)
if (StringUtils.isNotBlank(parameters.getPreparationId())) {
final PreparationSummaryGet preparationSummaryGet = getCommand(PreparationSummaryGet.class, parameters.getPreparationId());
final PreparationDTO preparation = preparationSummaryGet.execute();
if (StringUtils.isBlank(exportName)) {
exportName = preparation.getName();
}
// update the dataset id in the parameters if needed
if (StringUtils.isBlank(parameters.getDatasetId())) {
parameters.setDatasetId(preparation.getDataSetId());
}
} else if (StringUtils.isBlank(exportName)) {
// deal export name in case of dataset
final DataSetMetadata metadata = datasetClient.getDataSetMetadata(parameters.getDatasetId());
exportName = metadata.getName();
}
return exportName;
}
Aggregations