org.hibernate.envers.entities.mapper.relation.component
Class MiddleStraightComponentMapper

java.lang.Object
  extended by org.hibernate.envers.entities.mapper.relation.component.MiddleStraightComponentMapper
All Implemented Interfaces:
MiddleComponentMapper

public final class MiddleStraightComponentMapper
extends Object
implements MiddleComponentMapper

A mapper for reading and writing a property straight to/from maps. This mapper cannot be used with middle tables, but only with "fake" bidirectional indexed relations.

Author:
Adam Warski (adam at warski dot org)

Constructor Summary
MiddleStraightComponentMapper(String propertyName)
           
 
Method Summary
 void addMiddleEqualToQuery(Parameters parameters, String prefix1, String prefix2)
          Adds query statements, which contains restrictions, which express the property that part of the middle entity with alias prefix1, is equal to part of the middle entity with alias prefix2 (the entity is the same).
 void mapToMapFromObject(Map<String,Object> data, Object obj)
          Maps from an object to the object's map representation (for an entity - only its id).
 Object mapToObjectFromFullMap(EntityInstantiator entityInstantiator, Map<String,Object> data, Object dataObject, Number revision)
          Maps from full object data, contained in the given map (or object representation of the map, if available), to an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiddleStraightComponentMapper

public MiddleStraightComponentMapper(String propertyName)
Method Detail

mapToObjectFromFullMap

public Object mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                                     Map<String,Object> data,
                                     Object dataObject,
                                     Number revision)
Description copied from interface: MiddleComponentMapper
Maps from full object data, contained in the given map (or object representation of the map, if available), to an object.

Specified by:
mapToObjectFromFullMap in interface MiddleComponentMapper
Parameters:
entityInstantiator - An entity instatiator bound with an open versions reader.
data - Full object data.
dataObject - An optional object representation of the data.
revision - Revision at which the data is read.
Returns:
An object with data corresponding to the one found in the given map.

mapToMapFromObject

public void mapToMapFromObject(Map<String,Object> data,
                               Object obj)
Description copied from interface: MiddleComponentMapper
Maps from an object to the object's map representation (for an entity - only its id).

Specified by:
mapToMapFromObject in interface MiddleComponentMapper
Parameters:
data - Map to which data should be added.
obj - Object to map from.

addMiddleEqualToQuery

public void addMiddleEqualToQuery(Parameters parameters,
                                  String prefix1,
                                  String prefix2)
Description copied from interface: MiddleComponentMapper
Adds query statements, which contains restrictions, which express the property that part of the middle entity with alias prefix1, is equal to part of the middle entity with alias prefix2 (the entity is the same). The part is the component's representation in the middle entity.

Specified by:
addMiddleEqualToQuery in interface MiddleComponentMapper
Parameters:
parameters - Parameters, to which to add the statements.
prefix1 - First alias of the entity + prefix to add to the properties.
prefix2 - Second alias of the entity + prefix to add to the properties.


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.