Class EntityModelManager


  • public class EntityModelManager
    extends java.lang.Object
    Class that manages the Entity Models available to the Entity Manager. This class is instantiated in the PluginInit session bean class.
    Since:
    4.0.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addConnectorOfEntityModel​(com.priint.pubserver.entity.ConnectorOfEntityModel conmodel)
      Add a new ConnectorOfEntityModel
      void addEntity​(com.priint.pubserver.entity.EntityModel entityModel, com.priint.pubserver.entity.Entity entity)
      Add an Entity to the Entity Model Manager.
      void addModel​(com.priint.pubserver.entity.EntityModel entityModel)
      Add a model to the Entity Model Manager.
      java.util.List<com.priint.pubserver.entity.ConnectorOfEntityModel> getConnectorOfEntityModels()
      Get the List of Connectors and there assigned Entity Models
      java.util.Map<java.lang.String,​com.priint.pubserver.entity.Entity> getEntities()
      Get all entities of all models
      <T> T getEntity​(com.priint.pubserver.entity.EntityModel entityModel, java.lang.String entityIdentifier, java.lang.Class<T> entityType)
      Get an Entity of a special subclass from the Entity Model Manager
      <T> T getEntityByConnectorEntity​(java.lang.String entityModelIdentifier, java.lang.String connectorEntity, java.lang.Class<T> clazz)
      Get an Entity by the Connector Entity string
      com.priint.pubserver.entity.EntityModel getEntityModel​(java.lang.String entityModelIdentifier)
      Get an Entity Model from the Entity Model Manager.
      java.util.Map<java.lang.String,​com.priint.pubserver.entity.EntityModel> getEntityModels()
      Get all Entity Models from the Entity Model Manager
      <T> T getEntityNoEntityType​(com.priint.pubserver.entity.EntityModel entityModel, java.lang.String entityIdentifier)  
      com.priint.pubserver.entity.Entity getParentEntity​(java.lang.String modelId, java.lang.String childId)
      Get the (last) parent entity for an entity - if existing.
      java.util.List<com.priint.pubserver.entity.EntityBucket> getRootEntities​(java.lang.String entityModelIdentifier)
      Get a List of Entities that are set as root elements of the model
      void removeEntityModel​(java.lang.String entityModelIdentifier)
      Remove an Entity Model and its Entities from the Entity Model Manager
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EntityModelManager

        public EntityModelManager()
    • Method Detail

      • getEntityModels

        public java.util.Map<java.lang.String,​com.priint.pubserver.entity.EntityModel> getEntityModels()
        Get all Entity Models from the Entity Model Manager
        Returns:
        Map of Entity Models with identifier as key
      • getEntities

        public java.util.Map<java.lang.String,​com.priint.pubserver.entity.Entity> getEntities()
        Get all entities of all models
        Returns:
        Map of Entities with identifier as Key = <ModelIdentifier + EntityIdentifier>
      • addModel

        public void addModel​(com.priint.pubserver.entity.EntityModel entityModel)
        Add a model to the Entity Model Manager. Existing models will not be replaced.
        Parameters:
        entityModel - The Entity Model
      • getEntityModel

        public com.priint.pubserver.entity.EntityModel getEntityModel​(java.lang.String entityModelIdentifier)
        Get an Entity Model from the Entity Model Manager.
        Parameters:
        entityModelIdentifier - Identifier of the Entity Model
        Returns:
        The Entity Model or null if there is no model with this identifier.
      • addEntity

        public void addEntity​(com.priint.pubserver.entity.EntityModel entityModel,
                              com.priint.pubserver.entity.Entity entity)
        Add an Entity to the Entity Model Manager. Existing entities will not be replaced.
        Parameters:
        entityModel - The Entity Model
        entity - The Entity
      • getEntity

        public <T> T getEntity​(com.priint.pubserver.entity.EntityModel entityModel,
                               java.lang.String entityIdentifier,
                               java.lang.Class<T> entityType)
        Get an Entity of a special subclass from the Entity Model Manager
        Parameters:
        entityModel - The Entity Model
        entityIdentifier - Identifier of the Entity
        entityType - Entity Class of the Entity (e.g. EntityBucket.class).
        Returns:
        The Entity or null if entity not found or no instance of subclass.
      • getEntityNoEntityType

        public <T> T getEntityNoEntityType​(com.priint.pubserver.entity.EntityModel entityModel,
                                           java.lang.String entityIdentifier)
      • getEntityByConnectorEntity

        public <T> T getEntityByConnectorEntity​(java.lang.String entityModelIdentifier,
                                                java.lang.String connectorEntity,
                                                java.lang.Class<T> clazz)
        Get an Entity by the Connector Entity string
        Parameters:
        entityModelIdentifier - Identifier of the Entity Model
        connectorEntity - Connector Entity String
        clazz - Class of the Entity
        Returns:
        The Entity or null if no object with the connector string and entity type found in the model.
      • getRootEntities

        public java.util.List<com.priint.pubserver.entity.EntityBucket> getRootEntities​(java.lang.String entityModelIdentifier)
        Get a List of Entities that are set as root elements of the model
        Parameters:
        entityModelIdentifier - identifier of the Entity Model
        Returns:
        List of root entities of the model
      • removeEntityModel

        public void removeEntityModel​(java.lang.String entityModelIdentifier)
        Remove an Entity Model and its Entities from the Entity Model Manager
        Parameters:
        entityModelIdentifier -
      • getConnectorOfEntityModels

        public java.util.List<com.priint.pubserver.entity.ConnectorOfEntityModel> getConnectorOfEntityModels()
        Get the List of Connectors and there assigned Entity Models
        Returns:
        List<ConnectorOfEntityModel>
      • addConnectorOfEntityModel

        public void addConnectorOfEntityModel​(com.priint.pubserver.entity.ConnectorOfEntityModel conmodel)
        Add a new ConnectorOfEntityModel
        Parameters:
        conmodel - ConnectorOfEntityModel Object
      • getParentEntity

        public com.priint.pubserver.entity.Entity getParentEntity​(java.lang.String modelId,
                                                                  java.lang.String childId)
        Get the (last) parent entity for an entity - if existing.

        If an entity has more than one parent in a model one of these parents will be returned. It will always be the same as long as the entity model is not reloaded through a commit or reload of the plugin.

        Parameters:
        modelId -
        childId -
        Returns:
        parent entity or null