archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1488511 - /archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
Date Sat, 01 Jun 2013 12:27:03 GMT
Author: olamy
Date: Sat Jun  1 12:27:03 2013
New Revision: 1488511

URL: http://svn.apache.org/r1488511
Log:
fix removeProjectVersion

Modified:
    archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java

Modified: archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java?rev=1488511&r1=1488510&r2=1488511&view=diff
==============================================================================
--- archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
(original)
+++ archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
Sat Jun  1 12:27:03 2013
@@ -1518,27 +1518,10 @@ public class CassandraMetadataRepository
         throws MetadataRepositoryException
     {
 
-        String key =
-            new ArtifactMetadataModel.KeyBuilder().withRepositoryId( repoId ).withNamespace(
namespace ).withId(
-                projectId ).withProjectVersion( projectVersion ).build();
-
-        ArtifactMetadataModel artifactMetadataModel = artifactMetadataModelEntityManager.get(
key );
-
-        if ( artifactMetadataModel == null )
-        {
-            logger.debug( "removeProjectVersion not found" );
-            return;
-        }
-
-        logger.debug( "removeProjectVersion" );
-
-        artifactMetadataModelEntityManager.remove( artifactMetadataModel );
-
-        /*
-
-        final List<ArtifactMetadataModel> versions = new ArrayList<ArtifactMetadataModel>();
+        final List<ArtifactMetadataModel> artifactMetadataModels = new ArrayList<ArtifactMetadataModel>();
 
         // FIXME use cql query
+
         artifactMetadataModelEntityManager.visitAll( new Function<ArtifactMetadataModel,
Boolean>()
         {
             @Override
@@ -1548,20 +1531,23 @@ public class CassandraMetadataRepository
                 {
                     if ( StringUtils.equals( repoId, artifactMetadataModel.getRepositoryId()
) && StringUtils.equals(
                         namespace, artifactMetadataModel.getNamespace() ) && StringUtils.equals(
projectId,
-                                                                                        
        artifactMetadataModel.getId() )
-                        && StringUtils.equals( projectId,
-                                               artifactMetadataModel.getProjectVersion()
)
-                        )
+                                                                                        
        artifactMetadataModel.getProject() )
+                        && StringUtils.equals( projectVersion, artifactMetadataModel.getProjectVersion()
) )
                     {
-                        versions.add( artifactMetadataModel );
+                        artifactMetadataModels.add( artifactMetadataModel );
                     }
                 }
                 return Boolean.TRUE;
             }
         } );
 
-        artifactMetadataModelEntityManager.remove( versions );
-        */
+        logger.debug( "removeProjectVersions:{}", artifactMetadataModels );
+        if ( artifactMetadataModels.isEmpty() )
+        {
+            return;
+        }
+
+        artifactMetadataModelEntityManager.remove( artifactMetadataModels );
     }
 
     @Override



Mime
View raw message