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

All Superinterfaces:
DataFormatProvider
All Known Implementing Classes:
AdornedTargetListPersistenceModule, BasicPersistenceModule, MapStructurePersistenceModule

public interface RecordHelper
extends DataFormatProvider

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> unfilteredProperties, Boolean setId)
          Delegates to the overloaded method with validateUnsubmittedProperties set to true.
 Serializable createPopulatedInstance(Serializable instance, Entity entity, Map<String,FieldMetadata> mergedProperties, Boolean setId, Boolean validateUnsubmittedProperties)
          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)
           
 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)
           
 Serializable getMaxValue(String ceilingEntity, List<FilterMapping> filterMappings, String maxField)
           
 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)
           
 String getStringValueFromGetter(Serializable instance, String propertyName)
          Returns a string representation of the field on the given instance specified by the property name.
 Integer getTotalRecords(String ceilingEntity, List<FilterMapping> filterMappings)
           
 EntityResult update(PersistencePackage persistencePackage, boolean includeRealEntityObject)
           
 boolean validate(Entity entity, Serializable populatedInstance, Map<String,FieldMetadata> mergedProperties)
          Delegates to the overloaded method with validateUnsubmittedProperties set to true.
 boolean validate(Entity entity, Serializable populatedInstance, Map<String,FieldMetadata> mergedProperties, boolean validateUnsubmittedProperties)
          Validates the Entity based on the validators associated with each property
 
Methods inherited from interface org.broadleafcommerce.openadmin.server.service.persistence.module.DataFormatProvider
formatValue, getDecimalFormatter, getSimpleDateFormatter
 

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,
                                     Boolean validateUnsubmittedProperties)
                                     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 -
validateUnsubmittedProperties - if set to true, will ignore validation for properties that weren't submitted along with the entity
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}

createPopulatedInstance

Serializable createPopulatedInstance(Serializable instance,
                                     Entity entity,
                                     Map<String,FieldMetadata> unfilteredProperties,
                                     Boolean setId)
                                     throws ValidationException
Delegates to the overloaded method with validateUnsubmittedProperties set to true.

Throws:
ValidationException
See Also:
createPopulatedInstance(Serializable, Entity, Map, Boolean, Boolean)

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)

validate

boolean validate(Entity entity,
                 Serializable populatedInstance,
                 Map<String,FieldMetadata> mergedProperties,
                 boolean validateUnsubmittedProperties)
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
validateUnsubmittedProperties - if set to true, will ignore validation for properties that weren't submitted along with the entity
Returns:
whether or not the entity passed validation. This yields the same result as calling !Entity.isValidationFailure() after invoking this method

validate

boolean validate(Entity entity,
                 Serializable populatedInstance,
                 Map<String,FieldMetadata> mergedProperties)
Delegates to the overloaded method with validateUnsubmittedProperties set to true.

See Also:
validate(Entity, Serializable, Map, boolean)

getTotalRecords

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

getMaxValue

Serializable getMaxValue(String ceilingEntity,
                         List<FilterMapping> filterMappings,
                         String maxField)

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

getStringValueFromGetter

String getStringValueFromGetter(Serializable instance,
                                String propertyName)
                                throws IllegalAccessException,
                                       InvocationTargetException,
                                       NoSuchMethodException
Returns a string representation of the field on the given instance specified by the property name. The propertyName should start from the root of the given instance

Parameters:
instance -
propertyName -
Returns:
Throws:
IllegalAccessException
InvocationTargetException
NoSuchMethodException


Copyright © 2013. All Rights Reserved.