Interface LDNMessageService

All Known Implementing Classes:
LDNMessageServiceImpl

public interface LDNMessageService
Service interface class for the LDNMessageEntity object.
Author:
Mohamed Eskander (mohamed.eskander at 4science dot it)
  • Method Details

    • find

      LDNMessageEntity find(Context context, String id) throws SQLException
      find the ldn message by id
      Parameters:
      context - the context
      id - the uri
      Returns:
      the ldn message by id
      Throws:
      SQLException - If something goes wrong in the database
    • findAll

      List<LDNMessageEntity> findAll(Context context) throws SQLException
      find all ldn messages
      Parameters:
      context - the context
      Returns:
      all ldn messages by id
      Throws:
      SQLException - If something goes wrong in the database
    • create

      LDNMessageEntity create(Context context, String id) throws SQLException
      Creates a new LDNMessage
      Parameters:
      context - The DSpace context
      id - the uri
      Returns:
      the created LDN Message
      Throws:
      SQLException - If something goes wrong in the database
    • create

      LDNMessageEntity create(Context context, Notification notification, String sourceIp) throws SQLException
      Creates a new LDNMessage
      Parameters:
      context - The DSpace context
      notification - the requested notification
      sourceIp - the source ip
      Returns:
      the created LDN Message
      Throws:
      SQLException - If something goes wrong in the database
    • update

      void update(Context context, LDNMessageEntity ldnMessage) throws SQLException
      Update the provided LDNMessage
      Parameters:
      context - The DSpace context
      ldnMessage - the LDNMessage
      Throws:
      SQLException - If something goes wrong in the database
    • findOldestMessagesToProcess

      List<LDNMessageEntity> findOldestMessagesToProcess(Context context) throws SQLException
      Find the oldest queued LDNMessages that still can be elaborated
      Parameters:
      context - The DSpace context
      Returns:
      list of LDN messages
      Throws:
      SQLException - If something goes wrong in the database
    • findProcessingTimedoutMessages

      List<LDNMessageEntity> findProcessingTimedoutMessages(Context context) throws SQLException
      Find all messages in the queue with the Processing status but timed-out
      Parameters:
      context - The DSpace context
      Returns:
      all the LDN Messages to be fixed on their queue_ attributes
      Throws:
      SQLException - If something goes wrong in the database
    • checkQueueMessageTimeout

      int checkQueueMessageTimeout(Context context) throws SQLException
      Find all messages in the queue with the Processing status but timed-out and modify their queue_status considering the queue_attempts
      Parameters:
      context - The DSpace context
      Returns:
      number of messages fixed
      Throws:
      SQLException
    • extractAndProcessMessageFromQueue

      int extractAndProcessMessageFromQueue(Context context) throws SQLException
      Elaborates the oldest enqueued message
      Parameters:
      context - The DSpace context
      Returns:
      number of messages fixed
      Throws:
      SQLException
    • findNotifyService

      NotifyServiceEntity findNotifyService(Context context, Service service) throws SQLException
      find the related notify service entity
      Parameters:
      context - the context
      service - the service
      Returns:
      the NotifyServiceEntity
      Throws:
      SQLException - if something goes wrong
    • findRequestsByItem

      NotifyRequestStatus findRequestsByItem(Context context, Item item) throws SQLException
      find the ldn messages of Requests by item uuid
      Parameters:
      context - the context
      item - the item
      Returns:
      the item requests object
      Throws:
      SQLException - If something goes wrong in the database
    • findEndorsementOrReviewResubmissionIdByItem

      String findEndorsementOrReviewResubmissionIdByItem(Context context, Item item, NotifyServiceEntity service) throws SQLException
      find the UUID of a previous tentativeReject notification associated with a new resubmission (Endorsement or Review patterns only)
      Parameters:
      context - the context
      item - the previousVersion item associated with a potential resubmission
      Returns:
      the UUID of a previous tentativeReject notification associated with a potential resubmission if found
      Throws:
      SQLException
    • delete

      void delete(Context context, LDNMessageEntity ldnMessage) throws SQLException
      delete the provided ldn message
      Parameters:
      context - the context
      ldnMessage - the ldn message
      Throws:
      SQLException - if something goes wrong
    • findMessagesToBeReprocessed

      List<LDNMessageEntity> findMessagesToBeReprocessed(Context context) throws SQLException
      find the ldn messages to be reprocessed
      Parameters:
      context - the context
      Throws:
      SQLException - if something goes wrong
    • isValidIp

      boolean isValidIp(NotifyServiceEntity origin, String sourceIp)
      check if IP number is included in the configured ip-range on the Notify Service
      Parameters:
      origin - the Notify Service entity
      sourceIp - the ip to evaluate
    • isTargetCurrent

      boolean isTargetCurrent(Notification notification)
      check if the notification is targeting the current system
      Parameters:
      notification - the LDN Message entity