use of org.apache.archiva.admin.model.beans.ManagedRepository in project archiva by apache.
the class DefaultManagedRepositoryAdmin method convertRepo.
/*
* Conversion between the repository from the registry and the serialized DTO for the admin API
*/
private ManagedRepository convertRepo(org.apache.archiva.repository.ManagedRepository repo) {
if (repo == null) {
return null;
}
ManagedRepository adminRepo = new ManagedRepository(getArchivaConfiguration().getDefaultLocale());
setBaseRepoAttributes(adminRepo, repo);
adminRepo.setLocation(convertUriToString(repo.getLocation()));
adminRepo.setReleases(repo.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE));
adminRepo.setSnapshots(repo.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT));
adminRepo.setBlockRedeployments(repo.blocksRedeployments());
adminRepo.setCronExpression(repo.getSchedulingDefinition());
if (repo.supportsFeature(IndexCreationFeature.class)) {
IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class).get();
adminRepo.setSkipPackedIndexCreation(icf.isSkipPackedIndexCreation());
}
adminRepo.setScanned(repo.isScanned());
if (repo.supportsFeature(ArtifactCleanupFeature.class)) {
ArtifactCleanupFeature acf = repo.getFeature(ArtifactCleanupFeature.class).get();
adminRepo.setRetentionPeriod(acf.getRetentionPeriod().getDays());
adminRepo.setRetentionCount(acf.getRetentionCount());
adminRepo.setDeleteReleasedSnapshots(acf.isDeleteReleasedSnapshots());
}
if (repo.supportsFeature(StagingRepositoryFeature.class)) {
StagingRepositoryFeature stf = repo.getFeature(StagingRepositoryFeature.class).get();
adminRepo.setStageRepoNeeded(stf.isStageRepoNeeded());
if (stf.getStagingRepository() != null) {
adminRepo.setStagingRepository(convertRepo(stf.getStagingRepository()));
}
}
return adminRepo;
}
Aggregations