org.hibernate.envers.entities.mapper.id
Interface IdMapper

All Known Subinterfaces:
SimpleIdMapperBuilder
All Known Implementing Classes:
AbstractCompositeIdMapper, AbstractIdMapper, EmbeddedIdMapper, MultipleIdMapper, SingleIdMapper

public interface IdMapper

Author:
Adam Warski (adam at warski dot org)

Method Summary
 void addIdEqualsToQuery(Parameters parameters, Object id, String prefix, boolean equals)
          Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix, is equal to the given object.
 void addIdsEqualToQuery(Parameters parameters, String prefix1, IdMapper mapper2, String prefix2)
          Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix1, is equal to the id of the entity with alias prefix2 mapped by the second mapper (the second mapper must be for the same entity, but it can have, for example, prefixed properties).
 void addIdsEqualToQuery(Parameters parameters, String prefix1, String prefix2)
          Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix1, is equal to the id of the entity with alias prefix2 (the entity is the same).
 void addNamedIdEqualsToQuery(Parameters parameters, String prefix, boolean equals)
          Adds query statements, which contains named parameters, which express the property that the id of the entity with alias prefix, is equal to the given object.
 void mapToEntityFromMap(Object obj, Map data)
           
 Object mapToIdFromEntity(Object data)
           
 Object mapToIdFromMap(Map data)
           
 void mapToMapFromEntity(Map<String,Object> data, Object obj)
           
 void mapToMapFromId(Map<String,Object> data, Object obj)
           
 List<QueryParameterData> mapToQueryParametersFromId(Object obj)
           
 IdMapper prefixMappedProperties(String prefix)
          Creates a mapper with all mapped properties prefixed.
 

Method Detail

mapToMapFromId

void mapToMapFromId(Map<String,Object> data,
                    Object obj)

mapToMapFromEntity

void mapToMapFromEntity(Map<String,Object> data,
                        Object obj)

mapToEntityFromMap

void mapToEntityFromMap(Object obj,
                        Map data)

mapToIdFromEntity

Object mapToIdFromEntity(Object data)

mapToIdFromMap

Object mapToIdFromMap(Map data)

prefixMappedProperties

IdMapper prefixMappedProperties(String prefix)
Creates a mapper with all mapped properties prefixed. A mapped property is a property which is directly mapped to values (not composite).

Parameters:
prefix - Prefix to add to mapped properties
Returns:
A copy of the current property mapper, with mapped properties prefixed.

mapToQueryParametersFromId

List<QueryParameterData> mapToQueryParametersFromId(Object obj)
Parameters:
obj - Id from which to map.
Returns:
A set parameter data, needed to build a query basing on the given id.

addIdsEqualToQuery

void addIdsEqualToQuery(Parameters parameters,
                        String prefix1,
                        String prefix2)
Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix1, is equal to the id of the entity with alias prefix2 (the entity is the same).

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.

addIdsEqualToQuery

void addIdsEqualToQuery(Parameters parameters,
                        String prefix1,
                        IdMapper mapper2,
                        String prefix2)
Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix1, is equal to the id of the entity with alias prefix2 mapped by the second mapper (the second mapper must be for the same entity, but it can have, for example, prefixed properties).

Parameters:
parameters - Parameters, to which to add the statements.
prefix1 - First alias of the entity + prefix to add to the properties.
mapper2 - Second mapper for the same entity, which will be used to get properties for the right side of the equation.
prefix2 - Second alias of the entity + prefix to add to the properties.

addIdEqualsToQuery

void addIdEqualsToQuery(Parameters parameters,
                        Object id,
                        String prefix,
                        boolean equals)
Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix, is equal to the given object.

Parameters:
parameters - Parameters, to which to add the statements.
id - Value of id.
prefix - Prefix to add to the properties (may be null).
equals - Should this query express the "=" relation or the "<>" relation.

addNamedIdEqualsToQuery

void addNamedIdEqualsToQuery(Parameters parameters,
                             String prefix,
                             boolean equals)
Adds query statements, which contains named parameters, which express the property that the id of the entity with alias prefix, is equal to the given object. It is the responsibility of the using method to read parameter values from the id and specify them on the final query object.

Parameters:
parameters - Parameters, to which to add the statements.
prefix - Prefix to add to the properties (may be null).
equals - Should this query express the "=" relation or the "<>" relation.


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