aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-03-26 06:01:20 +0000
committerOlivier Lamy <olamy@apache.org>2014-03-26 06:01:20 +0000
commit3c0c99a9f2ec8da9bf44c63de4a202ec9595e558 (patch)
tree949dd843aa15793eb9ba2c7ae76c6fcca0578a3c
parent96a526be486d6862cf6df748863e16fc14752b20 (diff)
downloadarchiva-3c0c99a9f2ec8da9bf44c63de4a202ec9595e558.tar.gz
archiva-3c0c99a9f2ec8da9bf44c63de4a202ec9595e558.zip
fix deleting a project -> remove all artifacts
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1581698 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
index 530477db1..f7525e61d 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
@@ -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() )
{