de.schwarzrot.data.meta
Class TableDefinition
java.lang.Object
com.jgoodies.binding.beans.Model
de.schwarzrot.data.support.AbstractEntity
de.schwarzrot.data.meta.support.AbstractMetaEntity<N>
de.schwarzrot.data.meta.support.AbstractMetaChildEntity<String,SchemaDefinition>
de.schwarzrot.data.meta.TableDefinition
- All Implemented Interfaces:
- com.jgoodies.binding.beans.Observable, ChildEntity<SchemaDefinition>, Entity, MetaEntity<String>, NamedChildEntity<String,SchemaDefinition>, NamedEntity<String>, Serializable, Comparable<Entity>
public class TableDefinition
- extends AbstractMetaChildEntity<String,SchemaDefinition>
- See Also:
- Serialized Form
Methods inherited from class de.schwarzrot.data.support.AbstractEntity |
adoptChildren, adoptChildren, adoptGroupedChildren, equals, getCModified, getCode, getDefaultOrder, getDtCreated, getDtModified, getId, getLogger, getSkipList, getSystemClass, getUCreated, getUModified, getUserAttributes, getVariantColumnName, getVariantTypeMap, hashCode, isDirty, isUserType, isVirtual, setCModified, setDtCreated, setDtModified, setId, setSchemaName, setUCreated, setUModified |
Methods inherited from class com.jgoodies.binding.beans.Model |
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, equals, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener |
Methods inherited from interface de.schwarzrot.data.Entity |
getCModified, getDefaultOrder, getDtCreated, getDtModified, getId, getSchemaName, getSkipList, getSystemClass, getUCreated, getUModified, getUniqColumnNames, getUserAttributes, getVariantColumnName, getVariantTypeMap, isDirty, isUserType, isVirtual, setCModified, setDtCreated, setDtModified, setId, setUCreated, setUModified |
Methods inherited from interface com.jgoodies.binding.beans.Observable |
addPropertyChangeListener, removePropertyChangeListener |
NEW_COLUMN_NAME
public static final String NEW_COLUMN_NAME
- See Also:
- Constant Field Values
NEW_ATTRIBUTE_NAME
public static final String NEW_ATTRIBUTE_NAME
- See Also:
- Constant Field Values
TableDefinition
public TableDefinition()
addColumnDefinition
public void addColumnDefinition(ColumnDefinition cd)
changeColumnDefinition
public ColumnDefinition changeColumnDefinition(ColumnDefinition cd)
compareTo
public int compareTo(Entity other)
- Specified by:
compareTo
in interface Comparable<Entity>
- Overrides:
compareTo
in class AbstractMetaChildEntity<String,SchemaDefinition>
containsColumn
public final boolean containsColumn(String columnName)
fixImported
public void fixImported(Converter cnv)
getColumn
public final ColumnDefinition getColumn(String columnName)
getColumns
public final List<ColumnDefinition> getColumns()
getColumnsByName
public final Map<String,ColumnDefinition> getColumnsByName()
getIndices
public final List<IndexDefinition> getIndices()
getLogicalName
public final String getLogicalName()
- Specified by:
getLogicalName
in interface MetaEntity<String>
- Overrides:
getLogicalName
in class AbstractMetaEntity<String>
- Returns:
- the logicalName
getMappings
public Map<String,String> getMappings()
- Description copied from interface:
Entity
- returns a map with mappings of logical property names to physical
property names (column names in database terms).
Every implementation should respect the parents mappings. The following
sample shows different mapping types:
public Map<String, String> getMappings() {
Map<String, String> mappings = super.getMappings();
mappings.put("title", "name");
mappings.put("streams", Stream.class.getName());
mappings.put("pageDefinitions", "pageType|" + ThemeElement.class.getName());
return mappings;
}
The mappings explained:
- "title" -> "name"
- the logical "title"-attribute is stored to persistence with a
physical name "name"
- "streams" -> Stream.class.getName()
- the "streams" property holds related children. Unknown children are
hold in a
List
, known (named) children are hold in a Map
.
The mapped value is used as classname to create child instances.
- "pageDefinitions" -> "pageType|" + ThemeElement.class.getName()
- pageDefinitions is a property of type
Map
, that holds grouped
children. Known children are hold by a Map
, unknown children by a
List
, so "pageDefinitions" may contain elements of type
Map
, or List
. pageType, a property of
ThemeElement
, is used to group the children. The word before the
'|' is the property name used as key value for grouping and the type
after '|' is used to create instances.
- Specified by:
getMappings
in interface Entity
- Overrides:
getMappings
in class AbstractMetaEntity<String>
- Returns:
- a
Map
with property names as keys and column
names as values.
getParentType
public Class<SchemaDefinition> getParentType()
- Description copied from interface:
ChildEntity
- returns the type of the parent entity
- Returns:
- the parent entity
getPersistenceName
public String getPersistenceName()
- Description copied from interface:
Entity
- returns the name of the entity for persistance. Normally it would be the
same result as
getClass().getSimpleName()
, but some storage may
have size limitations, or don't support case sensitive names, so this
call is to deal with that kind of limitations.
- Specified by:
getPersistenceName
in interface Entity
- Overrides:
getPersistenceName
in class AbstractEntity
- Returns:
- the entity-name used for persistence
getType
public final String getType()
initNew
public void initNew()
newColumnDefinition
public ColumnDefinition newColumnDefinition()
setColumnsByName
public final void setColumnsByName(Map<String,ColumnDefinition> columns)
setIndices
public final void setIndices(List<IndexDefinition> indices)
setLogicalName
public final void setLogicalName(String logicalName)
- Parameters:
logicalName
- the logicalName to set
setName
public final void setName(String name)
- Specified by:
setName
in interface NamedEntity<String>
- Overrides:
setName
in class AbstractMetaEntity<String>
setType
public final void setType(String type)
toString
public String toString()
- Overrides:
toString
in class AbstractEntity
validate
public void validate(boolean read)
- Description copied from interface:
Entity
- will be called just before saving and after loading, so it is intended to
give the opportunity to calculate virtual fields.
- Specified by:
validate
in interface Entity
- Overrides:
validate
in class AbstractEntity
- Parameters:
read
- signals whether calculation should be done for reading or for
writing
Submit
a bug or request a feature
SRJRCFrames is published according to the
GNU General Public License
Copyright 2005-2012
Reinhard Mantey - some rights reserved.