aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/metadata-store-jcr
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-10-22 14:49:23 +0000
committerOlivier Lamy <olamy@apache.org>2012-10-22 14:49:23 +0000
commit0af1bd62e7ae172d557896a36280e8dfc484da0f (patch)
treed1b565560c8da6c9fb227ccc8d2f5f14193581ef /archiva-modules/plugins/metadata-store-jcr
parent555d6749875407e54cb29708088da263bf72c148 (diff)
downloadarchiva-0af1bd62e7ae172d557896a36280e8dfc484da0f.tar.gz
archiva-0af1bd62e7ae172d557896a36280e8dfc484da0f.zip
[MRM-1703] Cannot delete project with the ui.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1400901 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.java30
1 files changed, 30 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 47f23eb6b..46655b901 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
@@ -62,6 +62,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -367,6 +368,35 @@ public class JcrMetadataRepository
}
}
+ public void removeProject( String repositoryId, String namespace, String projectId )
+ throws MetadataRepositoryException
+ {
+ try
+ {
+ Node root = getJcrSession().getRootNode();
+ String namespacePath = getNamespacePath( repositoryId, namespace );
+
+ if ( root.hasNode( namespacePath ) )
+ {
+ Iterator<Node> nodeIterator = JcrUtils.getChildNodes( root.getNode( namespacePath ) ).iterator();
+ while ( nodeIterator.hasNext() )
+ {
+ Node node = nodeIterator.next();
+ if ( node.isNodeType( PROJECT_NODE_TYPE ) && projectId.equals( node.getName() ) )
+ {
+ node.remove();
+ }
+ }
+
+ }
+ }
+ catch ( RepositoryException e )
+ {
+ throw new MetadataRepositoryException( e.getMessage(), e );
+ }
+
+ }
+
public List<String> getMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException
{