|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule
@Component(value="blBasicPersistenceModule") @Scope(value="prototype") public class BasicPersistenceModule
| Field Summary | |
|---|---|
static String |
ALTERNATE_ID_PROPERTY
|
protected org.springframework.context.ApplicationContext |
applicationContext
|
protected CriteriaTranslator |
criteriaTranslator
|
protected FieldPersistenceProvider |
defaultFieldPersistenceProvider
|
protected EntityValidatorService |
entityValidatorService
|
protected List<FieldPersistenceProvider> |
fieldPersistenceProviders
|
static String |
MAIN_ENTITY_NAME_PROPERTY
|
protected PersistenceManager |
persistenceManager
|
protected List<PopulateValueRequestValidator> |
populateValidators
|
protected RestrictionFactory |
restrictionFactory
|
| Constructor Summary | |
|---|---|
BasicPersistenceModule()
|
|
| Method Summary | |
|---|---|
Entity |
add(PersistencePackage persistencePackage)
|
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> unfilteredProperties,
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. |
void |
extractProperties(Class<?>[] inheritanceLine,
Map<MergedPropertyType,Map<String,FieldMetadata>> mergedProperties,
List<Property> properties)
|
protected void |
extractPropertiesFromMetadata(Class<?>[] inheritanceLine,
Map<String,FieldMetadata> mergedProperties,
List<Property> properties,
Boolean isHiddenOverride,
MergedPropertyType type)
|
protected void |
extractPropertiesFromPersistentEntity(Map<String,FieldMetadata> mergedProperties,
Serializable entity,
List<Property> props)
|
DynamicResultSet |
fetch(PersistencePackage persistencePackage,
CriteriaTransferObject cto)
|
protected Map<String,FieldMetadata> |
filterOutCollectionMetadata(Map<String,FieldMetadata> metadata)
|
String |
formatValue(Object value)
Formats a aw value from an entity into its string representation used by the system. |
protected Class<?> |
getBasicBroadleafType(SupportedFieldType fieldType)
|
PersistenceModule |
getCompatibleModule(OperationType operationType)
|
CriteriaTranslator |
getCriteriaTranslator()
|
DecimalFormat |
getDecimalFormatter()
|
FieldPersistenceProvider |
getDefaultFieldPersistenceProvider()
|
EntityValidatorService |
getEntityValidatorService()
|
FieldManager |
getFieldManager()
|
List<FieldPersistenceProvider> |
getFieldPersistenceProviders()
|
List<FilterMapping> |
getFilterMappings(PersistencePerspective persistencePerspective,
CriteriaTransferObject cto,
String ceilingEntityFullyQualifiedClassname,
Map<String,FieldMetadata> mergedUnfilteredProperties)
|
List<FilterMapping> |
getFilterMappings(PersistencePerspective persistencePerspective,
CriteriaTransferObject cto,
String ceilingEntityFullyQualifiedClassname,
Map<String,FieldMetadata> mergedUnfilteredProperties,
RestrictionFactory customRestrictionFactory)
|
protected Class<?> |
getMapFieldType(Serializable instance,
FieldManager fieldManager,
Property property)
|
Serializable |
getMaxValue(String ceilingEntity,
List<FilterMapping> filterMappings,
String maxField)
|
Map<String,FieldMetadata> |
getMergedProperties(PersistencePackage persistencePackage,
CriteriaTransferObject cto)
|
PersistenceManager |
getPersistenceManager()
|
List<Serializable> |
getPersistentRecords(String ceilingEntity,
List<FilterMapping> filterMappings,
Integer firstResult,
Integer maxResults)
|
Object |
getPrimaryKey(Entity entity,
Map<String,FieldMetadata> mergedUnfilteredProperties)
|
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> primaryUnfilteredMergedProperties,
List<? extends Serializable> records,
Map<String,FieldMetadata> alternateUnfilteredMergedProperties,
String pathToTargetObject)
|
RestrictionFactory |
getRestrictionFactory()
|
SimpleDateFormat |
getSimpleDateFormatter()
|
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)
|
boolean |
isCompatible(OperationType operationType)
|
void |
remove(PersistencePackage persistencePackage)
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
|
void |
setCriteriaTranslator(CriteriaTranslator criteriaTranslator)
|
void |
setDefaultFieldPersistenceProvider(FieldPersistenceProvider defaultFieldPersistenceProvider)
|
void |
setEntityValidatorService(EntityValidatorService entityValidatorService)
|
void |
setFieldPersistenceProviders(List<FieldPersistenceProvider> fieldPersistenceProviders)
|
void |
setPersistenceManager(PersistenceManager persistenceManager)
|
void |
setRestrictionFactory(RestrictionFactory restrictionFactory)
|
Entity |
update(PersistencePackage persistencePackage)
|
EntityResult |
update(PersistencePackage persistencePackage,
boolean includeRealEntityObject)
|
protected EntityResult |
update(PersistencePackage persistencePackage,
Object primaryKey,
boolean includeRealEntity)
|
void |
updateMergedProperties(PersistencePackage persistencePackage,
Map<MergedPropertyType,Map<String,FieldMetadata>> allMergedProperties)
|
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 class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String MAIN_ENTITY_NAME_PROPERTY
public static final String ALTERNATE_ID_PROPERTY
protected org.springframework.context.ApplicationContext applicationContext
protected PersistenceManager persistenceManager
protected EntityValidatorService entityValidatorService
protected List<FieldPersistenceProvider> fieldPersistenceProviders
protected List<PopulateValueRequestValidator> populateValidators
protected FieldPersistenceProvider defaultFieldPersistenceProvider
protected CriteriaTranslator criteriaTranslator
protected RestrictionFactory restrictionFactory
| Constructor Detail |
|---|
public BasicPersistenceModule()
| Method Detail |
|---|
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic boolean isCompatible(OperationType operationType)
isCompatible in interface PersistenceModulepublic FieldManager getFieldManager()
getFieldManager in interface RecordHelperpublic DecimalFormat getDecimalFormatter()
getDecimalFormatter in interface DataFormatProviderpublic SimpleDateFormat getSimpleDateFormatter()
getSimpleDateFormatter in interface DataFormatProviderprotected Map<String,FieldMetadata> filterOutCollectionMetadata(Map<String,FieldMetadata> metadata)
protected Class<?> getBasicBroadleafType(SupportedFieldType fieldType)
public Serializable createPopulatedInstance(Serializable instance,
Entity entity,
Map<String,FieldMetadata> unfilteredProperties,
Boolean setId)
throws ValidationException
RecordHelper
createPopulatedInstance in interface RecordHelperValidationExceptionRecordHelper.createPopulatedInstance(Serializable, Entity, Map, Boolean, Boolean)
public Serializable createPopulatedInstance(Serializable instance,
Entity entity,
Map<String,FieldMetadata> unfilteredProperties,
Boolean setId,
Boolean validateUnsubmittedProperties)
throws ValidationException
RecordHelperPopulates 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
createPopulatedInstance in interface RecordHelpervalidateUnsubmittedProperties - if set to true, will ignore validation for properties that weren't submitted
along with the entity
ValidationException - if after populating instance via the values in entity then
EntityValidatorService#validate(Entity, Serializable, Map) returns falseEntityValidatorService}
protected Class<?> getMapFieldType(Serializable instance,
FieldManager fieldManager,
Property property)
public Entity getRecord(Map<String,FieldMetadata> primaryMergedProperties,
Serializable record,
Map<String,FieldMetadata> alternateMergedProperties,
String pathToTargetObject)
getRecord in interface RecordHelper
public Entity getRecord(Class<?> ceilingEntityClass,
PersistencePerspective persistencePerspective,
Serializable record)
getRecord in interface RecordHelper
public Entity[] getRecords(Class<?> ceilingEntityClass,
PersistencePerspective persistencePerspective,
List<? extends Serializable> records)
getRecords in interface RecordHelper
public Map<String,FieldMetadata> getSimpleMergedProperties(String entityName,
PersistencePerspective persistencePerspective)
getSimpleMergedProperties in interface RecordHelper
public Entity[] getRecords(Map<String,FieldMetadata> primaryMergedProperties,
List<? extends Serializable> records)
getRecords in interface RecordHelper
public Entity[] getRecords(Map<String,FieldMetadata> primaryUnfilteredMergedProperties,
List<? extends Serializable> records,
Map<String,FieldMetadata> alternateUnfilteredMergedProperties,
String pathToTargetObject)
getRecords in interface RecordHelper
protected void extractPropertiesFromPersistentEntity(Map<String,FieldMetadata> mergedProperties,
Serializable entity,
List<Property> props)
public String getStringValueFromGetter(Serializable instance,
String propertyName)
throws IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
RecordHelper
getStringValueFromGetter in interface RecordHelperIllegalAccessException
InvocationTargetException
NoSuchMethodExceptionpublic String formatValue(Object value)
DataFormatProviderDataFormatProvider.getDecimalFormatter() to ensure that BigDecimals only show 2 decimal places or dates are formatted
a certain way.
formatValue in interface DataFormatProvider
protected EntityResult update(PersistencePackage persistencePackage,
Object primaryKey,
boolean includeRealEntity)
throws ServiceException
ServiceException
public Object getPrimaryKey(Entity entity,
Map<String,FieldMetadata> mergedUnfilteredProperties)
getPrimaryKey in interface RecordHelper
public List<FilterMapping> getFilterMappings(PersistencePerspective persistencePerspective,
CriteriaTransferObject cto,
String ceilingEntityFullyQualifiedClassname,
Map<String,FieldMetadata> mergedUnfilteredProperties,
RestrictionFactory customRestrictionFactory)
getFilterMappings in interface RecordHelper
public List<FilterMapping> getFilterMappings(PersistencePerspective persistencePerspective,
CriteriaTransferObject cto,
String ceilingEntityFullyQualifiedClassname,
Map<String,FieldMetadata> mergedUnfilteredProperties)
getFilterMappings in interface RecordHelper
public void extractProperties(Class<?>[] inheritanceLine,
Map<MergedPropertyType,Map<String,FieldMetadata>> mergedProperties,
List<Property> properties)
extractProperties in interface PersistenceModule
protected void extractPropertiesFromMetadata(Class<?>[] inheritanceLine,
Map<String,FieldMetadata> mergedProperties,
List<Property> properties,
Boolean isHiddenOverride,
MergedPropertyType type)
public void updateMergedProperties(PersistencePackage persistencePackage,
Map<MergedPropertyType,Map<String,FieldMetadata>> allMergedProperties)
throws ServiceException
updateMergedProperties in interface PersistenceModuleServiceException
public EntityResult update(PersistencePackage persistencePackage,
boolean includeRealEntityObject)
throws ServiceException
update in interface RecordHelperServiceException
public Entity update(PersistencePackage persistencePackage)
throws ServiceException
update in interface PersistenceModuleServiceException
public Entity add(PersistencePackage persistencePackage)
throws ServiceException
add in interface PersistenceModuleServiceException
public EntityResult add(PersistencePackage persistencePackage,
boolean includeRealEntityObject)
throws ServiceException
add in interface RecordHelperServiceException
public void remove(PersistencePackage persistencePackage)
throws ServiceException
remove in interface PersistenceModuleServiceException
public Map<String,FieldMetadata> getMergedProperties(PersistencePackage persistencePackage,
CriteriaTransferObject cto)
throws ServiceException
ServiceException
public DynamicResultSet fetch(PersistencePackage persistencePackage,
CriteriaTransferObject cto)
throws ServiceException
fetch in interface PersistenceModuleServiceException
public Integer getTotalRecords(String ceilingEntity,
List<FilterMapping> filterMappings)
getTotalRecords in interface RecordHelper
public Serializable getMaxValue(String ceilingEntity,
List<FilterMapping> filterMappings,
String maxField)
getMaxValue in interface RecordHelper
public List<Serializable> getPersistentRecords(String ceilingEntity,
List<FilterMapping> filterMappings,
Integer firstResult,
Integer maxResults)
getPersistentRecords in interface RecordHelper
public boolean validate(Entity entity,
Serializable populatedInstance,
Map<String,FieldMetadata> mergedProperties)
RecordHelper
validate in interface RecordHelperRecordHelper.validate(Entity, Serializable, Map, boolean)
public boolean validate(Entity entity,
Serializable populatedInstance,
Map<String,FieldMetadata> mergedProperties,
boolean validateUnsubmittedProperties)
RecordHelperEntity based on the validators associated with each property
validate in interface RecordHelperentity - the instance that is attempted to be saved from. Implementers should set Entity.isValidationFailure()
accordingly as a result of the validationmergedProperties - TODOvalidateUnsubmittedProperties - if set to true, will ignore validation for properties that weren't submitted
along with the entity
Entity.isValidationFailure()
after invoking this methodpublic void setPersistenceManager(PersistenceManager persistenceManager)
setPersistenceManager in interface PersistenceModulepublic PersistenceModule getCompatibleModule(OperationType operationType)
getCompatibleModule in interface RecordHelperpublic FieldPersistenceProvider getDefaultFieldPersistenceProvider()
public void setDefaultFieldPersistenceProvider(FieldPersistenceProvider defaultFieldPersistenceProvider)
public List<FieldPersistenceProvider> getFieldPersistenceProviders()
public void setFieldPersistenceProviders(List<FieldPersistenceProvider> fieldPersistenceProviders)
public CriteriaTranslator getCriteriaTranslator()
public void setCriteriaTranslator(CriteriaTranslator criteriaTranslator)
public EntityValidatorService getEntityValidatorService()
public void setEntityValidatorService(EntityValidatorService entityValidatorService)
public RestrictionFactory getRestrictionFactory()
public void setRestrictionFactory(RestrictionFactory restrictionFactory)
public PersistenceManager getPersistenceManager()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||