com.anasoft.os.daofusion.cto.server
Class NestedPropertyCriteriaBasedConverter

java.lang.Object
  extended by com.anasoft.os.daofusion.util.SimpleMapContainer<java.lang.String,NestedPropertyMappingGroup>
      extended by com.anasoft.os.daofusion.cto.server.NestedPropertyCriteriaBasedConverter
All Implemented Interfaces:
CriteriaTransferObjectConverter

public class NestedPropertyCriteriaBasedConverter
extends SimpleMapContainer<java.lang.String,NestedPropertyMappingGroup>
implements CriteriaTransferObjectConverter

Generic persistent entity criteria transfer object converter implementation using NestedPropertyCriteria as the server-side criteria implementation.

This class uses persistent entity property mappings (NestedPropertyMapping instances) to define relations between the CriteriaTransferObject and NestedPropertyCriteria for a specific persistent entity via NestedPropertyMappingGroup definitions.

Author:
vojtech.szocs
See Also:
CriteriaTransferObjectConverter, NestedPropertyMapping, NestedPropertyMappingGroup, SimpleMapContainer

Constructor Summary
NestedPropertyCriteriaBasedConverter()
           
 
Method Summary
 void addMapping(java.lang.String mappingGroupName, NestedPropertyMapping mapping)
          Adds the given NestedPropertyMapping to this converter by associating it with the requested property mapping group.
 PersistentEntityCriteria convert(CriteriaTransferObject transferObject, java.lang.String mappingGroupName)
          Converts the given CriteriaTransferObject instance into a corresponding PersistentEntityCriteria according to property mappings defined by the requested property mapping group.
protected  NestedPropertyCriteria createCriteria()
          Creates a NestedPropertyCriteria instance to be used within the convert(CriteriaTransferObject, String) method.
protected  java.lang.String getKey(NestedPropertyMappingGroup object)
          Returns the key for the given object.
 
Methods inherited from class com.anasoft.os.daofusion.util.SimpleMapContainer
add, clear, containsKey, getObjectMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NestedPropertyCriteriaBasedConverter

public NestedPropertyCriteriaBasedConverter()
Method Detail

addMapping

public void addMapping(java.lang.String mappingGroupName,
                       NestedPropertyMapping mapping)
Adds the given NestedPropertyMapping to this converter by associating it with the requested property mapping group.

Note that the method creates the mapping group if not found within the converter.

This is the preferred way of configuring property mappings for this converter implementation.

Parameters:
mappingGroupName - Name of the property mapping group.
mapping - Persistent entity property mapping to add.

createCriteria

protected NestedPropertyCriteria createCriteria()
Creates a NestedPropertyCriteria instance to be used within the convert(CriteriaTransferObject, String) method.

Override this method if you want to plug in your custom NestedPropertyCriteria implementation.

Returns:
NestedPropertyCriteria instance to hold criteria from the criteria transfer object.

convert

public PersistentEntityCriteria convert(CriteriaTransferObject transferObject,
                                        java.lang.String mappingGroupName)
Description copied from interface: CriteriaTransferObjectConverter
Converts the given CriteriaTransferObject instance into a corresponding PersistentEntityCriteria according to property mappings defined by the requested property mapping group.

Specified by:
convert in interface CriteriaTransferObjectConverter
Parameters:
transferObject - CriteriaTransferObject instance to convert.
mappingGroupName - Name of the property mapping group to use.
Returns:
Resulting PersistentEntityCriteria instance.
See Also:
CriteriaTransferObjectConverter.convert(com.anasoft.os.daofusion.cto.client.CriteriaTransferObject, java.lang.String)

getKey

protected java.lang.String getKey(NestedPropertyMappingGroup object)
Description copied from class: SimpleMapContainer
Returns the key for the given object.

Specified by:
getKey in class SimpleMapContainer<java.lang.String,NestedPropertyMappingGroup>
Parameters:
object - Object for which the key is required.
Returns:
Object key to use within the object map.
See Also:
SimpleMapContainer.getKey(java.lang.Object)


Copyright © 2008-2009 ANASOFT and contributors. All Rights Reserved.