org.ujorm.orm.ao
Class IndexModelBuilder

java.lang.Object
  extended by org.ujorm.orm.ao.IndexModelBuilder
Direct Known Subclasses:
IndexModelOrderedBuilder

public class IndexModelBuilder
extends Object

The database index model builder. The builder sorts columns of the composite index according the natural order of Keys in the Ujo class
See the next example to create a composite index with two columns with a natural order:

   @Column(index = IDX_STATE_NOTE)
   public static final Key<XOrder, State> STATE = newKey();

   @Column(index = IDX_STATE_NOTE)
   public static final Key<XOrder, Integer> COUNT = newKey();
 
The builder class can be changed by the parameter MetaParams.INDEX_MODEL_BUILDER.

See Also:
IndexModelOrderedBuilder, MetaParams.INDEX_MODEL_BUILDER

Field Summary
protected  Map<String,MetaIndex> mapIndex
          Map a MetaIndex for an index name (case insensitive)
protected  MetaTable metaTable
          MetaTable
protected  SqlNameProvider nameProvider
          SQL name provider
 
Constructor Summary
IndexModelBuilder()
           
 
Method Summary
protected  void addColumnsToIndex()
          Add columns to index
protected  void addIndex(String indexName, MetaColumn column, boolean unique)
          Add the column model to the index model from the IndexMap according the index name (case insensitive)
 Collection<MetaIndex> getIndexModels()
          Returns all indexes of the current table
 void init(MetaTable metaTable)
          Initialize the object
protected  Boolean isExtendedIndexStrategy()
          Is an extended index naming strategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metaTable

protected MetaTable metaTable
MetaTable


nameProvider

protected SqlNameProvider nameProvider
SQL name provider


mapIndex

protected Map<String,MetaIndex> mapIndex
Map a MetaIndex for an index name (case insensitive)

Constructor Detail

IndexModelBuilder

public IndexModelBuilder()
Method Detail

init

public void init(MetaTable metaTable)
          throws IllegalStateException
Initialize the object

Throws:
IllegalStateException

addIndex

protected void addIndex(String indexName,
                        MetaColumn column,
                        boolean unique)
Add the column model to the index model from the IndexMap according the index name (case insensitive)

Parameters:
indexName - Case sensitive index name
column - Column model
unique - Unique index request

getIndexModels

public Collection<MetaIndex> getIndexModels()
Returns all indexes of the current table

Returns:
Collection of the Index model

addColumnsToIndex

protected void addColumnsToIndex()
Add columns to index


isExtendedIndexStrategy

protected Boolean isExtendedIndexStrategy()
Is an extended index naming strategy

See Also:
MoreParams.EXTENTED_INDEX_NAME_STRATEGY


Copyright 2013, Pavel Ponec