org.tynamo.hibernate.services
Class HibernateDescriptorDecorator

java.lang.Object
  extended by org.tynamo.hibernate.services.HibernateDescriptorDecorator
All Implemented Interfaces:
DescriptorDecorator

public class HibernateDescriptorDecorator
extends Object
implements DescriptorDecorator

This decorator will add metadata information. It will replace simple reflection based TynamoPropertyTynamoPropertyDescriptors with appropriate Hibernate descriptors

Background... TynamoDescriptorService operates one ReflectorDescriptorFactory - TynamoDescriptorService iterates/scans all class types encountered - ReflectorDescriptorFactory allocates property descriptor instance for the class type - TynamoDescriptorService decorates property descriptor by calling this module HibernateDescriptorDecorator - HibernateDescriptorDecorator caches the decorated property descriptor into a decorated descriptor list - decorated descriptor list gets populated into class descriptor for class type - TynamoDescriptorService finally populates decorated class descriptor and it's aggregated list of decorated property descriptors into it's own list/cache of referenced class descriptors

See Also:
TynamoPropertyDescriptor, ObjectReferenceDescriptor, CollectionDescriptor, EmbeddedDescriptor

Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
HibernateDescriptorDecorator(org.apache.tapestry5.hibernate.HibernateSessionSource hibernateSessionSource, DescriptorFactory descriptorFactory, int largeColumnLength, boolean ignoreNonHibernateTypes)
           
 
Method Summary
 TynamoClassDescriptor decorate(TynamoClassDescriptor descriptor)
           
 TynamoPropertyDescriptor decorateAssociationDescriptor(Class type, org.hibernate.mapping.Property mappingProperty, TynamoPropertyDescriptor descriptor, TynamoClassDescriptor parentClassDescriptor)
           
protected  TynamoPropertyDescriptor decoratePropertyDescriptor(Class type, org.hibernate.mapping.Property mappingProperty, TynamoPropertyDescriptor descriptor, TynamoClassDescriptor parentClassDescriptor)
           
protected  org.hibernate.mapping.Collection findCollectionMapping(Class type, String name)
           
protected  org.hibernate.metadata.ClassMetadata findMetadata(Class type)
          Find the Hibernate metadata for this type, traversing up the hierarchy to supertypes if necessary
 String getIdentifierProperty(Class type)
           
protected  org.hibernate.mapping.PersistentClass getMapping(Class type)
           
protected  boolean notAHibernateProperty(org.hibernate.metadata.ClassMetadata classMetaData, TynamoPropertyDescriptor descriptor)
           
protected  boolean notAHibernateProperty(org.hibernate.mapping.Component componentMapping, TynamoPropertyDescriptor propertyDescriptor)
          Checks to see if a property descriptor is in a component mapping
protected  List sortPropertyDescriptors(Class type, List propertyDescriptors)
          The default way to order our property descriptors is by the order they appear in the hibernate config, with id first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

HibernateDescriptorDecorator

public HibernateDescriptorDecorator(org.apache.tapestry5.hibernate.HibernateSessionSource hibernateSessionSource,
                                    DescriptorFactory descriptorFactory,
                                    int largeColumnLength,
                                    boolean ignoreNonHibernateTypes)
Method Detail

decorate

public TynamoClassDescriptor decorate(TynamoClassDescriptor descriptor)
Specified by:
decorate in interface DescriptorDecorator

decoratePropertyDescriptor

protected TynamoPropertyDescriptor decoratePropertyDescriptor(Class type,
                                                              org.hibernate.mapping.Property mappingProperty,
                                                              TynamoPropertyDescriptor descriptor,
                                                              TynamoClassDescriptor parentClassDescriptor)

sortPropertyDescriptors

protected List sortPropertyDescriptors(Class type,
                                       List propertyDescriptors)
The default way to order our property descriptors is by the order they appear in the hibernate config, with id first. Any non-mapped properties are tacked on at the end, til I think of a better way.

Parameters:
propertyDescriptors -
Returns:

findMetadata

protected org.hibernate.metadata.ClassMetadata findMetadata(Class type)
                                                     throws MetadataNotFoundException
Find the Hibernate metadata for this type, traversing up the hierarchy to supertypes if necessary

Parameters:
type -
Returns:
Throws:
MetadataNotFoundException

notAHibernateProperty

protected boolean notAHibernateProperty(org.hibernate.mapping.Component componentMapping,
                                        TynamoPropertyDescriptor propertyDescriptor)
Checks to see if a property descriptor is in a component mapping

Parameters:
componentMapping -
propertyDescriptor -
Returns:
true if the propertyDescriptor property is in componentMapping

notAHibernateProperty

protected boolean notAHibernateProperty(org.hibernate.metadata.ClassMetadata classMetaData,
                                        TynamoPropertyDescriptor descriptor)
Parameters:
classMetaData -
descriptor -
Returns:

getMapping

protected org.hibernate.mapping.PersistentClass getMapping(Class type)
Parameters:
type -
Returns:

decorateAssociationDescriptor

public TynamoPropertyDescriptor decorateAssociationDescriptor(Class type,
                                                              org.hibernate.mapping.Property mappingProperty,
                                                              TynamoPropertyDescriptor descriptor,
                                                              TynamoClassDescriptor parentClassDescriptor)

findCollectionMapping

protected org.hibernate.mapping.Collection findCollectionMapping(Class type,
                                                                 String name)

getIdentifierProperty

public String getIdentifierProperty(Class type)


Copyright © 2004-2009. All Rights Reserved.