org.apache.cayenne.map
Class DerivedDbEntity

java.lang.Object
  extended by org.apache.cayenne.map.Entity
      extended by org.apache.cayenne.map.DbEntity
          extended by org.apache.cayenne.map.DerivedDbEntity
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, DbAttributeListener, DbEntityListener, DbRelationshipListener, CayenneMapEntry, XMLSerializable

public class DerivedDbEntity
extends DbEntity

DbEntity subclass that is based on another DbEntity and allows to define complex database expressions like GROUP BY and aggregate functions.

Author:
Andrei Adamchik
See Also:
Serialized Form

Field Summary
protected  java.lang.String parentEntityName
           
 
Fields inherited from class org.apache.cayenne.map.DbEntity
catalog, generatedAttributes, primaryKey, primaryKeyGenerator, schema
 
Fields inherited from class org.apache.cayenne.map.Entity
attributes, dataMap, name, PATH_SEPARATOR, relationships
 
Constructor Summary
DerivedDbEntity()
          Constructor for DerivedDbEntity.
DerivedDbEntity(java.lang.String name)
          Constructor for DerivedDbEntity.
DerivedDbEntity(java.lang.String name, DbEntity parentEntity)
          Constructor for DerivedDbEntity.
 
Method Summary
 void encodeAsXML(XMLEncoder encoder)
          Prints itself as XML to the provided XMLEncoder.
 java.lang.String getCatalog()
          Returns catalog of the parent entity.
 java.lang.String getFullyQualifiedName()
          Returns table name including schema, if present.
 java.util.List getGroupByAttributes()
          Returns attributes used in GROUP BY as an unmodifiable list.
 DbEntity getParentEntity()
          Returns the parentEntity.
 java.lang.String getParentEntityName()
          Returns the parentEntityName.
 java.lang.String getSchema()
          Returns schema of the parent entity.
 void removeAttribute(java.lang.String attrName)
          Removes attribute from the entity, removes any relationship joins containing this attribute.
 void resetToParentView()
          Removes all attributes and relationships, and replaces them with the data of the parent entity.
 void setCatalog(java.lang.String catalog)
          Throws exception.
 void setParentEntity(DbEntity parentEntity)
          Sets the parent entity of this derived DbEntity.
 void setParentEntityName(java.lang.String parentEntityName)
          Sets the parentEntityName.
 void setSchema(java.lang.String schema)
          Throws exception.
 
Methods inherited from class org.apache.cayenne.map.DbEntity
addAttribute, clearAttributes, dbAttributeAdded, dbAttributeChanged, dbAttributeRemoved, dbEntityAdded, dbEntityChanged, dbEntityRemoved, dbRelationshipAdded, dbRelationshipChanged, dbRelationshipRemoved, getGeneratedAttributes, getPrimaryKey, getPrimaryKeyGenerator, isFullReplacementIdAttached, resolvePathComponents, setPrimaryKeyGenerator, translateToRelatedEntity
 
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

parentEntityName

protected java.lang.String parentEntityName
Constructor Detail

DerivedDbEntity

public DerivedDbEntity()
Constructor for DerivedDbEntity.


DerivedDbEntity

public DerivedDbEntity(java.lang.String name)
Constructor for DerivedDbEntity.

Parameters:
name -

DerivedDbEntity

public DerivedDbEntity(java.lang.String name,
                       DbEntity parentEntity)
Constructor for DerivedDbEntity. Creates a derived entity with the attribute set of a parent entity.

Method Detail

encodeAsXML

public void encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided XMLEncoder.

Specified by:
encodeAsXML in interface XMLSerializable
Overrides:
encodeAsXML in class DbEntity
Since:
1.1

resetToParentView

public void resetToParentView()
Removes all attributes and relationships, and replaces them with the data of the parent entity.


getParentEntity

public DbEntity getParentEntity()
Returns the parentEntity.

Returns:
DbEntity

setParentEntity

public void setParentEntity(DbEntity parentEntity)
Sets the parent entity of this derived DbEntity.


getGroupByAttributes

public java.util.List getGroupByAttributes()
Returns attributes used in GROUP BY as an unmodifiable list.


getFullyQualifiedName

public java.lang.String getFullyQualifiedName()
Description copied from class: DbEntity
Returns table name including schema, if present.

Overrides:
getFullyQualifiedName in class DbEntity
See Also:
DbEntity.getFullyQualifiedName()

getSchema

public java.lang.String getSchema()
Returns schema of the parent entity.

Overrides:
getSchema in class DbEntity
Returns:
table's schema, null if not set.

setSchema

public void setSchema(java.lang.String schema)
Throws exception.

Overrides:
setSchema in class DbEntity

getCatalog

public java.lang.String getCatalog()
Returns catalog of the parent entity.

Overrides:
getCatalog in class DbEntity

setCatalog

public void setCatalog(java.lang.String catalog)
Throws exception.

Overrides:
setCatalog in class DbEntity

removeAttribute

public void removeAttribute(java.lang.String attrName)
Description copied from class: DbEntity
Removes attribute from the entity, removes any relationship joins containing this attribute.

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

getParentEntityName

public java.lang.String getParentEntityName()
Returns the parentEntityName.

Returns:
String

setParentEntityName

public void setParentEntityName(java.lang.String parentEntityName)
Sets the parentEntityName.

Parameters:
parentEntityName - The parentEntityName to set


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