|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.groovy.grails.commons.AbstractGrailsClass
org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateDomainClass
public class GrailsHibernateDomainClass
An implementation of the GrailsDomainClass interface that allows Classes mapped in Hibernate to integrate with Grails' validation, dynamic methods etc. seamlessly
| Field Summary |
|---|
| Fields inherited from interface org.codehaus.groovy.grails.commons.GrailsDomainClass |
|---|
GORM, ORM_MAPPING |
| Constructor Summary | |
|---|---|
GrailsHibernateDomainClass(Class clazz,
org.hibernate.SessionFactory sessionFactory,
org.hibernate.metadata.ClassMetadata metaData,
Map<String,Object> defaultContraints)
Contructor to be used by all child classes to create a new instance and get the name right. |
|
| Method Summary | |
|---|---|
Map |
getAssociationMap()
Returns this classes association map |
Map |
getConstrainedProperties()
Returns a map of constraints applied to this domain class with the keys being the property name and the values being ConstrainedProperty instances |
String |
getFieldName(String propertyName)
Returns the field name for the given property name |
GrailsDomainClassProperty |
getIdentifier()
Returns the identifier property |
Map |
getMappedBy()
|
String |
getMappingStrategy()
|
GrailsDomainClassProperty[] |
getPersistantProperties()
Deprecated. |
GrailsDomainClassProperty[] |
getPersistentProperties()
Returns all of the persistant properties of the domain class |
GrailsDomainClassProperty[] |
getProperties()
Returns all of the properties of the domain class |
GrailsDomainClassProperty |
getPropertyByName(String name)
Returns the property for the given name |
Class |
getRelatedClassType(String propertyName)
Returns the type of the related class of the given property |
Set |
getSubClasses()
Returns the sub-classes for this class if any |
Validator |
getValidator()
Retreives the validator for this domain class |
GrailsDomainClassProperty |
getVersion()
Returns the version property |
boolean |
hasPersistentProperty(String propertyName)
Returns true if this domain class has a persistent property for the given name |
boolean |
hasSubClasses()
Returns true if the domain classes has sub classes |
boolean |
isBidirectional(String propertyName)
Returns true if the given property is a bi-directional relationship |
boolean |
isManyToOne(String propertyName)
Returns true if the given property is a many to one relationship |
boolean |
isOneToMany(String propertyName)
Returns true if the given property is a one to many relationship |
boolean |
isOwningClass(Class domainClass)
|
boolean |
isRoot()
Whether the class is the root of a heirarchy |
void |
refreshConstraints()
Refreshes the constraint defined on a domain class |
void |
setMappingStrategy(String strategy)
Sets the strategy to use for ORM mapping. |
void |
setValidator(Validator validator)
Sets the validator for this domain class |
| Methods inherited from class org.codehaus.groovy.grails.commons.AbstractGrailsClass |
|---|
getClazz, getFullName, getLogicalPropertyName, getMetaClass, getName, getNaturalName, getPackageName, getPropertyDescriptors, getPropertyName, getPropertyOrStaticPropertyOrFieldValue, getPropertyType, getPropertyValue, getPropertyValue, getPropertyValueObject, getReference, getReferenceInstance, getShortName, hasMetaMethod, hasMetaMethod, hasMetaProperty, hasProperty, isReadableProperty, newInstance, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.codehaus.groovy.grails.commons.GrailsDomainClass |
|---|
getPropertyName |
| Methods inherited from interface org.codehaus.groovy.grails.commons.GrailsClass |
|---|
getClazz, getFullName, getLogicalPropertyName, getMetaClass, getName, getNaturalName, getPackageName, getPropertyValue, getPropertyValue, getReference, getReferenceInstance, getShortName, hasProperty, newInstance |
| Constructor Detail |
|---|
public GrailsHibernateDomainClass(Class clazz,
org.hibernate.SessionFactory sessionFactory,
org.hibernate.metadata.ClassMetadata metaData,
Map<String,Object> defaultContraints)
clazz - the Grails classsessionFactory - The Hibernate SessionFactory instancemetaData - The ClassMetaData for this class retrieved from the SFdefaultContraints - The default global constraints definition| Method Detail |
|---|
public boolean isOwningClass(Class domainClass)
isOwningClass in interface GrailsDomainClasspublic GrailsDomainClassProperty[] getProperties()
GrailsDomainClass
getProperties in interface GrailsDomainClasspublic GrailsDomainClassProperty[] getPersistantProperties()
GrailsDomainClass
getPersistantProperties in interface GrailsDomainClasspublic GrailsDomainClassProperty[] getPersistentProperties()
GrailsDomainClass
getPersistentProperties in interface GrailsDomainClasspublic GrailsDomainClassProperty getIdentifier()
GrailsDomainClass
getIdentifier in interface GrailsDomainClasspublic GrailsDomainClassProperty getVersion()
GrailsDomainClass
getVersion in interface GrailsDomainClasspublic GrailsDomainClassProperty getPropertyByName(String name)
GrailsDomainClass
getPropertyByName in interface GrailsDomainClassname - The property for the name
public String getFieldName(String propertyName)
GrailsDomainClass
getFieldName in interface GrailsDomainClasspublic boolean hasSubClasses()
GrailsDomainClass
hasSubClasses in interface GrailsDomainClasspublic Map getMappedBy()
getMappedBy in interface GrailsDomainClasspublic boolean hasPersistentProperty(String propertyName)
GrailsDomainClass
hasPersistentProperty in interface GrailsDomainClasspropertyName - The property name
public void setMappingStrategy(String strategy)
GrailsDomainClass
setMappingStrategy in interface GrailsDomainClassstrategy - The mapping strategypublic boolean isOneToMany(String propertyName)
GrailsDomainClass
isOneToMany in interface GrailsDomainClasspropertyName - The name of the property
public boolean isManyToOne(String propertyName)
GrailsDomainClass
isManyToOne in interface GrailsDomainClasspropertyName - The name of the property
public boolean isBidirectional(String propertyName)
GrailsDomainClass
isBidirectional in interface GrailsDomainClasspropertyName - The name of the property
public Class getRelatedClassType(String propertyName)
GrailsDomainClass
getRelatedClassType in interface GrailsDomainClasspropertyName - The name of the property
public Map getConstrainedProperties()
GrailsDomainClass
getConstrainedProperties in interface GrailsDomainClasspublic Validator getValidator()
GrailsDomainClass
getValidator in interface GrailsDomainClasspublic void setValidator(Validator validator)
GrailsDomainClass
setValidator in interface GrailsDomainClassvalidator - The domain class validator to setpublic String getMappingStrategy()
getMappingStrategy in interface GrailsDomainClasspublic Set getSubClasses()
GrailsDomainClass
getSubClasses in interface GrailsDomainClasspublic void refreshConstraints()
GrailsDomainClass
refreshConstraints in interface GrailsDomainClasspublic boolean isRoot()
GrailsDomainClass
isRoot in interface GrailsDomainClasspublic Map getAssociationMap()
GrailsDomainClass
getAssociationMap in interface GrailsDomainClass
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||