mirror of https://github.com/apache/archiva.git
Use the same list of ArtifactMetadata column names everywhere
This commit is contained in:
parent
f4f7c971b6
commit
011f82dc21
|
@ -1706,8 +1706,7 @@ public class CassandraMetadataRepository
|
|||
RangeSlicesQuery<String, String, Long> query = HFactory //
|
||||
.createRangeSlicesQuery( keyspace, ss, ss, ls ) //
|
||||
.setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) //
|
||||
.setColumnNames( NAMESPACE_ID.toString(), SIZE.toString(), ID.toString(), FILE_LAST_MODIFIED.toString(), MD5.toString(), PROJECT.toString(), PROJECT_VERSION.toString(),
|
||||
REPOSITORY_NAME.toString(), VERSION.toString(), WHEN_GATHERED.toString(), SHA1.toString() ); //
|
||||
.setColumnNames( ArtifactMetadataModel.COLUMNS ); //
|
||||
|
||||
if ( startTime != null )
|
||||
{
|
||||
|
@ -1789,8 +1788,7 @@ public class CassandraMetadataRepository
|
|||
RangeSlicesQuery<String, String, String> query = HFactory //
|
||||
.createRangeSlicesQuery( keyspace, ss, ss, ss ) //
|
||||
.setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) //
|
||||
.setColumnNames( NAMESPACE_ID.toString(), SIZE.toString(), ID.toString(), FILE_LAST_MODIFIED.toString(), MD5.toString(), PROJECT.toString(), PROJECT_VERSION.toString(),
|
||||
REPOSITORY_NAME.toString(), VERSION.toString(), WHEN_GATHERED.toString(), SHA1.toString() ); //
|
||||
.setColumnNames( ArtifactMetadataModel.COLUMNS ); //
|
||||
|
||||
query = query.addEqualsExpression( SHA1.toString(), checksum ).addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId );
|
||||
|
||||
|
@ -1899,8 +1897,7 @@ public class CassandraMetadataRepository
|
|||
RangeSlicesQuery<String, String, String> query = HFactory //
|
||||
.createRangeSlicesQuery( keyspace, ss, ss, ss ) //
|
||||
.setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) //
|
||||
.setColumnNames( NAMESPACE_ID.toString(), SIZE.toString(), ID.toString(), FILE_LAST_MODIFIED.toString(), MD5.toString(), PROJECT.toString(), PROJECT_VERSION.toString(),
|
||||
REPOSITORY_NAME.toString(), VERSION.toString(), WHEN_GATHERED.toString(), SHA1.toString() ); //
|
||||
.setColumnNames( ArtifactMetadataModel.COLUMNS ); //
|
||||
|
||||
query = query.addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId );
|
||||
|
||||
|
@ -2009,8 +2006,7 @@ public class CassandraMetadataRepository
|
|||
QueryResult<OrderedRows<String, String, String>> result =
|
||||
HFactory.createRangeSlicesQuery( keyspace, ss, ss, ss ) //
|
||||
.setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) //
|
||||
.setColumnNames( ID.toString(), REPOSITORY_NAME.toString(), NAMESPACE_ID.toString(), PROJECT.toString(), PROJECT_VERSION.toString(), VERSION.toString(),
|
||||
FILE_LAST_MODIFIED.toString(), SIZE.toString(), MD5.toString(), SHA1.toString(), WHEN_GATHERED.toString() )//
|
||||
.setColumnNames( ArtifactMetadataModel.COLUMNS )//
|
||||
.setRowCount( Integer.MAX_VALUE ) //
|
||||
.addEqualsExpression( REPOSITORY_NAME.toString(), repoId ) //
|
||||
.addEqualsExpression( NAMESPACE_ID.toString(), namespace ) //
|
||||
|
|
|
@ -28,6 +28,8 @@ import me.prettyprint.hector.api.beans.ColumnSlice;
|
|||
import me.prettyprint.hector.api.beans.HColumn;
|
||||
import me.prettyprint.hector.api.factory.HFactory;
|
||||
import me.prettyprint.hector.api.mutation.Mutator;
|
||||
|
||||
import org.apache.archiva.metadata.repository.cassandra.model.ColumnNames;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -77,6 +79,11 @@ public class CassandraUtils
|
|||
(Serializer<B>) SerializerTypeInferer.getSerializer( value ) );
|
||||
}
|
||||
|
||||
public static String getStringValue( ColumnSlice<String, String> columnSlice, ColumnNames columnName )
|
||||
{
|
||||
return getStringValue( columnSlice, columnName.toString() );
|
||||
}
|
||||
|
||||
public static String getStringValue( ColumnSlice<String, String> columnSlice, String columnName )
|
||||
{
|
||||
if ( StringUtils.isEmpty( columnName ) )
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.archiva.metadata.repository.cassandra.model;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import static org.apache.archiva.metadata.repository.cassandra.model.ColumnNames.*;
|
||||
|
||||
import org.apache.archiva.metadata.repository.cassandra.CassandraUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -34,6 +36,10 @@ public class ArtifactMetadataModel
|
|||
implements Serializable
|
||||
{
|
||||
|
||||
public final static String[] COLUMNS = new String[] { ID.toString(), REPOSITORY_NAME.toString(),
|
||||
NAMESPACE_ID.toString(), PROJECT.toString(), PROJECT_VERSION.toString(), VERSION.toString(),
|
||||
FILE_LAST_MODIFIED.toString(), SIZE.toString(), MD5.toString(), SHA1.toString(), WHEN_GATHERED.toString() };
|
||||
|
||||
private String id;
|
||||
|
||||
private String repositoryId;
|
||||
|
|
Loading…
Reference in New Issue