|
||||||||||
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 String |
catalog
|
protected Collection |
generatedAttributes
|
protected List |
primaryKey
|
protected DbKeyGenerator |
primaryKeyGenerator
|
protected 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(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. |
String |
getCatalog()
Returns the catalog name of the table described by this DbEntity. |
String |
getFullyQualifiedName()
Returns table name including schema, if present. |
Collection |
getGeneratedAttributes()
Returns an unmodifiable collection of DbAttributes that are generated by the database. |
List |
getPrimaryKey()
Returns an unmodifiable list of DbAttributes representing the primary key of the table described by this DbEntity. |
DbKeyGenerator |
getPrimaryKeyGenerator()
|
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(String attrName)
Removes attribute from the entity, removes any relationship joins containing this attribute. |
Iterator |
resolvePathComponents(Expression pathExp)
Processes expression pathExp and returns an Iterator of path
components that contains a sequence of Attributes and Relationships. |
void |
setCatalog(String catalog)
Sets the catalog name of the table described by this DbEntity. |
void |
setPrimaryKeyGenerator(DbKeyGenerator primaryKeyGenerator)
|
void |
setSchema(String schema)
Sets the database schema name of the table described by this DbEntity. |
Expression |
translateToRelatedEntity(Expression expression,
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 String catalog
protected String schema
protected List primaryKey
protected Collection generatedAttributes
protected DbKeyGenerator primaryKeyGenerator
Constructor Detail |
---|
public DbEntity()
public DbEntity(String name)
Method Detail |
---|
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
public String getFullyQualifiedName()
public String getSchema()
public void setSchema(String schema)
public String getCatalog()
public void setCatalog(String catalog)
public List getPrimaryKey()
public Collection getGeneratedAttributes()
public void addAttribute(Attribute attr)
addAttribute
in class Entity
public void removeAttribute(String attrName)
removeAttribute
in class Entity
Entity.removeAttribute(String)
public void clearAttributes()
clearAttributes
in class Entity
public 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, String relationshipPath)
translateToRelatedEntity
in class Entity
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |