Class MongoNodeService

java.lang.Object
org.saidone.component.BaseComponent
org.saidone.service.MongoNodeService
All Implemented Interfaces:
NodeService, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Service public class MongoNodeService extends BaseComponent implements NodeService
Default NodeService implementation that persists node metadata using a MongoNodeRepositoryImpl. It throws NodeNotFoundOnVaultException when a requested node is not present in the repository.
  • Constructor Details

    • MongoNodeService

      public MongoNodeService()
  • Method Details

    • save

      public void save(NodeWrapperDto nodeWrapper)
      Persists the given wrapped node metadata.

      This implementation simply delegates to CrudRepository.save(Object) after mapping the DTO to the persistence entity.

      Specified by:
      save in interface NodeService
      Parameters:
      nodeWrapper - the node wrapper to store
    • findById

      public NodeWrapperDto findById(String nodeId)
      Retrieves the stored node wrapper by its identifier.
      Specified by:
      findById in interface NodeService
      Parameters:
      nodeId - the Alfresco node identifier
      Returns:
      the stored NodeWrapperDto
      Throws:
      NodeNotFoundOnVaultException - if the node does not exist
    • findByArchiveDateRange

      public org.springframework.data.domain.Page<NodeWrapperDto> findByArchiveDateRange(Instant from, Instant to, org.springframework.data.domain.Pageable pageable)
      Retrieves node wrappers archived within the specified date range using pagination. Both bounds are inclusive. Passing null for one of the parameters will make the range open-ended on that side.
      Specified by:
      findByArchiveDateRange in interface NodeService
      Parameters:
      from - the lower bound of the archive date range, inclusive
      to - the upper bound of the archive date range, inclusive
      pageable - pagination information
      Returns:
      page of NodeWrapperDto
    • findNotarized

      public org.springframework.data.domain.Page<NodeWrapperDto> findNotarized(org.springframework.data.domain.Pageable pageable)
      Retrieves notarized node wrappers using pagination.

      This implementation delegates to MongoNodeRepositoryImpl.findNotarized(Pageable).

      Specified by:
      findNotarized in interface NodeService
      Parameters:
      pageable - pagination information
      Returns:
      page of notarized NodeWrapperDto
    • countNotarized

      public long countNotarized()
      Description copied from interface: NodeService
      Counts nodes that have already been notarized.
      Specified by:
      countNotarized in interface NodeService
      Returns:
      number of notarized nodes
    • findNotarizedRandom

      public List<NodeWrapperDto> findNotarizedRandom(int size)
      Description copied from interface: NodeService
      Retrieves a random sample of notarized nodes.
      Specified by:
      findNotarizedRandom in interface NodeService
      Parameters:
      size - maximum number of nodes to return
      Returns:
      random notarized nodes
    • findByNtx

      public Iterable<NodeWrapperDto> findByNtx(String ntx)
      Retrieves all node wrappers having the given notarization transaction ID. A null transaction ID is used to select nodes that have not yet been notarized.
      Specified by:
      findByNtx in interface NodeService
      Parameters:
      ntx - the notarization transaction ID to filter by
      Returns:
      iterable collection of NodeWrapperDto
    • findByKv

      public Iterable<NodeWrapperDto> findByKv(int kv)
      Retrieves all node wrappers associated with the specified encryption key version.
      Specified by:
      findByKv in interface NodeService
      Parameters:
      kv - the encryption key version to filter by
      Returns:
      iterable collection of NodeWrapperDto
    • findAll

      public Iterable<NodeWrapperDto> findAll()
      Retrieves all stored node wrappers.

      The returned iterable is backed by the underlying repository and reflects the current state of the vault.

      Specified by:
      findAll in interface NodeService
      Returns:
      iterable collection of NodeWrapperDto
    • deleteById

      public void deleteById(String nodeId)
      Deletes the node wrapper identified by the given ID.
      Specified by:
      deleteById in interface NodeService
      Parameters:
      nodeId - the Alfresco node identifier