use of org.talend.dataprep.parameters.jsonschema.ComponentProperties in project data-prep by Talend.
the class DataSetService method getDataStoreParameters.
@RequestMapping(value = "/datasets/{id}/datastore/properties", method = GET)
@ApiOperation(value = "Get the dataset import parameters", notes = "This list can be used by user to change dataset encoding.")
@Timed
public // ComponentProperties
Object getDataStoreParameters(@PathVariable("id") final String dataSetId) {
DataSetMetadata dataSetMetadata = dataSetMetadataRepository.get(dataSetId);
Object parametersToReturn = null;
if (dataSetMetadata != null) {
DataSetLocation matchingDatasetLocation = locationsService.findLocation(dataSetMetadata.getLocation().getLocationType());
if (matchingDatasetLocation == null) {
parametersToReturn = emptyList();
} else {
if (matchingDatasetLocation.isSchemaOriented()) {
ComponentProperties parametersAsSchema = matchingDatasetLocation.getParametersAsSchema(getLocale());
parametersAsSchema.setProperties(dataSetMetadata.getLocation().getParametersAsSchema(getLocale()).getProperties());
parametersToReturn = parametersAsSchema;
} else {
parametersToReturn = matchingDatasetLocation.getParameters(getLocale());
}
}
}
return parametersToReturn;
}
Aggregations