Interface Model

All Known Implementing Classes:
ModelImpl

public interface Model
Model singleton.
Author:
harald
  • Method Details

    • 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(String modelDir, ModelDefaults defaults, EntityAliases aliases) throws ModelException
      Loads the whole model from the model directory if not yet done.
      Parameters:
      modelDir - the directory containing the model files
      defaults - optional model defaults, null if none
      aliases - 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 ModelException
      Refreshes the model.
      Checks for changes and reloads if necessary.
      Throws:
      ModelException - if the model is inconsistent
    • getAllEntitites

      Collection<Entity> getAllEntitites() throws ModelException
      Gets all cached entities.
      Returns:
      all entities loaded so far
      Throws:
      ModelException - if the model is inconsistent
    • getByFilePath

      Entity getByFilePath(String filePath) throws ModelException
      Gets the entity by the mapfile path.
      Parameters:
      filePath - the pathname of the mapfile
      Returns:
      the entity, null if no such entity
      Throws:
      ModelException - if the model is inconsistent
    • getByTableName

      Entity getByTableName(String tableName) throws ModelException
      Gets the entity by its table name.
      Parameters:
      tableName - the table name (optional leading schema will be ignored)
      Returns:
      the entity, null if no such entity
      Throws:
      ModelException - if the model is inconsistent
    • getByEntityName

      Entity getByEntityName(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 class id.
      Parameters:
      classId - the class id
      Returns:
      the entity, null if no such entity
      Throws:
      ModelException - if the model is inconsistent
    • loadByFilePath

      Entity loadByFilePath(String filePath, 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:
      filePath - the path of the mapfile
      defaults - optional model defaults, null if none
      aliases - optional entity aliases, null if none
      Returns:
      the entity
      Throws:
      ModelException - if no such mapfile or parsing error
    • getForeignKeys

      Collection<ForeignKey> getForeignKeys() throws ModelException
      Gets all foreign keys.
      Returns:
      the foreign keys
      Throws:
      ModelException - if model is inconsistent