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();
implements Serializable
{
- private String id;
-
private String name;
private String repositoryId;
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()
{
Namespace namespace = (Namespace) o;
- if ( !id.equals( namespace.id ) )
+ if ( !name.equals( namespace.name ) )
{
return false;
}
@Override
public int hashCode()
{
- int result = id.hashCode();
+ int result = name.hashCode();
result = 31 * result + repositoryId.hashCode();
return result;
}
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( '}' );