use of org.haiku.haikudepotserver.dataobjects.auto._Repository in project haikudepotserver by haiku.
the class RepositoryDumpExportJobRunner method run.
@Override
public void run(JobService jobService, RepositoryDumpExportJobSpecification specification) throws IOException, JobRunnerException {
// this will register the outbound data against the job.
JobDataWithByteSink jobDataWithByteSink = jobService.storeGeneratedData(specification.getGuid(), "download", MediaType.JSON_UTF_8.toString());
try (final OutputStream outputStream = jobDataWithByteSink.getByteSink().openBufferedStream();
final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputStream);
final JsonGenerator jsonGenerator = objectMapper.getFactory().createGenerator(gzipOutputStream)) {
ObjectContext context = serverRuntime.newContext();
List<Repository> repositories = Repository.getAll(context).stream().filter(_Repository::getActive).collect(Collectors.toList());
jsonGenerator.writeStartObject();
writeInfo(jsonGenerator, repositories);
writeRepositories(jsonGenerator, repositories);
jsonGenerator.writeEndObject();
}
}
Aggregations