org.makumba.commons
Class NameResolver

java.lang.Object
  extended by org.makumba.commons.NameResolver
Direct Known Subclasses:
NameResolverHook

public class NameResolver
extends Object

This class provides utility methods to convert names from MDD types into their name in the data source. It also takes into account properties passed in the database configuration.
TODO document these properties

Version:
$Id: NameResolver.java 5156 2010-05-18 22:14:06Z rosso_nero $
Author:
Manuel Gay, Cristian Bogdan

Nested Class Summary
static class NameResolver.Resolvable
           
static class NameResolver.TextList
           
 
Field Summary
protected  HashMap<String,HashMap<String,String>> fieldDBNames
           
 
Constructor Summary
NameResolver()
           
NameResolver(Properties configurationProperties)
           
 
Method Summary
 String arrowToDot(String name)
           
 String arrowToDoubleDot(String name)
           
 String arrowToDoubleUnderscore(String name)
           
 String checkReserved(String name)
           
 String dotToUnderscore(String name)
           
 String getKey()
           
 String getTableNameFromConfig(Properties config, DataDefinition dd)
          Finds the shortest possible table name, according to what is defined in the configuration with rule and table: general.Person = gp general.Person->fields will create table _gp__fields_ instead of _general_Person__fields_ as it did before
 String mddToSQLName(String name)
           
 String resolveFieldName(DataDefinition dd, String fieldName)
          Resolves the database level name for a field, based on Makumba business rules and specific configuration done by the user.
 String resolveTypeName(DataDefinition dd)
          Resolves the database level name for a type, based on Makumba business rules and specific configuration done by the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldDBNames

protected HashMap<String,HashMap<String,String>> fieldDBNames
Constructor Detail

NameResolver

public NameResolver()

NameResolver

public NameResolver(Properties configurationProperties)
Method Detail

getKey

public String getKey()

resolveTypeName

public String resolveTypeName(DataDefinition dd)
Resolves the database level name for a type, based on Makumba business rules and specific configuration done by the user.

Parameters:
dd - the DataDefinition corresponding to the type to resolve
Returns:
the database level name for this type

resolveFieldName

public String resolveFieldName(DataDefinition dd,
                               String fieldName)
Resolves the database level name for a field, based on Makumba business rules and specific configuration done by the user.

Parameters:
dd - the DataDefinition corresponding to the type of the field to resolve
fieldName - the name of the field to resolve
Returns:
the database level name for this field

getTableNameFromConfig

public String getTableNameFromConfig(Properties config,
                                     DataDefinition dd)
Finds the shortest possible table name, according to what is defined in the configuration with rule and table: general.Person = gp general.Person->fields will create table _gp__fields_ instead of _general_Person__fields_ as it did before

Parameters:
config - the configuration Properties
dd - the DataDefinition corresponding to the type
Returns:
the name of the table as specified in the configuration

dotToUnderscore

public String dotToUnderscore(String name)

arrowToDot

public String arrowToDot(String name)

arrowToDoubleDot

public String arrowToDoubleDot(String name)

arrowToDoubleUnderscore

public String arrowToDoubleUnderscore(String name)

checkReserved

public String checkReserved(String name)

mddToSQLName

public String mddToSQLName(String name)