use of org.haiku.haikudepotserver.repository.model.dumpexport.DumpExportRepositorySource in project haikudepotserver by haiku.
the class RepositoryDumpExportJobRunner method createDumpRepository.
private DumpExportRepository createDumpRepository(Repository repository) {
DumpExportRepository dumpRepository = new DumpExportRepository();
dumpRepository.setCode(repository.getCode());
dumpRepository.setName(repository.getName());
dumpRepository.setDescription(repository.getDescription());
dumpRepository.setInformationUrl(repository.getInformationUrl());
dumpRepository.setRepositorySources(repository.getRepositorySources().stream().filter(_RepositorySource::getActive).filter(rs -> rs.tryGetPrimaryMirror().isPresent()).sorted(Comparator.comparing(_RepositorySource::getCode)).map((rs) -> {
DumpExportRepositorySource dumpRepositorySource = new DumpExportRepositorySource();
dumpRepositorySource.setCode(rs.getCode());
dumpRepositorySource.setArchitectureCode(Optional.ofNullable(rs.getArchitecture()).map(Architecture::getCode).orElse(null));
dumpRepositorySource.setIdentifier(rs.getIdentifier());
dumpRepositorySource.setRepoInfoUrl(rs.getIdentifier());
// ^^ deprecated; repoInfoUrl is replaced with identifier
dumpRepositorySource.setExtraIdentifiers(rs.getExtraIdentifiers());
dumpRepositorySource.setRepositorySourceMirrors(rs.getRepositorySourceMirrors().stream().filter(_RepositorySourceMirror::getActive).sorted(Comparator.comparing(_RepositorySourceMirror::getCode)).map(rsm -> {
DumpExportRepositorySourceMirror dumpMirror = new DumpExportRepositorySourceMirror();
dumpMirror.setBaseUrl(rsm.getBaseUrl());
dumpMirror.setCountryCode(rsm.getCountry().getCode());
dumpMirror.setDescription(rsm.getDescription());
dumpMirror.setIsPrimary(rsm.getIsPrimary());
return dumpMirror;
}).collect(Collectors.toList()));
return dumpRepositorySource;
}).collect(Collectors.toList()));
return dumpRepository;
}
Aggregations