Search in sources :

Example 6 with Repository

use of org.apache.archiva.metadata.repository.cassandra.model.Repository in project archiva by apache.

the class CassandraMetadataRepository method removeProject.

@Override
public void removeProject(final String repositoryId, final String namespaceId, final String projectId) throws MetadataRepositoryException {
    String key = // 
    new Project.KeyBuilder().withProjectId(// 
    projectId).withNamespace(// 
    new Namespace(namespaceId, new Repository(repositoryId))).build();
    this.projectTemplate.deleteRow(key);
    QueryResult<OrderedRows<String, String, String>> result = // 
    HFactory.createRangeSlicesQuery(keyspace, ss, ss, // 
    ss).setColumnFamily(// 
    cassandraArchivaManager.getProjectVersionMetadataFamilyName()).setColumnNames(// 
    ID.toString()).addEqualsExpression(REPOSITORY_NAME.toString(), // 
    repositoryId).addEqualsExpression(NAMESPACE_ID.toString(), // 
    namespaceId).addEqualsExpression(PROJECT_ID.toString(), // 
    projectId).execute();
    for (Row<String, String, String> row : result.get()) {
        this.projectVersionMetadataTemplate.deleteRow(row.getKey());
        removeMailingList(row.getKey());
    }
    result = // 
    HFactory.createRangeSlicesQuery(keyspace, ss, ss, // 
    ss).setColumnFamily(// 
    cassandraArchivaManager.getArtifactMetadataFamilyName()).setColumnNames(// 
    PROJECT_ID.toString()).addEqualsExpression(REPOSITORY_NAME.toString(), // 
    repositoryId).addEqualsExpression(NAMESPACE_ID.toString(), // 
    namespaceId).addEqualsExpression(PROJECT_ID.toString(), // 
    projectId).execute();
    for (Row<String, String, String> row : result.get()) {
        this.artifactMetadataTemplate.deleteRow(row.getKey());
    }
}
Also used : Project(org.apache.archiva.metadata.repository.cassandra.model.Project) MetadataRepository(org.apache.archiva.metadata.repository.MetadataRepository) Repository(org.apache.archiva.metadata.repository.cassandra.model.Repository) OrderedRows(me.prettyprint.hector.api.beans.OrderedRows) Namespace(org.apache.archiva.metadata.repository.cassandra.model.Namespace)

Aggregations

Repository (org.apache.archiva.metadata.repository.cassandra.model.Repository)6 MetadataRepository (org.apache.archiva.metadata.repository.MetadataRepository)5 Namespace (org.apache.archiva.metadata.repository.cassandra.model.Namespace)5 OrderedRows (me.prettyprint.hector.api.beans.OrderedRows)3 MetadataRepositoryException (org.apache.archiva.metadata.repository.MetadataRepositoryException)3 HInvalidRequestException (me.prettyprint.hector.api.exceptions.HInvalidRequestException)2 MutationResult (me.prettyprint.hector.api.mutation.MutationResult)2 ProjectMetadata (org.apache.archiva.metadata.model.ProjectMetadata)2 ProjectVersionMetadataModel (org.apache.archiva.metadata.repository.cassandra.model.ProjectVersionMetadataModel)2 CiManagement (org.apache.archiva.metadata.model.CiManagement)1 IssueManagement (org.apache.archiva.metadata.model.IssueManagement)1 Organization (org.apache.archiva.metadata.model.Organization)1 Scm (org.apache.archiva.metadata.model.Scm)1 MetadataResolutionException (org.apache.archiva.metadata.repository.MetadataResolutionException)1 ArtifactMetadataModel (org.apache.archiva.metadata.repository.cassandra.model.ArtifactMetadataModel)1 Project (org.apache.archiva.metadata.repository.cassandra.model.Project)1 Test (org.junit.Test)1