|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.map.DataMap
public class DataMap
Stores a collection of related mapping objects that describe database and object layers of an application. DataMap contains DbEntities mapping database tables, ObjEntities - mapping persistent Java classes, Procedures - mapping database stored procedures.
Field Summary | |
---|---|
static java.lang.String |
CLIENT_SUPPORTED_PROPERTY
Defines whether a DataMap supports client entities. |
protected boolean |
clientSupported
|
static java.lang.String |
DEFAULT_CLIENT_PACKAGE_PROPERTY
Defines the name of the property for default client Java class package. |
static java.lang.String |
DEFAULT_LOCK_TYPE_PROPERTY
Defines the name of the property for default DB schema. |
static java.lang.String |
DEFAULT_PACKAGE_PROPERTY
Defines the name of the property for default Java class package. |
static java.lang.String |
DEFAULT_SCHEMA_PROPERTY
Defines the name of the property for default DB schema. |
static java.lang.String |
DEFAULT_SUPERCLASS_PROPERTY
Defines the name of the property for default DB schema. |
protected java.lang.String |
defaultClientPackage
|
protected int |
defaultLockType
|
protected java.lang.String |
defaultPackage
|
protected java.lang.String |
defaultSchema
|
protected java.lang.String |
defaultSuperclass
|
protected java.lang.String |
location
|
protected java.lang.String |
name
|
protected MappingNamespace |
namespace
|
Constructor Summary | |
---|---|
DataMap()
Creates a new unnamed DataMap. |
|
DataMap(java.lang.String mapName)
Creates a new named DataMap. |
|
DataMap(java.lang.String mapName,
java.util.Map properties)
|
Method Summary | |
---|---|
void |
addDbEntity(DbEntity entity)
Adds a new DbEntity to this DataMap. |
void |
addObjEntity(ObjEntity entity)
Adds a new ObjEntity to this DataMap. |
void |
addProcedure(Procedure procedure)
Adds stored procedure to the list of procedures. |
void |
addQuery(Query query)
Stores a query under its name. |
void |
clearDbEntities()
|
void |
clearObjEntities()
|
void |
clearProcedures()
|
void |
clearQueries()
|
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(java.io.PrintWriter pw)
Prints itself as a well-formed complete XML document. |
void |
encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided PrintWriter. |
DataMap |
getClientDataMap(EntityResolver serverResolver)
Returns a DataMap stripped of any server-side information, such as DbEntity mapping, or ObjEntities that are not allowed in the client tier. |
java.util.Collection |
getDbEntities()
Returns all DbEntities in this DataMap. |
DbEntity |
getDbEntity(java.lang.String dbEntityName)
Returns DbEntity matching the name parameter. |
java.util.SortedMap |
getDbEntityMap()
Returns a sorted unmodifiable map of DbEntities contained in this DataMap, keyed by DbEntity name. |
java.lang.String |
getDefaultClientPackage()
Returns default client package. |
int |
getDefaultLockType()
|
java.lang.String |
getDefaultPackage()
|
java.lang.String |
getDefaultSchema()
|
java.lang.String |
getDefaultSuperclass()
|
java.lang.String |
getLocation()
Returns "location" property value. |
java.util.Collection |
getMappedEntities(DbEntity dbEntity)
Returns all ObjEntities mapped to the given DbEntity. |
java.lang.String |
getName()
Returns the name of this DataMap. |
MappingNamespace |
getNamespace()
Returns a parent namespace where this DataMap resides. |
java.util.Collection |
getObjEntities()
Returns an unmodifiable collection of ObjEntities stored in this DataMap. |
java.util.Collection |
getObjEntities(boolean includeDeps)
Deprecated. since 1.2 use getObjEntities(). |
ObjEntity |
getObjEntity(java.lang.String objEntityName)
Returns an ObjEntity for a given name. |
ObjEntity |
getObjEntityForJavaClass(java.lang.String javaClassName)
Returns an ObjEntity for a DataObject class name. |
java.util.SortedMap |
getObjEntityMap()
Returns a sorted unmodifiable map of ObjEntities contained in this DataMap, keyed by ObjEntity name. |
Procedure |
getProcedure(java.lang.String procedureName)
Returns a Procedure for a given name or null if no such procedure exists. |
java.util.SortedMap |
getProcedureMap()
Returns a sorted unmodifiable map of Procedures in this DataMap keyed by name. |
java.util.Collection |
getProcedures()
Returns stored procedures associated with this DataMap. |
java.util.Collection |
getQueries()
Returns an unmodifiable collection of mapped queries. |
Query |
getQuery(java.lang.String queryName)
Returns a named query associated with this DataMap. |
java.util.SortedMap |
getQueryMap()
|
void |
initWithProperties(java.util.Map properties)
Performs DataMap initialization from a set of properties, using defaults for the missing properties. |
boolean |
isClientSupported()
|
void |
mergeWithDataMap(DataMap map)
Adds all Object and DB entities and Queries from another map to this map. |
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 |
removeDbEntity(java.lang.String dbEntityName)
"Dirty" remove of the DbEntity from the data map. |
void |
removeDbEntity(java.lang.String dbEntityName,
boolean clearDependencies)
Removes DbEntity from the DataMap. |
void |
removeObjEntity(java.lang.String objEntityName)
"Dirty" remove of the ObjEntity from the data map. |
void |
removeObjEntity(java.lang.String objEntityName,
boolean clearDependencies)
Removes ObjEntity from the DataMap. |
void |
removeProcedure(java.lang.String name)
|
void |
removeQuery(java.lang.String queryName)
Removes a named query from the DataMap. |
void |
setClientSupported(boolean clientSupport)
|
void |
setDefaultClientPackage(java.lang.String defaultClientPackage)
|
void |
setDefaultLockType(int defaultLockType)
|
void |
setDefaultPackage(java.lang.String defaultPackage)
|
void |
setDefaultSchema(java.lang.String defaultSchema)
|
void |
setDefaultSuperclass(java.lang.String defaultSuperclass)
|
void |
setLocation(java.lang.String location)
Sets "location" property. |
void |
setName(java.lang.String name)
|
void |
setNamespace(MappingNamespace namespace)
Sets a parent namespace where this DataMap resides. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLIENT_SUPPORTED_PROPERTY
public static final java.lang.String DEFAULT_CLIENT_PACKAGE_PROPERTY
public static final java.lang.String DEFAULT_SCHEMA_PROPERTY
public static final java.lang.String DEFAULT_PACKAGE_PROPERTY
public static final java.lang.String DEFAULT_SUPERCLASS_PROPERTY
public static final java.lang.String DEFAULT_LOCK_TYPE_PROPERTY
protected java.lang.String name
protected java.lang.String location
protected MappingNamespace namespace
protected java.lang.String defaultSchema
protected java.lang.String defaultPackage
protected java.lang.String defaultSuperclass
protected int defaultLockType
protected boolean clientSupported
protected java.lang.String defaultClientPackage
Constructor Detail |
---|
public DataMap()
public DataMap(java.lang.String mapName)
public DataMap(java.lang.String mapName, java.util.Map properties)
Method Detail |
---|
public void initWithProperties(java.util.Map properties)
public DataMap getClientDataMap(EntityResolver serverResolver)
public void encodeAsXML(java.io.PrintWriter pw)
encodeAsXML(XMLEncoder)
stores DataMap assuming it is a part of a bigger
document.
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getName()
public void setName(java.lang.String name)
public void mergeWithDataMap(DataMap map)
TODO: will need to implement advanced merge that allows different policies for overwriting entities / queries.
public java.lang.String getLocation()
public void setLocation(java.lang.String location)
public java.util.SortedMap getObjEntityMap()
public java.util.SortedMap getDbEntityMap()
public Query getQuery(java.lang.String queryName)
getQuery
in interface MappingNamespace
public void addQuery(Query query)
public void removeQuery(java.lang.String queryName)
public void clearQueries()
public void clearObjEntities()
public void clearDbEntities()
public void clearProcedures()
public java.util.SortedMap getQueryMap()
public java.util.Collection getQueries()
getQueries
in interface MappingNamespace
public void addObjEntity(ObjEntity entity)
public void addDbEntity(DbEntity entity)
public java.util.Collection getObjEntities()
getObjEntities
in interface MappingNamespace
public java.util.Collection getObjEntities(boolean includeDeps)
includeDeps
is true
.
public java.util.Collection getDbEntities()
getDbEntities
in interface MappingNamespace
public DbEntity getDbEntity(java.lang.String dbEntityName)
name
parameter. No dependencies will
be searched.
getDbEntity
in interface MappingNamespace
public ObjEntity getObjEntityForJavaClass(java.lang.String javaClassName)
public ObjEntity getObjEntity(java.lang.String objEntityName)
getObjEntity
in interface MappingNamespace
public java.util.Collection getMappedEntities(DbEntity dbEntity)
public void removeDbEntity(java.lang.String dbEntityName)
public void removeDbEntity(java.lang.String dbEntityName, boolean clearDependencies)
clearDependencies
is true, all
DbRelationships that reference this entity are also removed. ObjEntities that rely
on this entity are cleaned up.
public void removeObjEntity(java.lang.String objEntityName)
public void removeObjEntity(java.lang.String objEntityName, boolean clearDependencies)
clearDependencies
is true,
all ObjRelationships that reference this entity are also removed.
public java.util.Collection getProcedures()
getProcedures
in interface MappingNamespace
public Procedure getProcedure(java.lang.String procedureName)
getProcedure
in interface MappingNamespace
public void addProcedure(Procedure procedure)
public void removeProcedure(java.lang.String name)
public java.util.SortedMap getProcedureMap()
public MappingNamespace getNamespace()
public void setNamespace(MappingNamespace namespace)
public int getDefaultLockType()
public void setDefaultLockType(int defaultLockType)
public boolean isClientSupported()
public void setClientSupported(boolean clientSupport)
public java.lang.String getDefaultClientPackage()
public void setDefaultClientPackage(java.lang.String defaultClientPackage)
public java.lang.String getDefaultPackage()
public void setDefaultPackage(java.lang.String defaultPackage)
public java.lang.String getDefaultSchema()
public void setDefaultSchema(java.lang.String defaultSchema)
public java.lang.String getDefaultSuperclass()
public void setDefaultSuperclass(java.lang.String defaultSuperclass)
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 dbAttributeChanged(AttributeEvent e)
dbAttributeChanged
in interface DbAttributeListener
public void dbAttributeAdded(AttributeEvent e)
dbAttributeAdded
in interface DbAttributeListener
public void dbAttributeRemoved(AttributeEvent e)
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 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |