summaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/metadata-store-cassandra/src
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-03-24 06:15:44 +0000
committerOlivier Lamy <olamy@apache.org>2014-03-24 06:15:44 +0000
commit4b7e4391324d545159f331a2cf7ef24b1b93faed (patch)
tree49f53a52f81d54b83cda7cd764c9d2ae353b263f /archiva-modules/plugins/metadata-store-cassandra/src
parentd18ba9ef2187d5e46cf4ab0158d5179b94e76ef4 (diff)
downloadarchiva-4b7e4391324d545159f331a2cf7ef24b1b93faed.tar.gz
archiva-4b7e4391324d545159f331a2cf7ef24b1b93faed.zip
fix deleting project version
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1580762 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/metadata-store-cassandra/src')
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java53
1 files changed, 20 insertions, 33 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 89f36b0e8..62b3bf3be 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
@@ -1778,46 +1778,33 @@ public class CassandraMetadataRepository
final String projectVersion )
throws MetadataRepositoryException
{
- /*
- final List<ArtifactMetadataModel> artifactMetadataModels = new ArrayList<ArtifactMetadataModel>();
- // FIXME use cql query
+ String key = new ProjectVersionMetadataModel.KeyBuilder().withRepository( repoId ).withNamespace(
+ namespace ).withProjectId( projectId ).withId( projectVersion ).build();
- getArtifactMetadataModelEntityManager().visitAll( new Function<ArtifactMetadataModel, Boolean>()
- {
- @Override
- public Boolean apply( ArtifactMetadataModel artifactMetadataModel )
- {
- if ( artifactMetadataModel != null )
- {
- if ( StringUtils.equals( repoId, artifactMetadataModel.getRepositoryId() ) && StringUtils.equals(
- namespace, artifactMetadataModel.getNamespace() ) && StringUtils.equals( projectId,
- artifactMetadataModel.getProject() )
- && StringUtils.equals( projectVersion, artifactMetadataModel.getProjectVersion() ) )
- {
- artifactMetadataModels.add( artifactMetadataModel );
- }
- }
- return Boolean.TRUE;
- }
- } );
+ this.projectVersionMetadataModelTemplate.deleteRow( key );
- logger.debug( "removeProjectVersions:{}", artifactMetadataModels );
- if ( artifactMetadataModels.isEmpty() )
- {
- return;
- }
+ Keyspace keyspace = cassandraArchivaManager.getKeyspace();
- getArtifactMetadataModelEntityManager().remove( artifactMetadataModels );
+ StringSerializer ss = StringSerializer.get();
- String key = new ProjectVersionMetadataModel.KeyBuilder().withProjectId( projectId ).withId(
- projectVersion ).withRepository( repoId ).withNamespace( namespace ).build();
+ RangeSlicesQuery<String, String, String> query = HFactory //
+ .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
+ .setColumnFamily( cassandraArchivaManager.getArtifactMetadataModelFamilyName() ) //
+ .setColumnNames( "namespaceId" ); //
- ProjectVersionMetadataModel projectVersionMetadataModel = new ProjectVersionMetadataModel();
- projectVersionMetadataModel.setRowId( key );
+ query = query.addEqualsExpression( "repositoryName", repoId ) //
+ .addEqualsExpression( "namespaceId", namespace ) //
+ .addEqualsExpression( "project", projectId ) //
+ .addEqualsExpression( "projectVersion", projectVersion );
+
+ QueryResult<OrderedRows<String,String,String>> result = query.execute();
+
+ for (Row<String,String,String> row : result.get())
+ {
+ this.artifactMetadataTemplate.deleteRow( row.getKey() );
+ }
- getProjectVersionMetadataModelEntityManager().remove( projectVersionMetadataModel );
- */
}
@Override