Commit 642febc2 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fill the 'metadata' sheet of Datasets

- Template updated
parent 6ba4b18c
......@@ -482,15 +482,18 @@ public class DatasetServiceImpl implements DatasetService {
// generate file with metadata and add it to the dataset
try (final ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
downloadService.writeXlsxDatasetMetadata(loaded, bos);
final String fileName = "genesys_catalog_metadata.xlsx";
final String fileName = "Metadata.xlsx";
final String contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
try {
final RepositoryFile datasetFile = repositoryService.getFile(Paths.get(datasetRepositoryPath, loaded.getUuid().toString()), fileName);
repositoryService.updateBytes(datasetFile, contentType, bos.toByteArray());
} catch (final NoSuchRepositoryFileException | InvalidRepositoryPathException e) {
try {
RepositoryFile metadata = new RepositoryFile();
metadata.setTitle("Dataset metadata");
metadata.setDescription("Auto-generated by Genesys");
final RepositoryFile addedFile = repositoryService.addFile(Paths.get(datasetRepositoryPath, loaded.getUuid().toString()).toAbsolutePath(),
fileName, contentType, bos.toByteArray(), null);
fileName, contentType, bos.toByteArray(), metadata);
loaded = lazyLoad(;
} catch (final InvalidRepositoryPathException | InvalidRepositoryFileDataException e1) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment