|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.map.Entity
org.apache.cayenne.map.DbEntity
public class DbEntity
A DbEntity is a mapping descriptor that defines a structure of a database table.
Field Summary | |
---|---|
protected java.lang.String |
catalog
|
protected java.util.Collection |
generatedAttributes
|
protected java.util.List |
primaryKey
|
protected DbKeyGenerator |
primaryKeyGenerator
|
protected java.lang.String |
schema
|
Fields inherited from class org.apache.cayenne.map.Entity |
---|
attributes, dataMap, name, PATH_SEPARATOR, relationships |
Constructor Summary | |
---|---|
DbEntity()
Creates an unnamed DbEntity. |
|
DbEntity(java.lang.String name)
Creates a named DbEntity. |
Method Summary | |
---|---|
void |
addAttribute(Attribute attr)
Overrides super to fire an AttributeEvent. |
void |
clearAttributes()
|
void |
dbAttributeAdded(AttributeEvent e)
New attribute has been created/added. |
void |
dbAttributeChanged(AttributeEvent e)
Attribute property changed. |
void |
dbAttributeRemoved(AttributeEvent e)
Attribute has been removed. |
void |
dbEntityAdded(EntityEvent e)
New entity has been created/added. |
void |
dbEntityChanged(EntityEvent e)
DbEntity property changed. |
void |
dbEntityRemoved(EntityEvent e)
Entity has been removed. |
void |
dbRelationshipAdded(RelationshipEvent e)
Relationship has been created/added. |
void |
dbRelationshipChanged(RelationshipEvent e)
Relationship property changed. |
void |
dbRelationshipRemoved(RelationshipEvent e)
Relationship has been removed. |
void |
encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided XMLEncoder. |
java.lang.String |
getCatalog()
Returns the catalog name of the table described by this DbEntity. |
java.lang.String |
getFullyQualifiedName()
Returns table name including schema, if present. |
java.util.Collection |
getGeneratedAttributes()
Returns an unmodifiable collection of DbAttributes that are generated by the database. |
java.util.List |
getPrimaryKey()
Returns an unmodifiable list of DbAttributes representing the primary key of the table described by this DbEntity. |
DbKeyGenerator |
getPrimaryKeyGenerator()
|
java.lang.String |
getSchema()
Returns database schema of this table. |
boolean |
isFullReplacementIdAttached(ObjectId id)
Returns true if there is full replacement id is attached to an ObjectId. |
void |
removeAttribute(java.lang.String attrName)
Removes attribute from the entity, removes any relationship joins containing this attribute. |
java.util.Iterator |
resolvePathComponents(Expression pathExp)
Processes expression pathExp and returns an Iterator of path
components that contains a sequence of Attributes and Relationships. |
void |
setCatalog(java.lang.String catalog)
Sets the catalog name of the table described by this DbEntity. |
void |
setPrimaryKeyGenerator(DbKeyGenerator primaryKeyGenerator)
|
void |
setSchema(java.lang.String schema)
Sets the database schema name of the table described by this DbEntity. |
Expression |
translateToRelatedEntity(Expression expression,
java.lang.String relationshipPath)
Transforms Expression rooted in this entity to an analogous expression rooted in related entity. |
Methods inherited from class org.apache.cayenne.map.Entity |
---|
addRelationship, clearRelationships, getAnyRelationship, getAttribute, getAttributeMap, getAttributes, getDataMap, getName, getParent, getRelationship, getRelationshipMap, getRelationships, lastPathComponent, removeRelationship, resolvePathComponents, setDataMap, setName, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String catalog
protected java.lang.String schema
protected java.util.List primaryKey
protected java.util.Collection generatedAttributes
protected DbKeyGenerator primaryKeyGenerator
Constructor Detail |
---|
public DbEntity()
public DbEntity(java.lang.String name)
Method Detail |
---|
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
public java.lang.String getFullyQualifiedName()
public java.lang.String getSchema()
public void setSchema(java.lang.String schema)
public java.lang.String getCatalog()
public void setCatalog(java.lang.String catalog)
public java.util.List getPrimaryKey()
public java.util.Collection getGeneratedAttributes()
public void addAttribute(Attribute attr)
addAttribute
in class Entity
public void removeAttribute(java.lang.String attrName)
removeAttribute
in class Entity
Entity.removeAttribute(String)
public void clearAttributes()
clearAttributes
in class Entity
public java.util.Iterator resolvePathComponents(Expression pathExp) throws ExpressionException
Entity
pathExp
and returns an Iterator of path
components that contains a sequence of Attributes and Relationships. Note that if
path is invalid and can not be resolved from this entity, this method will still
return an Iterator, but an attempt to read the first invalid path component will
result in ExpressionException.
resolvePathComponents
in class Entity
ExpressionException
public void setPrimaryKeyGenerator(DbKeyGenerator primaryKeyGenerator)
public DbKeyGenerator getPrimaryKeyGenerator()
public void dbEntityChanged(EntityEvent e)
dbEntityChanged
in interface DbEntityListener
public void dbEntityAdded(EntityEvent e)
dbEntityAdded
in interface DbEntityListener
public void dbEntityRemoved(EntityEvent e)
dbEntityRemoved
in interface DbEntityListener
public void dbAttributeAdded(AttributeEvent e)
DbAttributeListener
dbAttributeAdded
in interface DbAttributeListener
public void dbAttributeChanged(AttributeEvent e)
DbAttributeListener
dbAttributeChanged
in interface DbAttributeListener
public void dbAttributeRemoved(AttributeEvent e)
DbAttributeListener
dbAttributeRemoved
in interface DbAttributeListener
public void dbRelationshipChanged(RelationshipEvent e)
dbRelationshipChanged
in interface DbRelationshipListener
public void dbRelationshipAdded(RelationshipEvent e)
dbRelationshipAdded
in interface DbRelationshipListener
public void dbRelationshipRemoved(RelationshipEvent e)
dbRelationshipRemoved
in interface DbRelationshipListener
public boolean isFullReplacementIdAttached(ObjectId id)
public Expression translateToRelatedEntity(Expression expression, java.lang.String relationshipPath)
translateToRelatedEntity
in class Entity
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |