]> source.dussan.org Git - archiva.git/commitdiff
fix deleting a project -> remove all artifacts
authorOlivier Lamy <olamy@apache.org>
Wed, 26 Mar 2014 06:01:20 +0000 (06:01 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 26 Mar 2014 06:01:20 +0000 (06:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1581698 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java

index 530477db1f8f0d2886811065d2c08dffe730702a..f7525e61d02dad1b6941ba0401870388ecf44760 100644 (file)
@@ -1992,15 +1992,25 @@ public class CassandraMetadataRepository
         throws MetadataRepositoryException
     {
 
-        String key = new ProjectVersionMetadataModel.KeyBuilder().withRepository( repoId ).withNamespace(
-            namespace ).withProjectId( projectId ).withId( projectVersion ).build();
-
-        this.projectVersionMetadataModelTemplate.deleteRow( key );
-
         Keyspace keyspace = cassandraArchivaManager.getKeyspace();
 
         StringSerializer ss = StringSerializer.get();
 
+        QueryResult<OrderedRows<String, String, String>> result = HFactory //
+            .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
+            .setColumnFamily( cassandraArchivaManager.getProjectVersionMetadataFamilyName() ) //
+            .setColumnNames( "version" ) //
+            .addEqualsExpression( "repositoryName", repoId ) //
+            .addEqualsExpression( "namespaceId", namespace ) //
+            .addEqualsExpression( "projectId", projectId ) //
+            .addEqualsExpression( "projectVersion", projectVersion ) //
+            .execute();
+
+        for ( Row<String, String, String> row : result.get().getList() )
+        {
+            this.projectVersionMetadataModelTemplate.deleteRow( row.getKey() );
+        }
+
         RangeSlicesQuery<String, String, String> query = HFactory //
             .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
             .setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) //
@@ -2011,7 +2021,7 @@ public class CassandraMetadataRepository
             .addEqualsExpression( "project", projectId ) //
             .addEqualsExpression( "projectVersion", projectVersion );
 
-        QueryResult<OrderedRows<String, String, String>> result = query.execute();
+        result = query.execute();
 
         for ( Row<String, String, String> row : result.get() )
         {