org.broadleafcommerce.openadmin.server.service.persistence.module
Class BasicPersistenceModule

java.lang.Object
  extended by org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule
All Implemented Interfaces:
PersistenceModule, RecordHelper, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
AdornedTargetListPersistenceModule, MapStructurePersistenceModule

@Component(value="blBasicPersistenceModule")
@Scope(value="prototype")
public class BasicPersistenceModule
extends Object
implements PersistenceModule, RecordHelper, org.springframework.context.ApplicationContextAware

Author:
jfischer

Field Summary
protected  org.springframework.context.ApplicationContext applicationContext
           
protected  SimpleDateFormat dateFormat
           
protected  DecimalFormat decimalFormat
           
protected  PersistenceManager persistenceManager
           
 
Constructor Summary
BasicPersistenceModule()
           
 
Method Summary
 Entity add(PersistencePackage persistencePackage)
           
protected  void buildProperty(PersistencePerspective persistencePerspective, com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto, String ceilingEntityFullyQualifiedClassname, Map<String,FieldMetadata> mergedProperties, BaseCtoConverter ctoConverter, String propertyName)
           
 Serializable createPopulatedInstance(Serializable instance, Entity entity, Map<String,FieldMetadata> unfilteredProperties, Boolean setId)
           
 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, com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto)
           
protected  Map<String,FieldMetadata> filterOutCollectionMetadata(Map<String,FieldMetadata> metadata)
           
 PersistenceModule getCompatibleModule(OperationType operationType)
           
 BaseCtoConverter getCtoConverter(PersistencePerspective persistencePerspective, com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto, String ceilingEntityFullyQualifiedClassname, Map<String,FieldMetadata> mergedUnfilteredProperties)
           
 FieldManager getFieldManager()
           
 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)
           
 Map<String,FieldMetadata> getSimpleMergedProperties(String entityName, PersistencePerspective persistencePerspective)
           
 int getTotalRecords(PersistencePackage persistencePackage, com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto, BaseCtoConverter ctoConverter)
           
 boolean isCompatible(OperationType operationType)
           
protected  Date parseDate(String value)
           
 void remove(PersistencePackage persistencePackage)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setPersistenceManager(PersistenceManager persistenceManager)
           
 Entity update(PersistencePackage persistencePackage)
           
protected  Entity update(PersistencePackage persistencePackage, Object primaryKey)
           
 void updateMergedProperties(PersistencePackage persistencePackage, Map<MergedPropertyType,Map<String,FieldMetadata>> allMergedProperties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateFormat

protected SimpleDateFormat dateFormat

decimalFormat

protected DecimalFormat decimalFormat

applicationContext

protected org.springframework.context.ApplicationContext applicationContext

persistenceManager

protected PersistenceManager persistenceManager
Constructor Detail

BasicPersistenceModule

public BasicPersistenceModule()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

isCompatible

public boolean isCompatible(OperationType operationType)
Specified by:
isCompatible in interface PersistenceModule

getFieldManager

public FieldManager getFieldManager()
Specified by:
getFieldManager in interface RecordHelper

parseDate

protected Date parseDate(String value)
                  throws ParseException
Throws:
ParseException

filterOutCollectionMetadata

protected Map<String,FieldMetadata> filterOutCollectionMetadata(Map<String,FieldMetadata> metadata)

createPopulatedInstance

public Serializable createPopulatedInstance(Serializable instance,
                                            Entity entity,
                                            Map<String,FieldMetadata> unfilteredProperties,
                                            Boolean setId)
                                     throws IllegalAccessException,
                                            InvocationTargetException,
                                            NoSuchMethodException,
                                            ParseException,
                                            NumberFormatException,
                                            InstantiationException,
                                            ClassNotFoundException
Specified by:
createPopulatedInstance in interface RecordHelper
Throws:
IllegalAccessException
InvocationTargetException
NoSuchMethodException
ParseException
NumberFormatException
InstantiationException
ClassNotFoundException

getRecord

public Entity getRecord(Map<String,FieldMetadata> primaryMergedProperties,
                        Serializable record,
                        Map<String,FieldMetadata> alternateMergedProperties,
                        String pathToTargetObject)
                 throws ParserConfigurationException,
                        DOMException,
                        IllegalAccessException,
                        InvocationTargetException,
                        NoSuchMethodException,
                        TransformerFactoryConfigurationError,
                        IllegalArgumentException,
                        TransformerException,
                        SecurityException,
                        ClassNotFoundException
Specified by:
getRecord in interface RecordHelper
Throws:
ParserConfigurationException
DOMException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
TransformerFactoryConfigurationError
IllegalArgumentException
TransformerException
SecurityException
ClassNotFoundException

getRecord

public Entity getRecord(Class<?> ceilingEntityClass,
                        PersistencePerspective persistencePerspective,
                        Serializable record)
                 throws SecurityException,
                        IllegalArgumentException,
                        ClassNotFoundException,
                        NoSuchMethodException,
                        IllegalAccessException,
                        InvocationTargetException,
                        DOMException,
                        ParserConfigurationException,
                        TransformerFactoryConfigurationError,
                        TransformerException,
                        NoSuchFieldException
Specified by:
getRecord in interface RecordHelper
Throws:
SecurityException
IllegalArgumentException
ClassNotFoundException
NoSuchMethodException
IllegalAccessException
InvocationTargetException
DOMException
ParserConfigurationException
TransformerFactoryConfigurationError
TransformerException
NoSuchFieldException

getRecords

public Entity[] getRecords(Class<?> ceilingEntityClass,
                           PersistencePerspective persistencePerspective,
                           List<? extends Serializable> records)
                    throws SecurityException,
                           IllegalArgumentException,
                           ClassNotFoundException,
                           NoSuchMethodException,
                           IllegalAccessException,
                           InvocationTargetException,
                           DOMException,
                           ParserConfigurationException,
                           TransformerFactoryConfigurationError,
                           TransformerException,
                           NoSuchFieldException
Specified by:
getRecords in interface RecordHelper
Throws:
SecurityException
IllegalArgumentException
ClassNotFoundException
NoSuchMethodException
IllegalAccessException
InvocationTargetException
DOMException
ParserConfigurationException
TransformerFactoryConfigurationError
TransformerException
NoSuchFieldException

getSimpleMergedProperties

public Map<String,FieldMetadata> getSimpleMergedProperties(String entityName,
                                                           PersistencePerspective persistencePerspective)
                                                    throws ClassNotFoundException,
                                                           SecurityException,
                                                           IllegalArgumentException,
                                                           NoSuchMethodException,
                                                           IllegalAccessException,
                                                           InvocationTargetException,
                                                           NoSuchFieldException
Specified by:
getSimpleMergedProperties in interface RecordHelper
Throws:
ClassNotFoundException
SecurityException
IllegalArgumentException
NoSuchMethodException
IllegalAccessException
InvocationTargetException
NoSuchFieldException

getRecords

public Entity[] getRecords(Map<String,FieldMetadata> primaryMergedProperties,
                           List<? extends Serializable> records)
                    throws ParserConfigurationException,
                           DOMException,
                           IllegalAccessException,
                           InvocationTargetException,
                           NoSuchMethodException,
                           TransformerFactoryConfigurationError,
                           IllegalArgumentException,
                           TransformerException,
                           SecurityException,
                           ClassNotFoundException
Specified by:
getRecords in interface RecordHelper
Throws:
ParserConfigurationException
DOMException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
TransformerFactoryConfigurationError
IllegalArgumentException
TransformerException
SecurityException
ClassNotFoundException

getRecords

public Entity[] getRecords(Map<String,FieldMetadata> primaryUnfilteredMergedProperties,
                           List<? extends Serializable> records,
                           Map<String,FieldMetadata> alternateUnfilteredMergedProperties,
                           String pathToTargetObject)
                    throws ParserConfigurationException,
                           DOMException,
                           IllegalAccessException,
                           InvocationTargetException,
                           NoSuchMethodException,
                           TransformerFactoryConfigurationError,
                           IllegalArgumentException,
                           TransformerException,
                           SecurityException,
                           ClassNotFoundException
Specified by:
getRecords in interface RecordHelper
Throws:
ParserConfigurationException
DOMException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
TransformerFactoryConfigurationError
IllegalArgumentException
TransformerException
SecurityException
ClassNotFoundException

extractPropertiesFromPersistentEntity

protected void extractPropertiesFromPersistentEntity(Map<String,FieldMetadata> mergedProperties,
                                                     Serializable entity,
                                                     List<Property> props)
                                              throws IllegalAccessException,
                                                     InvocationTargetException,
                                                     NoSuchMethodException,
                                                     SecurityException,
                                                     IllegalArgumentException,
                                                     ClassNotFoundException
Throws:
IllegalAccessException
InvocationTargetException
NoSuchMethodException
SecurityException
IllegalArgumentException
ClassNotFoundException

update

protected Entity update(PersistencePackage persistencePackage,
                        Object primaryKey)
                 throws ServiceException
Throws:
ServiceException

getPrimaryKey

public Object getPrimaryKey(Entity entity,
                            Map<String,FieldMetadata> mergedUnfilteredProperties)
                     throws RuntimeException
Specified by:
getPrimaryKey in interface RecordHelper
Throws:
RuntimeException

getCtoConverter

public BaseCtoConverter getCtoConverter(PersistencePerspective persistencePerspective,
                                        com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto,
                                        String ceilingEntityFullyQualifiedClassname,
                                        Map<String,FieldMetadata> mergedUnfilteredProperties)
                                 throws ClassNotFoundException
Specified by:
getCtoConverter in interface RecordHelper
Throws:
ClassNotFoundException

buildProperty

protected void buildProperty(PersistencePerspective persistencePerspective,
                             com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto,
                             String ceilingEntityFullyQualifiedClassname,
                             Map<String,FieldMetadata> mergedProperties,
                             BaseCtoConverter ctoConverter,
                             String propertyName)
                      throws ClassNotFoundException
Throws:
ClassNotFoundException

getTotalRecords

public int getTotalRecords(PersistencePackage persistencePackage,
                           com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto,
                           BaseCtoConverter ctoConverter)
                    throws ClassNotFoundException
Specified by:
getTotalRecords in interface RecordHelper
Throws:
ClassNotFoundException

extractProperties

public void extractProperties(Class<?>[] inheritanceLine,
                              Map<MergedPropertyType,Map<String,FieldMetadata>> mergedProperties,
                              List<Property> properties)
                       throws NumberFormatException
Specified by:
extractProperties in interface PersistenceModule
Throws:
NumberFormatException

extractPropertiesFromMetadata

protected void extractPropertiesFromMetadata(Class<?>[] inheritanceLine,
                                             Map<String,FieldMetadata> mergedProperties,
                                             List<Property> properties,
                                             Boolean isHiddenOverride,
                                             MergedPropertyType type)
                                      throws NumberFormatException
Throws:
NumberFormatException

updateMergedProperties

public void updateMergedProperties(PersistencePackage persistencePackage,
                                   Map<MergedPropertyType,Map<String,FieldMetadata>> allMergedProperties)
                            throws ServiceException
Specified by:
updateMergedProperties in interface PersistenceModule
Throws:
ServiceException

update

public Entity update(PersistencePackage persistencePackage)
              throws ServiceException
Specified by:
update in interface PersistenceModule
Throws:
ServiceException

add

public Entity add(PersistencePackage persistencePackage)
           throws ServiceException
Specified by:
add in interface PersistenceModule
Throws:
ServiceException

remove

public void remove(PersistencePackage persistencePackage)
            throws ServiceException
Specified by:
remove in interface PersistenceModule
Throws:
ServiceException

fetch

public DynamicResultSet fetch(PersistencePackage persistencePackage,
                              com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto)
                       throws ServiceException
Specified by:
fetch in interface PersistenceModule
Throws:
ServiceException

setPersistenceManager

public void setPersistenceManager(PersistenceManager persistenceManager)
Specified by:
setPersistenceManager in interface PersistenceModule

getCompatibleModule

public PersistenceModule getCompatibleModule(OperationType operationType)
Specified by:
getCompatibleModule in interface RecordHelper


Copyright © 2013. All Rights Reserved.