com.metamatrix.connector.metadata.index
Class IndexCriteriaBuilder

java.lang.Object
  extended by com.metamatrix.connector.metadata.index.IndexCriteriaBuilder

public class IndexCriteriaBuilder
extends java.lang.Object

This is used by MetadataConnector to build criteria patterns used to query index files. This has generic methods to build criteria that matches a particular header patterns that is part of most index records. It also can be extended to create a pattern that matches the record pattern for a given record type.

Since:
4.3

Constructor Summary
IndexCriteriaBuilder()
           
 
Method Summary
static java.util.Collection getLiteralCriteria(java.util.Map criteria)
          Return a collection of criteria maps with MetadataLiteralCriteria's, any compound criteria are broken down into a collection of MetadataLiteralCriteria.
static java.lang.String getMatchPattern(java.lang.String indexName, java.util.Map criteria)
          Return the pattern match string constructed from a map of match criteria values.
static java.lang.String getMatchPrefix(java.lang.String indexName, java.util.Map criteria)
          Return the prefix match string constructed from a map of match criteria values.
protected static java.lang.String getValueInCriteria(java.util.Map criteria, java.lang.String fieldName)
          Look for the value for the given field in the criteria map, translate it if necessary to the format stored in index files and return it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexCriteriaBuilder

public IndexCriteriaBuilder()
Method Detail

getMatchPrefix

public static java.lang.String getMatchPrefix(java.lang.String indexName,
                                              java.util.Map criteria)
Return the prefix match string constructed from a map of match criteria values. The match criteria map is keyed on field names found in the MetadataRecord.

Parameters:
indexName - The name of the index file that would be queried using the prefix returned.
criteria - the map of match criteria to use
Returns:
the prefix string

getMatchPattern

public static java.lang.String getMatchPattern(java.lang.String indexName,
                                               java.util.Map criteria)
Return the pattern match string constructed from a map of match criteria values. The match criteria map is keyed on field names found in the MetadataRecord.

Parameters:
indexName - The name of the index file that would be queried using the pattern returned.
criteria - the map of match criteria to use
Returns:
the pattern string

getLiteralCriteria

public static java.util.Collection getLiteralCriteria(java.util.Map criteria)
Return a collection of criteria maps with MetadataLiteralCriteria's, any compound criteria are broken down into a collection of MetadataLiteralCriteria.

Parameters:
criteria - The criteria built from metadata query
Returns:
Collection of maps with literal criteria
Since:
4.3

getValueInCriteria

protected static java.lang.String getValueInCriteria(java.util.Map criteria,
                                                     java.lang.String fieldName)
Look for the value for the given field in the criteria map, translate it if necessary to the format stored in index files and return it.

Parameters:
criteria - the map of match criteria to use
fieldName - The name of the field to look for in the criteria
Returns:
The value for the given field in the criteria
Since:
4.3


Copyright © 2009. All Rights Reserved.