-
- All Known Implementing Classes:
ModelImpl
public interface ModelModel singleton.- Author:
- harald
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclearModel()Clears the model.java.util.Collection<Entity>getAllEntitites()Gets all cached entities.EntitygetByClassId(int classId)Gets the entity by its id.EntitygetByEntityName(java.lang.String entityName)Gets the entity by its name.EntitygetByFileName(java.lang.String fileName)Gets the entity by the mapfile name.EntityFactorygetEntityFactory()Gets the entity factory singleton.java.util.Collection<ForeignKey>getForeignKeys()Gets all foreign keys.static ModelgetInstance()The singleton.booleanisSchemaNameMapped()Returns whether schema names are mapped.EntityloadByFileName(java.lang.String fileName, ModelDefaults defaults, EntityAliases aliases)Loads an entity for a given mapfile name.
Entities are cached so they are loaded and parsed only once.voidloadModel(java.lang.String modelDir, ModelDefaults defaults, EntityAliases aliases)Loads the whole model from the model directory if not yet done.voidrefreshModel()Refreshes the model.
Checks for changes and reloads if necessary.voidsetSchemaNameMapped(boolean mapSchemas)Sets whether schema names should be mapped to the leading part of tablenames.
-
-
-
Method Detail
-
getInstance
static Model getInstance()
The singleton.- Returns:
- the singleton
-
getEntityFactory
EntityFactory getEntityFactory()
Gets the entity factory singleton.- Returns:
- the entity model factory
-
loadModel
void loadModel(java.lang.String modelDir, ModelDefaults defaults, EntityAliases aliases) throws ModelExceptionLoads the whole model from the model directory if not yet done.- Parameters:
modelDir- the directory containing the model filesdefaults- optional model defaults, null if nonealiases- optional entity aliases, null if none- Throws:
ModelException- if the model is inconsistent
-
clearModel
void clearModel()
Clears the model.
-
setSchemaNameMapped
void setSchemaNameMapped(boolean mapSchemas)
Sets whether schema names should be mapped to the leading part of tablenames.- Parameters:
mapSchemas- true if map
-
isSchemaNameMapped
boolean isSchemaNameMapped()
Returns whether schema names are mapped.- Returns:
- true if mapped
-
refreshModel
void refreshModel() throws ModelExceptionRefreshes the model.
Checks for changes and reloads if necessary.- Throws:
ModelException- if the model is inconsistent
-
getAllEntitites
java.util.Collection<Entity> getAllEntitites() throws ModelException
Gets all cached entities.- Returns:
- all entities loaded so far
- Throws:
ModelException- if the model is inconsistent
-
getByFileName
Entity getByFileName(java.lang.String fileName) throws ModelException
Gets the entity by the mapfile name.- Parameters:
fileName- the name of the mapfile- Returns:
- the entity, null if no such entity
- Throws:
ModelException- if the model is inconsistent
-
getByEntityName
Entity getByEntityName(java.lang.String entityName) throws ModelException
Gets the entity by its name.- Parameters:
entityName- the name- Returns:
- the entity, null if no such entity
- Throws:
ModelException- if the model is inconsistent
-
getByClassId
Entity getByClassId(int classId) throws ModelException
Gets the entity by its id.- Parameters:
classId- the class id- Returns:
- the entity, null if no such entity
- Throws:
ModelException- if the model is inconsistent
-
loadByFileName
Entity loadByFileName(java.lang.String fileName, ModelDefaults defaults, EntityAliases aliases) throws ModelException
Loads an entity for a given mapfile name.
Entities are cached so they are loaded and parsed only once.- Parameters:
fileName- the name of the mapfiledefaults- optional model defaults, null if nonealiases- optional entity aliases, null if none- Returns:
- the entity
- Throws:
ModelException- if no such mapfile or parsing error
-
getForeignKeys
java.util.Collection<ForeignKey> getForeignKeys() throws ModelException
Gets all foreign keys.- Returns:
- the foreign keys
- Throws:
ModelException- if model is inconsistent
-
-