this id field is not anymore needed

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1579823 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2014-03-20 23:22:59 +00:00
parent 2e2090deac
commit a0eb0b968e
2 changed files with 7 additions and 17 deletions

View File

@ -163,16 +163,19 @@ public class CassandraMetadataRepository
Keyspace keyspace = cassandraArchivaManager.getKeyspace(); Keyspace keyspace = cassandraArchivaManager.getKeyspace();
String key =
new Namespace.KeyBuilder().withNamespace( namespaceId ).withRepositoryId( repositoryId ).build();
Namespace namespace = getNamespace( repositoryId, namespaceId ); Namespace namespace = getNamespace( repositoryId, namespaceId );
if ( namespace == null ) if ( namespace == null )
{ {
namespace = new Namespace( namespaceId, repository ); namespace = new Namespace( namespaceId, repository );
HFactory.createMutator( keyspace, StringSerializer.get() ) HFactory.createMutator( keyspace, StringSerializer.get() )
// values // values
.addInsertion( namespace.getId(), // .addInsertion( key, //
cassandraArchivaManager.getNamespaceFamilyName(), // cassandraArchivaManager.getNamespaceFamilyName(), //
CassandraUtils.column( "name", namespace.getName() ) ) // CassandraUtils.column( "name", namespace.getName() ) ) //
.addInsertion( namespace.getId(), // .addInsertion( key, //
cassandraArchivaManager.getNamespaceFamilyName(), // cassandraArchivaManager.getNamespaceFamilyName(), //
CassandraUtils.column( "repositoryId", repository.getId() ) ) // CassandraUtils.column( "repositoryId", repository.getId() ) ) //
.execute(); .execute();

View File

@ -33,8 +33,6 @@ public class Namespace
implements Serializable implements Serializable
{ {
private String id;
private String name; private String name;
private String repositoryId; private String repositoryId;
@ -49,21 +47,11 @@ public class Namespace
public Namespace( String id, Repository repository ) public Namespace( String id, Repository repository )
{ {
this.id = new KeyBuilder().withNamespace( id ).withRepositoryId( repository.getId() ).build();
this.name = id; this.name = id;
this.repositoryId = repository.getId(); this.repositoryId = repository.getId();
this.repositoryName = repository.getName(); this.repositoryName = repository.getName();
} }
public String getId()
{
return id;
}
public void setId( String id )
{
this.id = id;
}
public String getName() public String getName()
{ {
@ -100,7 +88,7 @@ public class Namespace
Namespace namespace = (Namespace) o; Namespace namespace = (Namespace) o;
if ( !id.equals( namespace.id ) ) if ( !name.equals( namespace.name ) )
{ {
return false; return false;
} }
@ -115,7 +103,7 @@ public class Namespace
@Override @Override
public int hashCode() public int hashCode()
{ {
int result = id.hashCode(); int result = name.hashCode();
result = 31 * result + repositoryId.hashCode(); result = 31 * result + repositoryId.hashCode();
return result; return result;
} }
@ -124,7 +112,6 @@ public class Namespace
public String toString() public String toString()
{ {
final StringBuilder sb = new StringBuilder( "Namespace{" ); final StringBuilder sb = new StringBuilder( "Namespace{" );
sb.append( "id='" ).append( id ).append( '\'' );
sb.append( ", name='" ).append( name ).append( '\'' ); sb.append( ", name='" ).append( name ).append( '\'' );
sb.append( ", repository='" ).append( repositoryId ).append( '\'' ); sb.append( ", repository='" ).append( repositoryId ).append( '\'' );
sb.append( '}' ); sb.append( '}' );