use of org.apache.archiva.metadata.repository.cassandra.model.Project in project archiva by apache.
the class CassandraMetadataRepository method updateProject.
@Override
public void updateProject(String repositoryId, ProjectMetadata projectMetadata) throws MetadataRepositoryException {
QueryResult<OrderedRows<String, String, String>> result = //
HFactory.createRangeSlicesQuery(keyspace, ss, ss, //
ss).setColumnFamily(//
cassandraArchivaManager.getProjectFamilyName()).setColumnNames(//
PROJECT_ID.toString()).addEqualsExpression(REPOSITORY_NAME.toString(), //
repositoryId).addEqualsExpression(NAMESPACE_ID.toString(), //
projectMetadata.getNamespace()).addEqualsExpression(PROJECT_ID.toString(), //
projectMetadata.getId()).execute();
// project exists ? if yes return nothing to update here
if (result.get().getCount() > 0) {
return;
} else {
Namespace namespace = updateOrAddNamespace(repositoryId, projectMetadata.getNamespace());
String key = new Project.KeyBuilder().withProjectId(projectMetadata.getId()).withNamespace(namespace).build();
String cf = cassandraArchivaManager.getProjectFamilyName();
projectTemplate.createMutator().addInsertion(key, cf, //
CassandraUtils.column(PROJECT_ID.toString(), projectMetadata.getId())).addInsertion(key, cf, //
CassandraUtils.column(REPOSITORY_NAME.toString(), repositoryId)).addInsertion(key, cf, //
CassandraUtils.column(NAMESPACE_ID.toString(), projectMetadata.getNamespace())).execute();
}
}
Aggregations