gov.usda.gdpc.database
Interface PropertyMap

All Known Implementing Classes:
AbstractPropertyMap

public interface PropertyMap

This is a collection of database mappings for database.

Author:
terryc

Method Summary
 void addMapping(DatabaseMapping mapping)
          Adds the specified database mapping.
 DatabaseMapping getMapping(Property property)
          Gets the mapping associated with the given property.
 DatabaseMapping[] getMappings(java.lang.Class type)
          Gets the database mappings from this property map that an associated property of the give type.
 DatabaseMapping getMatchingMapping(DatabaseMapping mapping)
          Gets the database mapping that matches the given database mapping.
 java.lang.String getSQL(Filter filter, ExtraInfo extraInfo)
          Get the SQL "where" string required to retrieve the data matching the given filter for this property map.
 

Method Detail

getMapping

public DatabaseMapping getMapping(Property property)
Gets the mapping associated with the given property.

Parameters:
property - the property
Returns:
the database mapping

addMapping

public void addMapping(DatabaseMapping mapping)
Adds the specified database mapping. No two database mappings can be associated with same property. Can not add mapping to a property map which does not have specified property.

Parameters:
mapping - the mapping to add

getMatchingMapping

public DatabaseMapping getMatchingMapping(DatabaseMapping mapping)
Gets the database mapping that matches the given database mapping. The given database mapping needs no associated property. It is only required to have the database specific infomation. This method will return the matching database mapping containing the associated property and database specific information.

Parameters:
mapping - the mapping to match
Returns:
the matching databases mapping

getSQL

public java.lang.String getSQL(Filter filter,
                               ExtraInfo extraInfo)
Get the SQL "where" string required to retrieve the data matching the given filter for this property map.

Parameters:
filter - the filter
extraInfo - this is extra information that will be passed along to the individual database mappings used by the property map to generate the SQL. null if not needed.
Returns:
the SQL

getMappings

public DatabaseMapping[] getMappings(java.lang.Class type)
Gets the database mappings from this property map that an associated property of the give type.

Parameters:
type - type to match
Returns:
list of database mappings