|
||||||||||
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.ObjEntity
public class ObjEntity
ObjEntity is a mapping descriptor for a DataObject Java class. It contains the information about the Java class itself, as well as its mapping to the DbEntity layer.
Field Summary | |
---|---|
protected CallbackMap |
callbacks
|
protected String |
className
|
protected String |
clientClassName
|
protected String |
clientSuperClassName
|
protected String |
dbEntityName
|
protected static Collection |
DEFAULT_GENERIC_CLASSES
A collection of default "generic" entity classes excluded from class generation. |
protected List |
entityListeners
|
protected boolean |
excludingDefaultListeners
|
protected boolean |
excludingSuperclassListeners
|
static int |
LOCK_TYPE_NONE
|
static int |
LOCK_TYPE_OPTIMISTIC
|
protected int |
lockType
|
protected Expression |
qualifier
|
protected boolean |
readOnly
|
protected boolean |
serverOnly
|
protected String |
superClassName
|
protected String |
superEntityName
|
Fields inherited from class org.apache.cayenne.map.Entity |
---|
attributes, dataMap, name, PATH_SEPARATOR, relationships |
Constructor Summary | |
---|---|
ObjEntity()
|
|
ObjEntity(String name)
|
Method Summary | |
---|---|
void |
addEntityListener(EntityListener listener)
Adds a new EntityListener. |
void |
clearDbMapping()
Clears all the mapping between this obj entity and its current db entity. |
void |
encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided XMLEncoder. |
Attribute |
getAttribute(String name)
Returns a named attribute that either belongs to this ObjEntity or is inherited. |
ObjAttribute |
getAttributeForDbAttribute(DbAttribute dbAttribute)
Returns ObjAttribute of this entity that maps to dbAttribute
parameter. |
SortedMap |
getAttributeMap()
Returns a SortedMap of all attributes that either belong to this ObjEntity or inherited. |
Collection |
getAttributes()
Returns a Collection of all attributes that either belong to this ObjEntity or inherited. |
CallbackMap |
getCallbackMap()
Returns an object that stores callback methods of this entity. |
String |
getClassName()
Returns the name of DataObject class described by this entity. |
String |
getClientClassName()
Returns the name of ClientDataObject class described by this entity. |
ObjEntity |
getClientEntity()
Returns an ObjEntity stripped of any server-side information, such as DbEntity mapping. |
String |
getClientSuperClassName()
Returns a fully-qualified name of the client-side super class of the DataObject class. |
DbEntity |
getDbEntity()
Returns a DbEntity associated with this ObjEntity. |
String |
getDbEntityName()
Returns the name of the underlying DbEntity. |
Collection |
getDeclaredAttributes()
Returns a Collection of all attributes that belong to this ObjEntity, excluding inherited attributes. |
int |
getDeclaredLockType()
Returns the type of lock used by this ObjEntity, regardless of what locking type is used by super entities. |
Expression |
getDeclaredQualifier()
Returns a qualifier that imposes a restriction on what objects belong to this entity. |
Collection |
getDeclaredRelationships()
Returns a Collection of all relationships that belong to this ObjEntity, excluding inherited attributes. |
EntityListener |
getEntityListener(String className)
|
List |
getEntityListeners()
Returns an unmodifiable list of registered EntityListener objects. |
Class |
getJavaClass()
Returns Java class of persistent objects described by this entity. |
int |
getLockType()
Returns the type of lock used by this ObjEntity. |
Relationship |
getRelationship(String name)
Returns a named Relationship that either belongs to this ObjEntity or is inherited. |
ObjRelationship |
getRelationshipForDbRelationship(DbRelationship dbRelationship)
Returns ObjRelationship of this entity that maps to dbRelationship
parameter. |
SortedMap |
getRelationshipMap()
Returns an unmodifiable map of relationships sorted by name. |
Collection |
getRelationships()
Returns an unmodifiable collection of Relationships that exist in this entity. |
String |
getSuperClassName()
Returns a fully-qualified name of the super class of the DataObject class. |
ObjEntity |
getSuperEntity()
Returns a "super" entity in the entity inheritance hierarchy. |
String |
getSuperEntityName()
Returns an entity name for a parent entity in the inheritance hierarchy. |
boolean |
isClientAllowed()
Returns true if this entity is allowed to be used on the client. |
boolean |
isExcludingDefaultListeners()
Returns true if the default lifecycle listeners should not be notified of this entity lifecycle events. |
boolean |
isExcludingSuperclassListeners()
Returns true if the lifeycle listeners defined on the superclasses should not be notified of this entity lifecycle events. |
boolean |
isGeneric()
Returns whether this entity is "generic", meaning it is not mapped to a unique Java class. |
boolean |
isReadOnly()
Returns true if this ObjEntity represents a set of read-only
objects. |
boolean |
isServerOnly()
Returns true if this entity is not available on the client. |
boolean |
isSubentityOf(ObjEntity entity)
Returns true if this entity directly or indirectly inherits from a given entity, false otherwise. |
void |
objAttributeAdded(AttributeEvent e)
New attribute has been created/added. |
void |
objAttributeChanged(AttributeEvent e)
Attribute property changed. |
void |
objAttributeRemoved(AttributeEvent e)
Attribute has been removed. |
void |
objEntityAdded(EntityEvent e)
New entity has been created/added. |
void |
objEntityChanged(EntityEvent e)
ObjEntity property changed. |
void |
objEntityRemoved(EntityEvent e)
Entity has been removed. |
void |
objRelationshipAdded(RelationshipEvent e)
Relationship has been created/added. |
void |
objRelationshipChanged(RelationshipEvent e)
Relationship property changed. |
void |
objRelationshipRemoved(RelationshipEvent e)
Relationship has been removed. |
void |
removeEntityListener(String className)
Removes a listener matching class name. |
Iterator |
resolvePathComponents(Expression pathExp)
Processes expression pathExp and returns an Iterator of path
components that contains a sequence of Attributes and Relationships. |
void |
setClassName(String className)
Sets the name of the DataObject class described by this entity. |
void |
setClientClassName(String clientClassName)
Sets the name of the ClientDataObject class described by this entity. |
void |
setClientSuperClassName(String clientSuperClassName)
Sets a fully-qualified name of the client-side super class of the ClientDataObject class. |
void |
setDbEntity(DbEntity dbEntity)
Sets the DbEntity used by this ObjEntity. |
void |
setDbEntityName(String string)
Sets the name of underlying DbEntity. |
void |
setDeclaredLockType(int i)
Sets the type of lock used by this ObjEntity. |
void |
setDeclaredQualifier(Expression qualifier)
Sets a qualifier that imposes a limit on what objects belong to this entity. |
void |
setExcludingDefaultListeners(boolean excludingDefaultListeners)
|
void |
setExcludingSuperclassListeners(boolean excludingSuperclassListeners)
|
void |
setReadOnly(boolean readOnly)
|
void |
setServerOnly(boolean serverOnly)
Sets whether this entity is available on the client. |
void |
setSuperClassName(String superClassName)
Sets a fully-qualified name of the super class of the DataObject class. |
void |
setSuperEntityName(String superEntityName)
Sets an entity name for a parent entity in the inheritance hierarchy. |
Expression |
translateToDbPath(Expression expression)
Transforms an Expression to an analogous expression in terms of the underlying DbEntity. |
Expression |
translateToRelatedEntity(Expression expression,
String relationshipPath)
Transforms an Expression rooted in this entity to an analogous expression rooted in related entity. |
Methods inherited from class org.apache.cayenne.map.Entity |
---|
addAttribute, addRelationship, clearAttributes, clearRelationships, getAnyRelationship, getDataMap, getName, getParent, lastPathComponent, removeAttribute, 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 |
---|
public static final int LOCK_TYPE_NONE
public static final int LOCK_TYPE_OPTIMISTIC
protected static final Collection DEFAULT_GENERIC_CLASSES
protected String superClassName
protected String className
protected String dbEntityName
protected String superEntityName
protected Expression qualifier
protected boolean readOnly
protected int lockType
protected boolean serverOnly
protected String clientClassName
protected String clientSuperClassName
protected List entityListeners
protected CallbackMap callbacks
protected boolean excludingDefaultListeners
protected boolean excludingSuperclassListeners
Constructor Detail |
---|
public ObjEntity()
public ObjEntity(String name)
Method Detail |
---|
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
public ObjEntity getClientEntity()
public Class getJavaClass()
public List getEntityListeners()
EntityListener
objects. Note
that since the order of listeners is significant a list, not just a generic
Collection is returned.
public void addEntityListener(EntityListener listener)
IllegalArgumentException
- if a listener for the same class name is already
registered.public void removeEntityListener(String className)
public EntityListener getEntityListener(String className)
public CallbackMap getCallbackMap()
public int getLockType()
public int getDeclaredLockType()
public void setDeclaredLockType(int i)
public boolean isGeneric()
public boolean isClientAllowed()
public boolean isServerOnly()
public void setServerOnly(boolean serverOnly)
public Expression getDeclaredQualifier()
public String getSuperEntityName()
public void setDeclaredQualifier(Expression qualifier)
public void setSuperEntityName(String superEntityName)
public String getClassName()
public void setClassName(String className)
public String getClientClassName()
public void setClientClassName(String clientClassName)
public String getSuperClassName()
public void setSuperClassName(String superClassName)
An attempt to set superclass on an inherited entity has no effect, since a class of the super entity is always used as a superclass.
public String getClientSuperClassName()
public void setClientSuperClassName(String clientSuperClassName)
An attempt to set superclass on an inherited entity has no effect, since a class of the super entity is always used as a superclass.
public ObjEntity getSuperEntity()
public DbEntity getDbEntity()
public void setDbEntity(DbEntity dbEntity)
Setting DbEntity on an inherited entity has no effect, since a class of the super entity is always used as a superclass.
public Attribute getAttribute(String name)
getAttribute
in class Entity
public SortedMap getAttributeMap()
getAttributeMap
in class Entity
public Collection getAttributes()
getAttributes
in class Entity
public Collection getDeclaredAttributes()
public Relationship getRelationship(String name)
getRelationship
in class Entity
public SortedMap getRelationshipMap()
Entity
getRelationshipMap
in class Entity
public Collection getRelationships()
Entity
getRelationships
in class Entity
public Collection getDeclaredRelationships()
public ObjAttribute getAttributeForDbAttribute(DbAttribute dbAttribute)
dbAttribute
parameter. Returns null if no such attribute is found.
public ObjRelationship getRelationshipForDbRelationship(DbRelationship dbRelationship)
dbRelationship
parameter. Returns null if no such relationship is found.
public void clearDbMapping()
public boolean isReadOnly()
true
if this ObjEntity represents a set of read-only
objects.
public void setReadOnly(boolean readOnly)
public boolean isSubentityOf(ObjEntity 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 Expression translateToDbPath(Expression expression)
public Expression translateToRelatedEntity(Expression expression, String relationshipPath)
translateToRelatedEntity
in class Entity
public String getDbEntityName()
public void setDbEntityName(String string)
public void objEntityChanged(EntityEvent e)
objEntityChanged
in interface ObjEntityListener
public void objEntityAdded(EntityEvent e)
objEntityAdded
in interface ObjEntityListener
public void objEntityRemoved(EntityEvent e)
objEntityRemoved
in interface ObjEntityListener
public void objAttributeChanged(AttributeEvent e)
objAttributeChanged
in interface ObjAttributeListener
public void objAttributeAdded(AttributeEvent e)
objAttributeAdded
in interface ObjAttributeListener
public void objAttributeRemoved(AttributeEvent e)
objAttributeRemoved
in interface ObjAttributeListener
public void objRelationshipChanged(RelationshipEvent e)
objRelationshipChanged
in interface ObjRelationshipListener
public void objRelationshipAdded(RelationshipEvent e)
objRelationshipAdded
in interface ObjRelationshipListener
public void objRelationshipRemoved(RelationshipEvent e)
objRelationshipRemoved
in interface ObjRelationshipListener
public boolean isExcludingDefaultListeners()
public void setExcludingDefaultListeners(boolean excludingDefaultListeners)
public boolean isExcludingSuperclassListeners()
public void setExcludingSuperclassListeners(boolean excludingSuperclassListeners)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |