gov.usda.gdpc.database
Class AbstractPropertyMap

java.lang.Object
  extended bygov.usda.gdpc.database.AbstractPropertyMap
All Implemented Interfaces:
PropertyMap
Direct Known Subclasses:
PanzeaPropertyMap

public abstract class AbstractPropertyMap
extends java.lang.Object
implements PropertyMap

This class provides a skeletal implementation of the PropertyMap interface, to minimize the effort required to implement this interface.

Author:
terryc

Field Summary
protected  java.util.Map myMappings
           
 
Constructor Summary
AbstractPropertyMap()
          AbstractPropertyMap Constructor.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myMappings

protected java.util.Map myMappings
Constructor Detail

AbstractPropertyMap

public AbstractPropertyMap()
AbstractPropertyMap Constructor.

Method Detail

getMapping

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

Specified by:
getMapping in interface PropertyMap
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.

Specified by:
addMapping in interface PropertyMap
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.

Specified by:
getMatchingMapping in interface PropertyMap
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.

Specified by:
getSQL in interface PropertyMap
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.

Specified by:
getMappings in interface PropertyMap
Parameters:
type - type to match
Returns:
list of database mappings