public class ObjEntity extends Entity implements ObjEntityListener, ConfigurationNode
Modifier and Type | Field and Description |
---|---|
protected boolean |
_abstract |
protected Map<String,String> |
attributeOverrides |
protected CallbackMap |
callbacks |
protected String |
className |
protected String |
clientClassName |
protected String |
clientSuperClassName |
protected String |
dbEntityName |
protected static Collection<String> |
DEFAULT_GENERIC_CLASSES
A collection of default "generic" entity classes excluded from class
generation.
|
protected List<EntityListener> |
entityListeners
Deprecated.
|
protected boolean |
excludingDefaultListeners
Deprecated.
|
protected boolean |
excludingSuperclassListeners
Deprecated.
|
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 |
attributes, dataMap, name, OUTER_JOIN_INDICATOR, PATH_SEPARATOR, relationships
Modifier and Type | Method and Description |
---|---|
<T> T |
acceptVisitor(ConfigurationNodeVisitor<T> visitor) |
void |
addAttributeOverride(String attributeName,
String dbPath) |
void |
addEntityListener(EntityListener listener)
Deprecated.
since 4.0 unused, as listeners are no longer mapped in a
DataMap.
|
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.
|
ObjAttribute |
getAttribute(String name)
Returns a named attribute that is either declared in this ObjEntity or is
inherited.
|
ObjAttribute |
getAttributeForDbAttribute(DbAttribute dbAttribute)
Returns ObjAttribute of this entity that maps to
dbAttribute
parameter. |
SortedMap<String,ObjAttribute> |
getAttributeMap()
Returns a SortedMap of all attributes that either belong to this
ObjEntity or inherited.
|
Collection<ObjAttribute> |
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.
|
Set<String> |
getCallbackMethods() |
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.
|
ObjAttribute |
getDeclaredAttribute(String name)
Finds attribute declared by this ObjEntity,
excluding inherited attributes.
|
Map<String,String> |
getDeclaredAttributeOverrides() |
Collection<ObjAttribute> |
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<ObjRelationship> |
getDeclaredRelationships()
Returns a Collection of all relationships that belong to this ObjEntity,
excluding inherited attributes.
|
EntityListener |
getEntityListener(String className)
Deprecated.
since 4.0 unused, as listeners are no longer mapped in a
DataMap.
|
List<EntityListener> |
getEntityListeners()
Deprecated.
since 4.0 unused, as listeners are no longer mapped in a
DataMap.
|
Class<?> |
getJavaClass()
Deprecated.
since 4.0 this method based on statically defined class
loading algorithm is not going to work in environments like
OSGi.
AdhocObjectFactory should be used as it can
provide the environment-specific class loading policy. |
String |
getJavaClassName()
Returns a non-null class name.
|
int |
getLockType()
Returns the type of lock used by this ObjEntity.
|
Collection<String> |
getPrimaryKeyNames()
Returns the names of DbAtributes that comprise the primary key of the
parent DbEntity.
|
Collection<ObjAttribute> |
getPrimaryKeys()
Returns an unmodifiable collection of ObjAttributes representing the
primary key of the table described by this DbEntity.
|
ObjRelationship |
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<String,ObjRelationship> |
getRelationshipMap()
Returns an unmodifiable map of relationships sorted by name.
|
Collection<ObjRelationship> |
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 |
isAbstract() |
boolean |
isClientAllowed()
Returns true if this entity is allowed to be used on the client.
|
boolean |
isExcludingDefaultListeners()
Deprecated.
since 4.0 unused, as listeners are no longer mapped in a
DataMap.
|
boolean |
isExcludingSuperclassListeners()
Deprecated.
since 4.0 unused, as listeners are no longer mapped in a
DataMap.
|
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.
|
PathComponent<ObjAttribute,ObjRelationship> |
lastPathComponent(Expression path,
Map aliasMap)
Convenience method returning the last component in the path iterator.
|
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 |
removeAttributeOverride(String attributeName) |
void |
removeEntityListener(String className)
Deprecated.
since 4.0 unused, as listeners are no longer mapped in a
DataMap.
|
Iterable<PathComponent<ObjAttribute,ObjRelationship>> |
resolvePath(Expression pathExp,
Map aliasMap)
Returns an Iterable instance over expression path components based on
this entity.
|
Iterator<CayenneMapEntry> |
resolvePathComponents(Expression pathExp)
Processes expression
pathExp and returns an Iterator of path
components that contains a sequence of Attributes and Relationships. |
void |
setAbstract(boolean isAbstract)
Sets whether this entity is abstract only.
|
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)
Deprecated.
since 4.0 unused, as listeners are no longer mapped in a
DataMap.
|
void |
setExcludingSuperclassListeners(boolean excludingSuperclassListeners)
Deprecated.
since 4.0 unused, as listeners are no longer mapped in a
DataMap.
|
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.
|
addAttribute, addRelationship, clearAttributes, clearRelationships, getAnyRelationship, getDataMap, getName, getParent, removeAttribute, removeRelationship, resolvePathComponents, setDataMap, setName, setParent, toString, updateAttribute
public static final int LOCK_TYPE_NONE
public static final int LOCK_TYPE_OPTIMISTIC
protected static final Collection<String> 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 _abstract
protected boolean serverOnly
protected String clientClassName
protected String clientSuperClassName
@Deprecated protected List<EntityListener> entityListeners
protected CallbackMap callbacks
@Deprecated protected boolean excludingDefaultListeners
@Deprecated protected boolean excludingSuperclassListeners
public ObjEntity()
public ObjEntity(String name)
public <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
acceptVisitor
in interface ConfigurationNode
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
public ObjEntity getClientEntity()
public String getJavaClassName()
@Deprecated public Class<?> getJavaClass()
AdhocObjectFactory
should be used as it can
provide the environment-specific class loading policy.@Deprecated public List<EntityListener> getEntityListeners()
EntityListener
objects. Note that since the order of listeners is significant a list,
not just a generic Collection is returned.@Deprecated public void addEntityListener(EntityListener listener)
IllegalArgumentException
- if a listener for the same class name is already registered.@Deprecated public void removeEntityListener(String className)
@Deprecated 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 isAbstract()
public void setAbstract(boolean isAbstract)
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 Collection<ObjAttribute> getPrimaryKeys()
public ObjAttribute getAttribute(String name)
getAttribute
in class Entity
public SortedMap<String,ObjAttribute> getAttributeMap()
getAttributeMap
in class Entity
public void addAttributeOverride(String attributeName, String dbPath)
public void removeAttributeOverride(String attributeName)
public Collection<ObjAttribute> getAttributes()
getAttributes
in class Entity
public Collection<ObjAttribute> getDeclaredAttributes()
public ObjAttribute getDeclaredAttribute(String name)
name
- of the attributegetAttribute(String)
public ObjRelationship getRelationship(String name)
getRelationship
in class Entity
public SortedMap<String,ObjRelationship> getRelationshipMap()
Entity
getRelationshipMap
in class Entity
public Collection<ObjRelationship> getRelationships()
Entity
getRelationships
in class Entity
public Collection<ObjRelationship> getDeclaredRelationships()
public ObjAttribute getAttributeForDbAttribute(DbAttribute dbAttribute)
dbAttribute
parameter. Returns null if no such attribute is found.public Collection<String> getPrimaryKeyNames()
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 PathComponent<ObjAttribute,ObjRelationship> lastPathComponent(Expression path, Map aliasMap)
Entity
lastPathComponent
in class Entity
public Iterable<PathComponent<ObjAttribute,ObjRelationship>> resolvePath(Expression pathExp, Map aliasMap)
resolvePath
in class Entity
public Iterator<CayenneMapEntry> 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
@Deprecated public boolean isExcludingDefaultListeners()
@Deprecated public void setExcludingDefaultListeners(boolean excludingDefaultListeners)
@Deprecated public boolean isExcludingSuperclassListeners()
@Deprecated public void setExcludingSuperclassListeners(boolean excludingSuperclassListeners)
Copyright © 2001–2018 Apache Cayenne. All rights reserved.