aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-03-20 23:22:59 +0000
committerOlivier Lamy <olamy@apache.org>2014-03-20 23:22:59 +0000
commita0eb0b968eea56ec399d8fb555fea8fe72ad3440 (patch)
tree1487b0395f76c045eb42c1561c7b68c053d47c05
parent2e2090deacfe942899ba62f6c3469a826f90003a (diff)
downloadarchiva-a0eb0b968eea56ec399d8fb555fea8fe72ad3440.tar.gz
archiva-a0eb0b968eea56ec399d8fb555fea8fe72ad3440.zip
this id field is not anymore needed
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1579823 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java7
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Namespace.java17
2 files changed, 7 insertions, 17 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 142e134bc..0ef43f322 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
@@ -163,16 +163,19 @@ public class CassandraMetadataRepository
Keyspace keyspace = cassandraArchivaManager.getKeyspace();
+ String key =
+ new Namespace.KeyBuilder().withNamespace( namespaceId ).withRepositoryId( repositoryId ).build();
+
Namespace namespace = getNamespace( repositoryId, namespaceId );
if ( namespace == null )
{
namespace = new Namespace( namespaceId, repository );
HFactory.createMutator( keyspace, StringSerializer.get() )
// values
- .addInsertion( namespace.getId(), //
+ .addInsertion( key, //
cassandraArchivaManager.getNamespaceFamilyName(), //
CassandraUtils.column( "name", namespace.getName() ) ) //
- .addInsertion( namespace.getId(), //
+ .addInsertion( key, //
cassandraArchivaManager.getNamespaceFamilyName(), //
CassandraUtils.column( "repositoryId", repository.getId() ) ) //
.execute();
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Namespace.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Namespace.java
index a3dcefec8..27a9e7499 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Namespace.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Namespace.java
@@ -33,8 +33,6 @@ public class Namespace
implements Serializable
{
- private String id;
-
private String name;
private String repositoryId;
@@ -49,21 +47,11 @@ public class Namespace
public Namespace( String id, Repository repository )
{
- this.id = new KeyBuilder().withNamespace( id ).withRepositoryId( repository.getId() ).build();
this.name = id;
this.repositoryId = repository.getId();
this.repositoryName = repository.getName();
}
- public String getId()
- {
- return id;
- }
-
- public void setId( String id )
- {
- this.id = id;
- }
public String getName()
{
@@ -100,7 +88,7 @@ public class Namespace
Namespace namespace = (Namespace) o;
- if ( !id.equals( namespace.id ) )
+ if ( !name.equals( namespace.name ) )
{
return false;
}
@@ -115,7 +103,7 @@ public class Namespace
@Override
public int hashCode()
{
- int result = id.hashCode();
+ int result = name.hashCode();
result = 31 * result + repositoryId.hashCode();
return result;
}
@@ -124,7 +112,6 @@ public class Namespace
public String toString()
{
final StringBuilder sb = new StringBuilder( "Namespace{" );
- sb.append( "id='" ).append( id ).append( '\'' );
sb.append( ", name='" ).append( name ).append( '\'' );
sb.append( ", repository='" ).append( repositoryId ).append( '\'' );
sb.append( '}' );