Class SqlEntityStorePlugin

  • All Implemented Interfaces:
    io.vertigo.core.node.component.CoreComponent, io.vertigo.core.node.component.Plugin, EntityStorePlugin

    public final class SqlEntityStorePlugin
    extends Object
    implements EntityStorePlugin
    This class is the basic implementation of the dataStore in the sql way.
    Author:
    pchretien
    • Constructor Detail

      • SqlEntityStorePlugin

        @Inject
        public SqlEntityStorePlugin​(Optional<String> optDataSpace,
                                    Optional<String> optConnectionName,
                                    Optional<String> optSequencePrefix,
                                    TaskManager taskManager,
                                    SqlManager sqlManager)
        Constructor.
        Parameters:
        optDataSpace - the dataSpace (option)
        optConnectionName - the name of the connection
        optSequencePrefix - the prefix of sequences
        taskManager - the taskManager
        sqlManager - the sqlDataBaseManager
    • Method Detail

      • readNullable

        public <E extends Entity> E readNullable​(DtDefinition dtDefinition,
                                                 UID<E> uri)
        Récupération de l'objet correspondant à l'URI fournie.
        Specified by:
        readNullable in interface EntityStorePlugin
        Type Parameters:
        E - the type of entity
        Parameters:
        dtDefinition - Definition
        uri - UID de l'objet à charger
        Returns:
        D correspondant à l'URI fournie.
      • findAll

        public <E extends EntityDtList<E> findAll​(DtDefinition dtDefinition,
                                                    DtListURIForNNAssociation dtcUri)
        Récupération d'une liste correspondant à l'URI fournie. NOT NULL
        Specified by:
        findAll in interface EntityStorePlugin
        Type Parameters:
        E - the type of entity
        Parameters:
        dtDefinition - Definition
        dtcUri - UID de la collection à charger
        Returns:
        DtList Liste correspondant à l'URI fournie
      • findAll

        public <E extends EntityDtList<E> findAll​(DtDefinition dtDefinition,
                                                    DtListURIForSimpleAssociation dtcUri)
        Récupération d'une liste correspondant à l'URI fournie. NOT NULL
        Specified by:
        findAll in interface EntityStorePlugin
        Type Parameters:
        E - the type of entity
        Parameters:
        dtDefinition - Definition
        dtcUri - UID de la collection à charger
        Returns:
        DtList Liste correspondant à l'URI fournie
      • findByCriteria

        public <E extends EntityDtList<E> findByCriteria​(DtDefinition dtDefinition,
                                                           Criteria<E> criteria,
                                                           DtListState dtListState)
        Finds a lists of entities matching a criteria.
        Specified by:
        findByCriteria in interface EntityStorePlugin
        Parameters:
        dtDefinition - the definition of entities to find
        criteria - the criteria to match
        dtListState - listState of rows to retrieve
        Returns:
        the list
      • create

        public <E extends Entity> E create​(DtDefinition dtDefinition,
                                           E entity)
        Creates an object. No object with the same id must have been created previously.
        Specified by:
        create in interface EntityStorePlugin
        Parameters:
        dtDefinition - Definition
        entity - Object to create
        Returns:
        the created entity
      • update

        public void update​(DtDefinition dtDefinition,
                           Entity entity)
        Updates an object. This object must have an id.
        Specified by:
        update in interface EntityStorePlugin
        Parameters:
        dtDefinition - Definition
        entity - Object to update
      • delete

        public void delete​(DtDefinition dtDefinition,
                           UID uri)
        Deletes an object identified by an uri.
        Specified by:
        delete in interface EntityStorePlugin
        Parameters:
        dtDefinition - Definition
        uri - UID
      • count

        public int count​(DtDefinition dtDefinition)
        Returns the number of elements contained in the definition.
        Specified by:
        count in interface EntityStorePlugin
        Parameters:
        dtDefinition - Définition de DT
        Returns:
        the number of elements
      • readNullableForUpdate

        public <E extends Entity> E readNullableForUpdate​(DtDefinition dtDefinition,
                                                          UID<?> uri)
        Loads for update.
        Specified by:
        readNullableForUpdate in interface EntityStorePlugin
        Type Parameters:
        E - the type of entity
        Parameters:
        dtDefinition - Object's definition
        uri - Object's uid
        Returns:
        D Object value.