Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.map
Class DbEntity

    java.lang.Object
      org.apache.cayenne.map.Entity
          org.apache.cayenne.map.DbEntity

All Implemented Interfaces:
  java.io.Serializable, java.util.EventListener, DbAttributeListener, DbEntityListener, DbRelationshipListener, CayenneMapEntry, XMLSerializable

Direct Known Subclasses:
  DerivedDbEntity

    public class DbEntity

extends Entity
implements DbEntityListener, DbAttributeListener, DbRelationshipListener

A DbEntity is a mapping descriptor that defines a structure of a database table.

Author:
  Misha Shengaout, Andrei Adamchik
See Also:
  Serialized Form

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

### catalog

    protected java.lang.String catalog

### schema

    protected java.lang.String schema

### primaryKey

    protected java.util.List primaryKey

### generatedAttributes

    protected java.util.Collection generatedAttributes

Since:
  1.2

### primaryKeyGenerator

    protected DbKeyGenerator primaryKeyGenerator

Constructor Detail

### DbEntity

    public DbEntity()

  Creates an unnamed DbEntity.

### DbEntity

    public DbEntity(java.lang.String name)

  Creates a named DbEntity.

Method Detail

### encodeAsXML

    public void encodeAsXML(XMLEncoder encoder)

  Prints itself as XML to the provided XMLEncoder.

  Specified by:
    `encodeAsXML` in interface `XMLSerializable`
  Since:
    1.1

### getFullyQualifiedName

    public java.lang.String getFullyQualifiedName()

  Returns table name including schema, if present.

### getSchema

    public java.lang.String getSchema()

  Returns database schema of this table.

  Returns:
    table's schema, null if not set.

### setSchema

    public void setSchema(java.lang.String schema)

  Sets the database schema name of the table described by this DbEntity.

### getCatalog

    public java.lang.String getCatalog()

  Returns the catalog name of the table described by this DbEntity.

### setCatalog

    public void setCatalog(java.lang.String catalog)

  Sets the catalog name of the table described by this DbEntity.

### getPrimaryKey

    public java.util.List getPrimaryKey()

  Returns an unmodifiable list of DbAttributes representing the primary key of the table described by this DbEntity.

### getGeneratedAttributes

    public java.util.Collection getGeneratedAttributes()

  Returns an unmodifiable collection of DbAttributes that are generated by the database.

  Since:
    1.2

### addAttribute

    public void addAttribute(Attribute attr)

  Overrides super to fire an AttributeEvent.

  Overrides:
    `addAttribute` in class `Entity`

### removeAttribute

    public void removeAttribute(java.lang.String attrName)

  Removes attribute from the entity, removes any relationship joins containing this attribute.

  Overrides:
    `removeAttribute` in class `Entity`
  See Also:
    `Entity.removeAttribute(String)`

### clearAttributes

    public void clearAttributes()

  Overrides:
    `clearAttributes` in class `Entity`

### resolvePathComponents

    public java.util.Iterator resolvePathComponents(Expression pathExp)
                                             throws ExpressionException

  Description copied from class: `Entity`
  Processes expression `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.

  Specified by:
    `resolvePathComponents` in class `Entity`
  Throws:
    `ExpressionException`

### setPrimaryKeyGenerator

    public void setPrimaryKeyGenerator(DbKeyGenerator primaryKeyGenerator)

### getPrimaryKeyGenerator

    public DbKeyGenerator getPrimaryKeyGenerator()

### dbEntityChanged

    public void dbEntityChanged(EntityEvent e)

  DbEntity property changed. May be name, attribute or relationship added or removed, etc. Attribute and relationship property changes are handled in respective listeners.

  Specified by:
    `dbEntityChanged` in interface `DbEntityListener`
  Since:
    1.2

### dbEntityAdded

    public void dbEntityAdded(EntityEvent e)

  New entity has been created/added.

  Specified by:
    `dbEntityAdded` in interface `DbEntityListener`

### dbEntityRemoved

    public void dbEntityRemoved(EntityEvent e)

  Entity has been removed.

  Specified by:
    `dbEntityRemoved` in interface `DbEntityListener`

### dbAttributeAdded

    public void dbAttributeAdded(AttributeEvent e)

  Description copied from interface: `DbAttributeListener`
  New attribute has been created/added.

  Specified by:
    `dbAttributeAdded` in interface `DbAttributeListener`

### dbAttributeChanged

    public void dbAttributeChanged(AttributeEvent e)

  Description copied from interface: `DbAttributeListener`
  Attribute property changed.

  Specified by:
    `dbAttributeChanged` in interface `DbAttributeListener`

### dbAttributeRemoved

    public void dbAttributeRemoved(AttributeEvent e)

  Description copied from interface: `DbAttributeListener`
  Attribute has been removed.

  Specified by:
    `dbAttributeRemoved` in interface `DbAttributeListener`

### dbRelationshipChanged

    public void dbRelationshipChanged(RelationshipEvent e)

  Relationship property changed.

  Specified by:
    `dbRelationshipChanged` in interface `DbRelationshipListener`

### dbRelationshipAdded

    public void dbRelationshipAdded(RelationshipEvent e)

  Relationship has been created/added.

  Specified by:
    `dbRelationshipAdded` in interface `DbRelationshipListener`

### dbRelationshipRemoved

    public void dbRelationshipRemoved(RelationshipEvent e)

  Relationship has been removed.

  Specified by:
    `dbRelationshipRemoved` in interface `DbRelationshipListener`

### isFullReplacementIdAttached

    public boolean isFullReplacementIdAttached(ObjectId id)

  Returns true if there is full replacement id is attached to an ObjectId. "Full" means that all PK columns are present and only PK columns are present.

  Since:
    1.2

### translateToRelatedEntity

    public Expression translateToRelatedEntity(Expression expression,
                                               java.lang.String relationshipPath)

  Transforms Expression rooted in this entity to an analogous expression rooted in related entity.

  Specified by:
    `translateToRelatedEntity` in class `Entity`
  Since:
    1.1

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.