diff options
author | Olivier Lamy <olamy@apache.org> | 2012-10-11 22:42:00 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-10-11 22:42:00 +0000 |
commit | 092a635e39f0329c59d23745cdd93fdd000516e4 (patch) | |
tree | cafb88f3ec9d789fdb1ff209d4ce065dcb90a83a /archiva-modules/plugins/metadata-store-jcr | |
parent | db43bb93394bd38dde8b01a3b5927648c2ac9a91 (diff) | |
download | archiva-092a635e39f0329c59d23745cdd93fdd000516e4.tar.gz archiva-092a635e39f0329c59d23745cdd93fdd000516e4.zip |
do some cleanup if metadatarepository still contains versions when deleting
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1397342 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/metadata-store-jcr')
-rw-r--r-- | archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java index 6dd78efe5..47f23eb6b 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java @@ -1047,6 +1047,33 @@ public class JcrMetadataRepository } + + public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) + throws MetadataRepositoryException + { + try + { + + String path = getProjectPath( repoId, namespace, projectId ); + Node root = getJcrSession().getRootNode(); + + Node nodeAtPath = root.getNode( path ); + + for ( Node node : JcrUtils.getChildNodes( nodeAtPath ) ) + { + if ( node.isNodeType( PROJECT_VERSION_NODE_TYPE ) && StringUtils.equals( projectVersion, + node.getName() ) ) + { + node.remove(); + } + } + } + catch ( RepositoryException e ) + { + throw new MetadataRepositoryException( e.getMessage(), e ); + } + } + public void removeArtifact( String repositoryId, String namespace, String projectId, String projectVersion, String id ) throws MetadataRepositoryException |