eu.etaxonomy.cdm.persistence.dao
Class AbstractBeanInitializer

java.lang.Object
  extended by eu.etaxonomy.cdm.persistence.dao.AbstractBeanInitializer
All Implemented Interfaces:
IBeanInitializer
Direct Known Subclasses:
HibernateBeanInitializer

public abstract class AbstractBeanInitializer
extends Object
implements IBeanInitializer

Author:
a.kohlbecker

Field Summary
static Logger logger
           
 
Fields inherited from interface eu.etaxonomy.cdm.persistence.dao.IBeanInitializer
LOAD_2ONE_2MANY_WILDCARD, LOAD_2ONE_WILDCARD
 
Constructor Summary
AbstractBeanInitializer()
           
 
Method Summary
 Map<Class<? extends CdmBase>,AutoPropertyInitializer<CdmBase>> getBeanAutoInitializers()
           
static Set<PropertyDescriptor> getProperties(Object bean, Set<Class> typeRestrictions)
          Return all public bean properties which, exclusive those whose return type match any class defined in the parameter typeRestrictions or which are transient properties.
 void initialize(Object bean, List<String> propertyPaths)
          Allows more fine grained initialization not only of the root bean identified by its uuid but also of specific paths of the object graph.
<C extends Collection<?>>
C
initializeAll(C beanList, List<String> propertyPaths)
          Initializes the entities given in the bean list according to the given propertyPaths.
 void initializeBean(Object bean, boolean cdmEntities, boolean collections)
          Initializes all *toOne relations of the given bean and all *toMany relations, depending on the state of the boolean parameters cdmEntities and collections
abstract  Object initializeInstance(Object proxy)
          Initialize the the proxy, unwrap the target object and return it.
 void load(Object bean)
          Initializes all *ToOne relations of the bean.
 void loadFully(Object bean)
          Initializes all *ToOne and all *ToMany relations of the bean.
 void setBeanAutoInitializers(Map<Class<? extends CdmBase>,AutoPropertyInitializer<CdmBase>> beanAutoInitializers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final Logger logger
Constructor Detail

AbstractBeanInitializer

public AbstractBeanInitializer()
Method Detail

setBeanAutoInitializers

public void setBeanAutoInitializers(Map<Class<? extends CdmBase>,AutoPropertyInitializer<CdmBase>> beanAutoInitializers)
Parameters:
beanAutoInitializers - the beanAutoInitializers to set

getBeanAutoInitializers

public Map<Class<? extends CdmBase>,AutoPropertyInitializer<CdmBase>> getBeanAutoInitializers()
Returns:
the beanAutoInitializers

initializeInstance

public abstract Object initializeInstance(Object proxy)
Description copied from interface: IBeanInitializer
Initialize the the proxy, unwrap the target object and return it.

Specified by:
initializeInstance in interface IBeanInitializer
Parameters:
proxy - the proxy to initialize may wrap a single bean or a collection
Returns:
the unwrapped target object

load

public void load(Object bean)
Description copied from interface: IBeanInitializer
Initializes all *ToOne relations of the bean.

Specified by:
load in interface IBeanInitializer

loadFully

public void loadFully(Object bean)
Description copied from interface: IBeanInitializer
Initializes all *ToOne and all *ToMany relations of the bean.

Specified by:
loadFully in interface IBeanInitializer

initializeBean

public void initializeBean(Object bean,
                           boolean cdmEntities,
                           boolean collections)
Initializes all *toOne relations of the given bean and all *toMany relations, depending on the state of the boolean parameters cdmEntities and collections

Parameters:
bean - the bean to initialize
cdmEntities - initialize all *toOne relations to cdm entities
collections - initialize all *toMany relations

initialize

public void initialize(Object bean,
                       List<String> propertyPaths)
Description copied from interface: IBeanInitializer
Allows more fine grained initialization not only of the root bean identified by its uuid but also of specific paths of the object graph. The sub graph to initialize may be defined in the propertyPaths parameter as list of paths all starting at the root bean.

You can use wildcards * LOAD_2ONE_2MANY_WILDCARD and $ LOAD_2ONE_WILDCARD for initializing all *ToOne and all *ToMany relations of a bean. NOTE: A wildcard subsequently terminates its property path.

Example: Assuming cdmEntity is a Taxon instance the following propertyPaths can be used for initializing bean properties of this instance. It is possible to initialized nested properties of properties with unlimited depth.

Specified by:
initialize in interface IBeanInitializer
propertyPaths - a List of property names

initializeAll

public <C extends Collection<?>> C initializeAll(C beanList,
                                                 List<String> propertyPaths)
Description copied from interface: IBeanInitializer
Initializes the entities given in the bean list according to the given propertyPaths.

Specified by:
initializeAll in interface IBeanInitializer
Returns:

getProperties

public static Set<PropertyDescriptor> getProperties(Object bean,
                                                    Set<Class> typeRestrictions)
Return all public bean properties which, exclusive those whose return type match any class defined in the parameter typeRestrictions or which are transient properties.

Parameters:
bean -
typeRestrictions -
Returns:


Copyright © 2007-2013 EDIT. All Rights Reserved.