org.broadleafcommerce.openadmin.server.service.persistence.module
Interface RecordHelper

All Known Implementing Classes:
AdornedTargetListPersistenceModule, BasicPersistenceModule, MapStructurePersistenceModule

public interface RecordHelper

Helper interface for serializing/deserializing the generic Entity DTO to/from its actual domain object representation.

Author:
jfischer
See Also:
BasicPersistenceModule}, MapStructurePersistenceModule}, AdornedTargetListPersistenceModule}

Method Summary
 EntityResult add(PersistencePackage persistencePackage, boolean includeRealEntityObject)
           
 Serializable createPopulatedInstance(Serializable instance, Entity entity, Map<String,FieldMetadata> mergedProperties, Boolean setId)
          Populates a Hibernate entity instance based on the values from entity (the DTO representation of instance) and the metadata from mergedProperties.
 PersistenceModule getCompatibleModule(OperationType operationType)
           
 DecimalFormat getDecimalFormatter()
           
 FieldManager getFieldManager()
           
 List<FilterMapping> getFilterMappings(PersistencePerspective persistencePerspective, CriteriaTransferObject cto, String ceilingEntityFullyQualifiedClassname, Map<String,FieldMetadata> mergedProperties)
           
 List<FilterMapping> getFilterMappings(PersistencePerspective persistencePerspective, CriteriaTransferObject cto, String ceilingEntityFullyQualifiedClassname, Map<String,FieldMetadata> mergedUnfilteredProperties, RestrictionFactory customRestrictionFactory)
           
 List<Serializable> getPersistentRecords(String ceilingEntity, List<FilterMapping> filterMappings, Integer firstResult, Integer maxResults)
           
 Object getPrimaryKey(Entity entity, Map<String,FieldMetadata> mergedProperties)
           
 Entity getRecord(Class<?> ceilingEntityClass, PersistencePerspective persistencePerspective, Serializable record)
           
 Entity getRecord(Map<String,FieldMetadata> primaryMergedProperties, Serializable record, Map<String,FieldMetadata> alternateMergedProperties, String pathToTargetObject)
           
 Entity[] getRecords(Class<?> ceilingEntityClass, PersistencePerspective persistencePerspective, List<? extends Serializable> records)
           
 Entity[] getRecords(Map<String,FieldMetadata> primaryMergedProperties, List<? extends Serializable> records)
           
 Entity[] getRecords(Map<String,FieldMetadata> primaryMergedProperties, List<? extends Serializable> records, Map<String,FieldMetadata> alternateMergedProperties, String pathToTargetObject)
           
 Map<String,FieldMetadata> getSimpleMergedProperties(String entityName, PersistencePerspective persistencePerspective)
           
 Integer getTotalRecords(String ceilingEntity, List<FilterMapping> filterMappings)
           
 EntityResult update(PersistencePackage persistencePackage, boolean includeRealEntityObject)
           
 boolean validate(Entity entity, Serializable populatedInstance, Map<String,FieldMetadata> mergedProperties)
          Validates the Entity based on the validators associated with each property
 

Method Detail

getFilterMappings

List<FilterMapping> getFilterMappings(PersistencePerspective persistencePerspective,
                                      CriteriaTransferObject cto,
                                      String ceilingEntityFullyQualifiedClassname,
                                      Map<String,FieldMetadata> mergedProperties)

getFilterMappings

List<FilterMapping> getFilterMappings(PersistencePerspective persistencePerspective,
                                      CriteriaTransferObject cto,
                                      String ceilingEntityFullyQualifiedClassname,
                                      Map<String,FieldMetadata> mergedUnfilteredProperties,
                                      RestrictionFactory customRestrictionFactory)

getRecords

Entity[] getRecords(Map<String,FieldMetadata> primaryMergedProperties,
                    List<? extends Serializable> records,
                    Map<String,FieldMetadata> alternateMergedProperties,
                    String pathToTargetObject)

getRecords

Entity[] getRecords(Map<String,FieldMetadata> primaryMergedProperties,
                    List<? extends Serializable> records)

getRecords

Entity[] getRecords(Class<?> ceilingEntityClass,
                    PersistencePerspective persistencePerspective,
                    List<? extends Serializable> records)

getRecord

Entity getRecord(Map<String,FieldMetadata> primaryMergedProperties,
                 Serializable record,
                 Map<String,FieldMetadata> alternateMergedProperties,
                 String pathToTargetObject)

getRecord

Entity getRecord(Class<?> ceilingEntityClass,
                 PersistencePerspective persistencePerspective,
                 Serializable record)

createPopulatedInstance

Serializable createPopulatedInstance(Serializable instance,
                                     Entity entity,
                                     Map<String,FieldMetadata> mergedProperties,
                                     Boolean setId)
                                     throws ValidationException

Populates a Hibernate entity instance based on the values from entity (the DTO representation of instance) and the metadata from mergedProperties.

While populating instance, validation is also performed using the EntityValidatorService. If this validation fails, then the instance is left unchanged and a ValidationExcpetion is thrown. In the common case, this exception bubbles up to the DynamicRemoteService which catches the exception and communicates appropriately to the invoker

Parameters:
instance -
entity -
mergedProperties -
setId -
Returns:
instance populated with the property values from entity according to the metadata specified in mergedProperties
Throws:
ValidationException - if after populating instance via the values in entity then EntityValidatorService.validate(Entity, Serializable, Map) returns false
See Also:
EntityValidatorService}

getPrimaryKey

Object getPrimaryKey(Entity entity,
                     Map<String,FieldMetadata> mergedProperties)

getSimpleMergedProperties

Map<String,FieldMetadata> getSimpleMergedProperties(String entityName,
                                                    PersistencePerspective persistencePerspective)

getFieldManager

FieldManager getFieldManager()

getCompatibleModule

PersistenceModule getCompatibleModule(OperationType operationType)

getDecimalFormatter

DecimalFormat getDecimalFormatter()

validate

boolean validate(Entity entity,
                 Serializable populatedInstance,
                 Map<String,FieldMetadata> mergedProperties)
Validates the Entity based on the validators associated with each property

Parameters:
entity - the instance that is attempted to be saved from. Implementers should set Entity.isValidationFailure() accordingly as a result of the validation
populatedInstance -
mergedProperties - TODO
Returns:
whether or not the entity passed validation. This yields the same result as calling !Entity.isValidationFailure() after invoking this method

getTotalRecords

Integer getTotalRecords(String ceilingEntity,
                        List<FilterMapping> filterMappings)

getPersistentRecords

List<Serializable> getPersistentRecords(String ceilingEntity,
                                        List<FilterMapping> filterMappings,
                                        Integer firstResult,
                                        Integer maxResults)

update

EntityResult update(PersistencePackage persistencePackage,
                    boolean includeRealEntityObject)
                    throws ServiceException
Throws:
ServiceException

add

EntityResult add(PersistencePackage persistencePackage,
                 boolean includeRealEntityObject)
                 throws ServiceException
Throws:
ServiceException


Copyright © 2013. All Rights Reserved.