Interface Model

  • All Known Implementing Classes:
    ModelImpl

    public interface Model
    Model singleton.
    Author:
    harald
    • 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 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

        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 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