take of version when we delete a timestamped snapshot

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1352873 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-06-22 13:10:41 +00:00
parent bb1775cd72
commit 69ff5ca81c
1 changed files with 18 additions and 3 deletions

View File

@ -728,9 +728,23 @@ public class DefaultRepositoriesService
updateMetadata( metadata, metadataFile, lastUpdatedTimestamp, artifact ); updateMetadata( metadata, metadataFile, lastUpdatedTimestamp, artifact );
} }
Collection<ArtifactMetadata> artifacts = Collection<ArtifactMetadata> artifacts = Collections.emptyList();
metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
artifact.getVersion() ); if ( snapshotVersion )
{
String baseVersion = VersionUtil.getBaseVersion( artifact.getVersion() );
artifacts =
metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
baseVersion );
}
else
{
artifacts =
metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(),
artifact.getVersion() );
}
log.debug( "artifacts: {}", artifacts );
for ( ArtifactMetadata artifactMetadata : artifacts ) for ( ArtifactMetadata artifactMetadata : artifacts )
{ {
@ -813,6 +827,7 @@ public class DefaultRepositoriesService
} }
finally finally
{ {
repositorySession.save(); repositorySession.save();
repositorySession.close(); repositorySession.close();