public class DataMap extends Object implements Serializable, ConfigurationNode, XMLSerializable, MappingNamespace, DbEntityListener, ObjEntityListener, Comparable<DataMap>
| Modifier and Type | Field and Description |
|---|---|
static String |
CLIENT_SUPPORTED_PROPERTY
Defines whether a DataMap supports client entities.
|
protected boolean |
clientSupported |
protected Resource |
configurationSource |
protected DataChannelDescriptor |
dataChannelDescriptor |
static String |
DEFAULT_CATALOG_PROPERTY
Defines the name of the property for default DB catalog.
|
static String |
DEFAULT_CLIENT_PACKAGE_PROPERTY
Defines the name of the property for default client Java class package.
|
static String |
DEFAULT_CLIENT_SUPERCLASS_PROPERTY
Defines the name of the property for default client Java superclass.
|
static String |
DEFAULT_LOCK_TYPE_PROPERTY
Defines the name of the property for default DB schema.
|
static String |
DEFAULT_PACKAGE_PROPERTY
Defines the name of the property for default Java class package.
|
static String |
DEFAULT_QUOTE_SQL_IDENTIFIERS_PROPERTY |
static String |
DEFAULT_SCHEMA_PROPERTY
Defines the name of the property for default DB schema.
|
static String |
DEFAULT_SUPERCLASS_PROPERTY
Defines the name of the property for default Java superclass.
|
protected String |
defaultCatalog |
protected String |
defaultClientPackage |
protected String |
defaultClientSuperclass |
protected int |
defaultLockType |
protected String |
defaultPackage |
protected String |
defaultSchema |
protected String |
defaultSuperclass |
protected String |
location |
protected String |
name |
protected MappingNamespace |
namespace |
protected Boolean |
quotingSQLIdentifiers |
static String |
SCHEMA_XSD
The namespace in which the data map XML file will be created.
|
static String |
SCHEMA_XSD_LOCATION |
| Constructor and Description |
|---|
DataMap()
Creates a new unnamed DataMap.
|
DataMap(String mapName)
Creates a new named DataMap.
|
DataMap(String mapName,
Map<String,Object> properties) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
acceptVisitor(ConfigurationNodeVisitor<T> visitor) |
void |
addDbEntity(DbEntity entity)
Adds a new DbEntity to this DataMap.
|
void |
addDefaultEntityListener(EntityListener listener)
Deprecated.
since 4.0 unused as listeners are no longer tied to a
DataMap.
|
void |
addEmbeddable(Embeddable embeddable)
Adds an embeddable object to the 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 |
addQueryDescriptor(QueryDescriptor queryDescriptor)
Stores a query descriptor under its name.
|
void |
addResult(SQLResult result)
Adds a named SQLResultSet to the DataMap.
|
void |
clear() |
void |
clearDbEntities() |
void |
clearEmbeddables()
Removes all stored embeddable objects from the map.
|
void |
clearObjEntities() |
void |
clearProcedures() |
void |
clearQueries() |
void |
clearResultSets() |
int |
compareTo(DataMap o) |
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 |
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.
|
Resource |
getConfigurationSource() |
DataChannelDescriptor |
getDataChannelDescriptor() |
Collection<DbEntity> |
getDbEntities()
Returns all DbEntities in this DataMap.
|
DbEntity |
getDbEntity(String dbEntityName)
Returns DbEntity matching the
name parameter. |
SortedMap<String,DbEntity> |
getDbEntityMap()
Returns a sorted unmodifiable map of DbEntities contained in this
DataMap, keyed by DbEntity name.
|
String |
getDefaultCatalog() |
String |
getDefaultClientPackage()
Returns default client package.
|
String |
getDefaultClientSuperclass()
Returns default client superclass.
|
EntityListener |
getDefaultEntityListener(String className)
Deprecated.
since 4.0 unused, as listeners are no longer tied to a
DataMap.
|
List<EntityListener> |
getDefaultEntityListeners()
Deprecated.
since 4.0 unused as listeners are no longer tied to a
DataMap.
|
int |
getDefaultLockType() |
String |
getDefaultPackage() |
String |
getDefaultSchema() |
String |
getDefaultSuperclass() |
Embeddable |
getEmbeddable(String className)
Returns an
Embeddable matching class name or null if such
Embeddable is not mapped. |
Map<String,Embeddable> |
getEmbeddableMap() |
Collection<Embeddable> |
getEmbeddables()
Returns a collection of
Embeddable mappings stored in the
DataMap. |
EntityInheritanceTree |
getInheritanceTree(String entityName) |
String |
getLocation()
Returns "location" property value.
|
Collection<ObjEntity> |
getMappedEntities(DbEntity dbEntity)
Returns all ObjEntities mapped to the given DbEntity.
|
String |
getName()
Returns the name of this DataMap.
|
MappingNamespace |
getNamespace()
Returns a parent namespace where this DataMap resides.
|
String |
getNameWithDefaultClientPackage(String name) |
String |
getNameWithDefaultPackage(String name) |
static String |
getNameWithPackage(String pack,
String name) |
Collection<ObjEntity> |
getObjEntities()
Returns an unmodifiable collection of ObjEntities stored in this DataMap.
|
ObjEntity |
getObjEntity(Class<?> entityClass) |
ObjEntity |
getObjEntity(Persistent object) |
ObjEntity |
getObjEntity(String objEntityName)
Returns an ObjEntity for a given name.
|
ObjEntity |
getObjEntityForJavaClass(String javaClassName)
Returns an ObjEntity for a DataObject class name.
|
SortedMap<String,ObjEntity> |
getObjEntityMap()
Returns a sorted unmodifiable map of ObjEntities contained in this
DataMap, keyed by ObjEntity name.
|
Procedure |
getProcedure(String procedureName)
Returns a Procedure for a given name or null if no such procedure exists.
|
SortedMap<String,Procedure> |
getProcedureMap()
Returns a sorted unmodifiable map of Procedures in this DataMap keyed by
name.
|
Collection<Procedure> |
getProcedures()
Returns stored procedures associated with this DataMap.
|
QueryDescriptor |
getQueryDescriptor(String queryName)
Returns a named query associated with this DataMap.
|
SortedMap<String,QueryDescriptor> |
getQueryDescriptorMap() |
Collection<QueryDescriptor> |
getQueryDescriptors()
Returns an unmodifiable collection of mapped queries.
|
SQLResult |
getResult(String name)
Returns a named result set mapping.
|
Collection<SQLResult> |
getResults() |
Map<String,SQLResult> |
getResultsMap() |
Map<String,ObjEntity> |
getSubclassesForObjEntity(ObjEntity superEntity) |
void |
initWithProperties(Map<String,Object> properties)
Performs DataMap initialization from a set of properties, using defaults
for the missing properties.
|
boolean |
isClientSupported() |
boolean |
isQuotingSQLIdentifiers() |
void |
mergeWithDataMap(DataMap map)
Adds all Object and DB entities and Queries from another map to this map.
|
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 |
removeDbEntity(String dbEntityName)
"Dirty" remove of the DbEntity from the data map.
|
void |
removeDbEntity(String dbEntityName,
boolean clearDependencies)
Removes DbEntity from the DataMap.
|
void |
removeDefaultEntityListener(String className)
Deprecated.
since 4.0 unused as listeners are no longer tied to a
DataMap.
|
void |
removeEmbeddable(String className)
Removes an
Embeddable descriptor with matching class name. |
void |
removeObjEntity(String objEntityName)
"Dirty" remove of the ObjEntity from the data map.
|
void |
removeObjEntity(String objEntityName,
boolean clearDependencies)
Removes ObjEntity from the DataMap.
|
void |
removeProcedure(String name) |
void |
removeQueryDescriptor(String queryName)
Removes a named query from the DataMap.
|
void |
removeResult(String name) |
void |
setClientSupported(boolean clientSupport) |
void |
setConfigurationSource(Resource configurationSource) |
void |
setDataChannelDescriptor(DataChannelDescriptor dataChannelDescriptor) |
void |
setDefaultCatalog(String defaultCatalog) |
void |
setDefaultClientPackage(String defaultClientPackage) |
void |
setDefaultClientSuperclass(String defaultClientSuperclass) |
void |
setDefaultLockType(int defaultLockType) |
void |
setDefaultPackage(String defaultPackage) |
void |
setDefaultSchema(String defaultSchema) |
void |
setDefaultSuperclass(String defaultSuperclass) |
void |
setLocation(String location)
Sets "location" property.
|
void |
setName(String name)
Set the name of this DataMap.
|
void |
setNamespace(MappingNamespace namespace)
Sets a parent namespace where this DataMap resides.
|
void |
setQuotingSQLIdentifiers(boolean quotingSqlIdentifiers) |
String |
toString() |
public static final String CLIENT_SUPPORTED_PROPERTY
public static final String DEFAULT_CLIENT_PACKAGE_PROPERTY
public static final String DEFAULT_CLIENT_SUPERCLASS_PROPERTY
public static final String DEFAULT_CATALOG_PROPERTY
public static final String DEFAULT_SCHEMA_PROPERTY
public static final String DEFAULT_PACKAGE_PROPERTY
public static final String DEFAULT_SUPERCLASS_PROPERTY
public static final String DEFAULT_LOCK_TYPE_PROPERTY
public static final String DEFAULT_QUOTE_SQL_IDENTIFIERS_PROPERTY
public static final String SCHEMA_XSD
public static final String SCHEMA_XSD_LOCATION
protected String name
protected String location
protected MappingNamespace namespace
protected Boolean quotingSQLIdentifiers
protected String defaultCatalog
protected String defaultSchema
protected String defaultPackage
protected String defaultSuperclass
protected int defaultLockType
protected boolean clientSupported
protected String defaultClientPackage
protected String defaultClientSuperclass
protected transient Resource configurationSource
protected DataChannelDescriptor dataChannelDescriptor
public DataMap()
public DataMap(String mapName)
public DataChannelDescriptor getDataChannelDescriptor()
public void setDataChannelDescriptor(DataChannelDescriptor dataChannelDescriptor)
public <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
acceptVisitor in interface ConfigurationNodepublic int compareTo(DataMap o)
compareTo in interface Comparable<DataMap>public boolean isQuotingSQLIdentifiers()
public void setQuotingSQLIdentifiers(boolean quotingSqlIdentifiers)
public void initWithProperties(Map<String,Object> properties)
public DataMap getClientDataMap(EntityResolver serverResolver)
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML in interface XMLSerializablepublic String getName()
public void setName(String name)
public void mergeWithDataMap(DataMap map)
TODO: will need to implement advanced merge that allows different policies for overwriting entities / queries.
public String getLocation()
public void setLocation(String location)
public SortedMap<String,ObjEntity> getObjEntityMap()
public SortedMap<String,DbEntity> getDbEntityMap()
public QueryDescriptor getQueryDescriptor(String queryName)
getQueryDescriptor in interface MappingNamespacepublic void addQueryDescriptor(QueryDescriptor queryDescriptor)
public void removeQueryDescriptor(String queryName)
public void clearEmbeddables()
public void clearResultSets()
public void clearQueries()
public void clearObjEntities()
public void clearDbEntities()
public void clearProcedures()
public SortedMap<String,QueryDescriptor> getQueryDescriptorMap()
public Collection<QueryDescriptor> getQueryDescriptors()
getQueryDescriptors in interface MappingNamespacepublic void addEmbeddable(Embeddable embeddable)
public void addResult(SQLResult result)
public void addObjEntity(ObjEntity entity)
public void addDbEntity(DbEntity entity)
public Collection<ObjEntity> getObjEntities()
getObjEntities in interface MappingNamespacepublic Map<String,Embeddable> getEmbeddableMap()
public Collection<Embeddable> getEmbeddables()
Embeddable mappings stored in the
DataMap.getEmbeddables in interface MappingNamespacepublic Collection<SQLResult> getResults()
getResults in interface MappingNamespacepublic Embeddable getEmbeddable(String className)
MappingNamespaceEmbeddable matching class name or null if such
Embeddable is not mapped.getEmbeddable in interface MappingNamespacepublic SQLResult getResult(String name)
MappingNamespacegetResult in interface MappingNamespace@Deprecated public List<EntityListener> getDefaultEntityListeners()
EntityListener objects.
Note that since the order of listeners is significant a list, not just a
generic Collection is returned.@Deprecated public void addDefaultEntityListener(EntityListener listener)
IllegalArgumentException - if a listener for the same class name is already registered.@Deprecated public void removeDefaultEntityListener(String className)
@Deprecated public EntityListener getDefaultEntityListener(String className)
public Collection<DbEntity> getDbEntities()
getDbEntities in interface MappingNamespacepublic DbEntity getDbEntity(String dbEntityName)
name parameter. No
dependencies will be searched.getDbEntity in interface MappingNamespacepublic ObjEntity getObjEntityForJavaClass(String javaClassName)
public ObjEntity getObjEntity(String objEntityName)
getObjEntity in interface MappingNamespacepublic Collection<ObjEntity> getMappedEntities(DbEntity dbEntity)
public void removeEmbeddable(String className)
Embeddable descriptor with matching class name.public void removeResult(String name)
public void removeDbEntity(String dbEntityName)
public void removeDbEntity(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(String objEntityName)
public void removeObjEntity(String objEntityName, boolean clearDependencies)
clearDependencies is
true, all ObjRelationships that reference this entity are also removed.public Collection<Procedure> getProcedures()
getProcedures in interface MappingNamespacepublic Procedure getProcedure(String procedureName)
getProcedure in interface MappingNamespacepublic void addProcedure(Procedure procedure)
public void removeProcedure(String name)
public SortedMap<String,Procedure> 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 String getDefaultClientPackage()
public void setDefaultClientPackage(String defaultClientPackage)
public String getDefaultClientSuperclass()
public void setDefaultClientSuperclass(String defaultClientSuperclass)
public String getDefaultPackage()
public void setDefaultPackage(String defaultPackage)
public String getDefaultSchema()
public void setDefaultSchema(String defaultSchema)
public String getDefaultSuperclass()
public void setDefaultSuperclass(String defaultSuperclass)
public void dbEntityChanged(EntityEvent e)
dbEntityChanged in interface DbEntityListenerpublic void dbEntityAdded(EntityEvent e)
dbEntityAdded in interface DbEntityListenerpublic void dbEntityRemoved(EntityEvent e)
dbEntityRemoved in interface DbEntityListenerpublic void objEntityChanged(EntityEvent e)
objEntityChanged in interface ObjEntityListenerpublic void objEntityAdded(EntityEvent e)
objEntityAdded in interface ObjEntityListenerpublic void objEntityRemoved(EntityEvent e)
objEntityRemoved in interface ObjEntityListenerpublic Resource getConfigurationSource()
public void setConfigurationSource(Resource configurationSource)
public String getDefaultCatalog()
public void setDefaultCatalog(String defaultCatalog)
public EntityInheritanceTree getInheritanceTree(String entityName)
getInheritanceTree in interface MappingNamespacepublic ObjEntity getObjEntity(Class<?> entityClass)
getObjEntity in interface MappingNamespacepublic ObjEntity getObjEntity(Persistent object)
getObjEntity in interface MappingNamespacepublic void clear()
public String getNameWithDefaultPackage(String name)
public static String getNameWithPackage(String pack, String name)
public String getNameWithDefaultClientPackage(String name)
name - Copyright © 2001–2023 Apache Cayenne. All rights reserved.