From: Olivier Lamy Date: Wed, 26 Mar 2014 06:01:20 +0000 (+0000) Subject: fix deleting a project -> remove all artifacts X-Git-Tag: archiva-2.1.0~174 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3c0c99a9f2ec8da9bf44c63de4a202ec9595e558;p=archiva.git fix deleting a project -> remove all artifacts git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1581698 13f79535-47bb-0310-9956-ffa450edef68 --- 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> 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 row : result.get().getList() ) + { + this.projectVersionMetadataModelTemplate.deleteRow( row.getKey() ); + } + RangeSlicesQuery query = HFactory // .createRangeSlicesQuery( keyspace, ss, ss, ss ) // .setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) // @@ -2011,7 +2021,7 @@ public class CassandraMetadataRepository .addEqualsExpression( "project", projectId ) // .addEqualsExpression( "projectVersion", projectVersion ); - QueryResult> result = query.execute(); + result = query.execute(); for ( Row row : result.get() ) {