to.etc.domui.component.meta.impl
Class DefaultClassMetaModel

java.lang.Object
  extended by to.etc.domui.component.meta.impl.DefaultClassMetaModel
All Implemented Interfaces:
ClassMetaModel

public class DefaultClassMetaModel
extends java.lang.Object
implements ClassMetaModel

This is a DomUI class metamodel info record that only contains data. It can be constructed by metamodel factories and filled in by calling the appropriate setters. When an instance of this class has been returned by a factory then it is NOT ALLOWED TO CHANGE IT ANYMORE(!) to maintain thread-safety.

Author:
Frits Jalvingh Created on Jun 2, 2010

Constructor Summary
DefaultClassMetaModel(java.lang.Class<?> metaClass)
           
 
Method Summary
 QCriteria<?> createCriteria()
          EXPERIMENTAL If this is a persistent class, this should create a base QCriteria instance to do queries on this class.
 PropertyMetaModel<?> findProperty(java.lang.String name)
          This resolves a property path, starting at this class.
 PropertyMetaModel<?> findSimpleProperty(java.lang.String name)
          Returns the named property on this class.
 java.lang.Class<?> getActualClass()
          FIXME Questionable nullity
 BundleRef getClassBundle()
          Return the class' resource bundle.
 java.lang.String getClassNameOnly()
           
 java.lang.Class<? extends IComboDataSet<?>> getComboDataSet()
          If this class is the UP in a relation this specifies that it must be shown as a COMBOBOX containing choices.
 java.util.List<DisplayPropertyMetaModel> getComboDisplayProperties()
          If this object is shown in a combobox it needs to show the following properties as the display value.
 java.lang.Class<? extends ILabelStringRenderer<?>> getComboLabelRenderer()
          When this relation-property is presented as a single field this can contain a class to render that field as a string.
 java.lang.Class<? extends INodeContentRenderer<?>> getComboNodeRenderer()
          When set, the entire content of a combobox's OPTION tag can be generated by this content renderer.
 java.lang.String getComponentTypeHint()
          When present this gives a hint to the component factories to help with choosing a proper component to select a single record of this type.
 SortableType getDefaultSortDirection()
          When a ClassMetaModel.getDefaultSortProperty() is defined, this defines the sort order to use initially.
 java.lang.String getDefaultSortProperty()
          Contains the name of the property to use for sorting initially.
 java.lang.String getDomainLabel(java.util.Locale loc, java.lang.Object value)
          Retrieves a label value for the specified domain value.
 java.lang.Object[] getDomainValues()
          If this class is an Enum or represents some enumerated value, this returns the possible value objects.
 java.util.List<SearchPropertyMetaModel> getKeyWordSearchProperties()
          Returns the sorted list of key word search properties defined on this class.
 java.util.List<DisplayPropertyMetaModel> getLookupSelectedProperties()
          When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the properties to use to display the currently selected record in the edit page.
 java.lang.Class<? extends INodeContentRenderer<?>> getLookupSelectedRenderer()
          When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the renderer to use to display the currently selected record in the edit page.
 ICriteriaTableDef<?> getMetaTableDef()
           
 PropertyMetaModel<?> getPrimaryKey()
          Returns the property containing the primary key for this object, if one can be found.
 java.util.List<PropertyMetaModel<?>> getProperties()
           
 java.util.List<SearchPropertyMetaModel> getSearchProperties()
          Returns the SORTED list of search properties defined on this class.
 java.util.List<DisplayPropertyMetaModel> getTableDisplayProperties()
          If this object is shown in a Table it needs to show the following properties there.
 java.lang.String getTableName()
          If this is a persistent class that is directly mapped onto some table, this might return the table name.
 java.lang.String getUserEntityName()
          Return a user-presentable entity name for this class.
 java.lang.String getUserEntityNamePlural()
          Returns a user-presentable entity name as a plural name.
 boolean isPersistentClass()
           
 void setComboDataSet(java.lang.Class<? extends IComboDataSet<?>> comboDataSet)
           
 void setComboDisplayProperties(java.util.List<DisplayPropertyMetaModel> displayProperties)
           
 void setComboLabelRenderer(java.lang.Class<? extends ILabelStringRenderer<?>> comboLabelRenderer)
           
 void setComboNodeRenderer(java.lang.Class<? extends INodeContentRenderer<?>> comboNodeRenderer)
           
 void setComponentTypeHint(java.lang.String componentTypeHint)
           
 void setDefaultSortDirection(SortableType defaultSortDirection)
           
 void setDefaultSortProperty(java.lang.String defaultSortProperty)
           
 void setDomainValues(java.lang.Object[] domainValues)
           
 void setKeyWordSearchProperties(java.util.List<SearchPropertyMetaModel> keyWordSearchProperties)
           
 void setLookupSelectedProperties(java.util.List<DisplayPropertyMetaModel> lookupFieldDisplayProperties)
           
 void setLookupSelectedRenderer(java.lang.Class<? extends INodeContentRenderer<?>> lookupFieldRenderer)
           
 void setMetaTableDef(ICriteriaTableDef<?> metaTableDef)
           
 void setPersistentClass(boolean persistentClass)
           
 void setPrimaryKey(PropertyMetaModel<?> primaryKey)
           
 void setSearchProperties(java.util.List<SearchPropertyMetaModel> searchProperties)
           
 void setTableDisplayProperties(java.util.List<DisplayPropertyMetaModel> tableDisplayProperties)
           
 void setTableName(java.lang.String tableName)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultClassMetaModel

public DefaultClassMetaModel(java.lang.Class<?> metaClass)
Method Detail

getClassBundle

@Nonnull
public BundleRef getClassBundle()
Return the class' resource bundle.

Specified by:
getClassBundle in interface ClassMetaModel
Returns:

getUserEntityName

@Nonnull
public java.lang.String getUserEntityName()
Return a user-presentable entity name for this class. This defaults to the classname itself if unset.

Specified by:
getUserEntityName in interface ClassMetaModel
See Also:
ClassMetaModel.getUserEntityName()

getUserEntityNamePlural

@Nonnull
public java.lang.String getUserEntityNamePlural()
Returns a user-presentable entity name as a plural name.

Specified by:
getUserEntityNamePlural in interface ClassMetaModel
Returns:
See Also:
ClassMetaModel.getUserEntityNamePlural()

findProperty

@Nullable
public PropertyMetaModel<?> findProperty(java.lang.String name)
This resolves a property path, starting at this class. If any part of the path does not exist this returns null.

Specified by:
findProperty in interface ClassMetaModel
Returns:
See Also:
ClassMetaModel.findProperty(java.lang.String)

findSimpleProperty

@Nullable
public PropertyMetaModel<?> findSimpleProperty(java.lang.String name)
Description copied from interface: ClassMetaModel
Returns the named property on this class. This does not allow a property path (dotted names).

Specified by:
findSimpleProperty in interface ClassMetaModel
Returns:

getProperties

@Nonnull
public java.util.List<PropertyMetaModel<?>> getProperties()
Specified by:
getProperties in interface ClassMetaModel

getComboDataSet

@Nullable
public java.lang.Class<? extends IComboDataSet<?>> getComboDataSet()
Description copied from interface: ClassMetaModel
If this class is the UP in a relation this specifies that it must be shown as a COMBOBOX containing choices. It contains a generator for the values to show. This is a default for all relations in which this class is the parent; it can be overridden in individual relations.

Specified by:
getComboDataSet in interface ClassMetaModel
Returns:

setComboDataSet

public void setComboDataSet(@Nullable
                            java.lang.Class<? extends IComboDataSet<?>> comboDataSet)

getComboLabelRenderer

public java.lang.Class<? extends ILabelStringRenderer<?>> getComboLabelRenderer()
Description copied from interface: ClassMetaModel
When this relation-property is presented as a single field this can contain a class to render that field as a string.

Specified by:
getComboLabelRenderer in interface ClassMetaModel
Returns:

setComboLabelRenderer

public void setComboLabelRenderer(java.lang.Class<? extends ILabelStringRenderer<?>> comboLabelRenderer)

getComboDisplayProperties

public java.util.List<DisplayPropertyMetaModel> getComboDisplayProperties()
Description copied from interface: ClassMetaModel
If this object is shown in a combobox it needs to show the following properties as the display value.

Specified by:
getComboDisplayProperties in interface ClassMetaModel
Returns:

setComboDisplayProperties

public void setComboDisplayProperties(java.util.List<DisplayPropertyMetaModel> displayProperties)

getComboNodeRenderer

public java.lang.Class<? extends INodeContentRenderer<?>> getComboNodeRenderer()
Description copied from interface: ClassMetaModel
When set, the entire content of a combobox's OPTION tag can be generated by this content renderer. When set, the ClassMetaModel.getComboDisplayProperties(), ClassMetaModel.getComboLabelRenderer() properties are ignored.

Specified by:
getComboNodeRenderer in interface ClassMetaModel
Returns:

setComboNodeRenderer

public void setComboNodeRenderer(java.lang.Class<? extends INodeContentRenderer<?>> comboNodeRenderer)

getSearchProperties

@Nonnull
public java.util.List<SearchPropertyMetaModel> getSearchProperties()
Returns the SORTED list of search properties defined on this class.

Specified by:
getSearchProperties in interface ClassMetaModel
Returns:
See Also:
ClassMetaModel.getSearchProperties()

setSearchProperties

public void setSearchProperties(@Nonnull
                                java.util.List<SearchPropertyMetaModel> searchProperties)

getKeyWordSearchProperties

@Nonnull
public java.util.List<SearchPropertyMetaModel> getKeyWordSearchProperties()
Returns the sorted list of key word search properties defined on this class.

Specified by:
getKeyWordSearchProperties in interface ClassMetaModel
Returns:
See Also:
ClassMetaModel.getKeyWordSearchProperties()

setKeyWordSearchProperties

public void setKeyWordSearchProperties(@Nonnull
                                       java.util.List<SearchPropertyMetaModel> keyWordSearchProperties)

getActualClass

public java.lang.Class<?> getActualClass()
Description copied from interface: ClassMetaModel
FIXME Questionable nullity

Specified by:
getActualClass in interface ClassMetaModel
Returns:

getTableDisplayProperties

public java.util.List<DisplayPropertyMetaModel> getTableDisplayProperties()
Description copied from interface: ClassMetaModel
If this object is shown in a Table it needs to show the following properties there. This value gets set from @MetaObject. These columns are also used when the table is shown as the result of a LookupInput search.

Specified by:
getTableDisplayProperties in interface ClassMetaModel
Returns:

setTableDisplayProperties

public void setTableDisplayProperties(java.util.List<DisplayPropertyMetaModel> tableDisplayProperties)

isPersistentClass

public boolean isPersistentClass()
Specified by:
isPersistentClass in interface ClassMetaModel

setPersistentClass

public void setPersistentClass(boolean persistentClass)

getDefaultSortProperty

public java.lang.String getDefaultSortProperty()
Description copied from interface: ClassMetaModel
Contains the name of the property to use for sorting initially. It is used to define the initial sort order when a table is shown for the 1st time. It can be null in which case the table query defines the sort order.

Specified by:
getDefaultSortProperty in interface ClassMetaModel
Returns:

setDefaultSortProperty

public void setDefaultSortProperty(java.lang.String defaultSortProperty)

getDefaultSortDirection

public SortableType getDefaultSortDirection()
Description copied from interface: ClassMetaModel
When a ClassMetaModel.getDefaultSortProperty() is defined, this defines the sort order to use initially.

Specified by:
getDefaultSortDirection in interface ClassMetaModel
Returns:

setDefaultSortDirection

public void setDefaultSortDirection(SortableType defaultSortDirection)

getLookupSelectedRenderer

public java.lang.Class<? extends INodeContentRenderer<?>> getLookupSelectedRenderer()
When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the renderer to use to display the currently selected record in the edit page. If null this will use ClassMetaModel.getLookupSelectedProperties().

Specified by:
getLookupSelectedRenderer in interface ClassMetaModel
Returns:

setLookupSelectedRenderer

public void setLookupSelectedRenderer(java.lang.Class<? extends INodeContentRenderer<?>> lookupFieldRenderer)

getLookupSelectedProperties

public java.util.List<DisplayPropertyMetaModel> getLookupSelectedProperties()
When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the properties to use to display the currently selected record in the edit page.

Specified by:
getLookupSelectedProperties in interface ClassMetaModel
Returns:

setLookupSelectedProperties

public void setLookupSelectedProperties(java.util.List<DisplayPropertyMetaModel> lookupFieldDisplayProperties)

getComponentTypeHint

public java.lang.String getComponentTypeHint()
When present this gives a hint to the component factories to help with choosing a proper component to select a single record of this type. This is only used when this class is the parent in an UP relation, and the child needs to add a control to help it select one parent.

Specified by:
getComponentTypeHint in interface ClassMetaModel
Returns:

setComponentTypeHint

public void setComponentTypeHint(java.lang.String componentTypeHint)

getPrimaryKey

public PropertyMetaModel<?> getPrimaryKey()
Description copied from interface: ClassMetaModel
Returns the property containing the primary key for this object, if one can be found.

Specified by:
getPrimaryKey in interface ClassMetaModel
Returns:

setPrimaryKey

public void setPrimaryKey(PropertyMetaModel<?> primaryKey)

getTableName

public java.lang.String getTableName()
Description copied from interface: ClassMetaModel
If this is a persistent class that is directly mapped onto some table, this might return the table name. This should NOT return a name for data that is strictly derived from a metamodel-based database because there all value records share the same table.

Specified by:
getTableName in interface ClassMetaModel
Returns:

setTableName

public void setTableName(java.lang.String tableName)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDomainValues

public java.lang.Object[] getDomainValues()
Description copied from interface: ClassMetaModel
If this class is an Enum or represents some enumerated value, this returns the possible value objects. If this is not a domain type this MUST return null.

Specified by:
getDomainValues in interface ClassMetaModel
Returns:

setDomainValues

public void setDomainValues(java.lang.Object[] domainValues)

getClassNameOnly

public java.lang.String getClassNameOnly()

getDomainLabel

@Nullable
public java.lang.String getDomainLabel(java.util.Locale loc,
                                                java.lang.Object value)
Retrieves a label value for the specified domain value. This is obtained from the appropriate bundle for *this* class. Usually you would use the same call on a property, not on the class, since the property based version allows you to have property-specific translations for values. The property based version delegates here when no property based version is found.

Specified by:
getDomainLabel in interface ClassMetaModel
Returns:
See Also:
ClassMetaModel.getDomainLabel(java.util.Locale, java.lang.Object)

getMetaTableDef

@Nullable
public ICriteriaTableDef<?> getMetaTableDef()

setMetaTableDef

public void setMetaTableDef(@Nullable
                            ICriteriaTableDef<?> metaTableDef)

createCriteria

@Nonnull
public QCriteria<?> createCriteria()
                            throws java.lang.Exception
EXPERIMENTAL If this is a persistent class, this should create a base QCriteria instance to do queries on this class. The QCriteria<T> instance returned must have a T that is equal to the value returned by this.getActualClass(). In addition it should have only restrictions that limit the result to valid instances of this class, nothing else! This usually means the restriction set is empty.

Needs evaluation.

Specified by:
createCriteria in interface ClassMetaModel
Returns:
Throws:
java.lang.Exception
See Also:
ClassMetaModel.createCriteria()