diff options
author | Martin Stockhammer <martin_s@apache.org> | 2020-03-29 19:12:30 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2020-03-29 19:12:30 +0200 |
commit | b55ac5e29f81d58971c714e561ed6e4423f829b0 (patch) | |
tree | 3979566f569d2e2fb9428b4bec221544a2bd09ab /archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers | |
parent | ff7a10213879a19956ff036e1dbf7554814c2a89 (diff) | |
download | archiva-b55ac5e29f81d58971c714e561ed6e4423f829b0.tar.gz archiva-b55ac5e29f81d58971c714e561ed6e4423f829b0.zip |
Moving first client calls to new content repo API
Diffstat (limited to 'archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers')
-rw-r--r-- | archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java index 84a1d0f81..b7f590e35 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java @@ -34,6 +34,10 @@ import org.apache.archiva.repository.ReleaseScheme; import org.apache.archiva.repository.RepositoryException; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.metadata.audit.RepositoryListener; +import org.apache.archiva.repository.content.ItemSelector; +import org.apache.archiva.repository.content.Project; +import org.apache.archiva.repository.content.Version; +import org.apache.archiva.repository.content.base.ArchivaItemSelector; import org.apache.archiva.repository.metadata.base.MetadataTools; import org.apache.archiva.repository.metadata.RepositoryMetadataException; @@ -105,9 +109,11 @@ public class CleanupReleasedSnapshotsRepositoryPurge return; } - ProjectReference reference = new ProjectReference( ); - reference.setGroupId( artifactRef.getGroupId( ) ); - reference.setArtifactId( artifactRef.getArtifactId( ) ); + ItemSelector selector = ArchivaItemSelector.builder( ) + .withNamespace( artifactRef.getGroupId( ) ) + .withProjectId( artifactRef.getArtifactId( ) ) + .build(); + // Gether the released versions List<String> releasedVersions = new ArrayList<>( ); @@ -118,21 +124,15 @@ public class CleanupReleasedSnapshotsRepositoryPurge if ( repo.getActiveReleaseSchemes().contains( ReleaseScheme.RELEASE )) { - try + ManagedRepositoryContent repoContent = repo.getContent(); + Project proj = repoContent.getProject( selector ); + for ( Version version : repoContent.getVersions( proj ) ) { - ManagedRepositoryContent repoContent = repo.getContent(); - for ( String version : repoContent.getVersions( reference ) ) + if ( !VersionUtil.isSnapshot( version.getVersion() ) ) { - if ( !VersionUtil.isSnapshot( version ) ) - { - releasedVersions.add( version ); - } + releasedVersions.add( version.getVersion() ); } } - catch ( RepositoryException e ) - { - // swallow - } } } |