Class StorageService

java.lang.Object
com.persequor.saga.modules.compliance.services.StorageService

public class StorageService extends Object
  • Method Details

    • getStatus

      public Optional<ComplianceServiceReply> getStatus(UUID sagaEventId, String complianceRepository, String replyIdentifier)
      Deprecated.
    • getReply

      public Optional<ComplianceServiceReply> getReply(UUID sagaEventId, String complianceRepository, String replyIdentifier)
      Gets the compliance reply stored, based on the event ID, the ID of the compliance repository and the ID of the reply itself.
      Returns:
      an optional containing the reply
    • getStatuses

      public ComplianceServiceReplyList getStatuses(UUID sagaEventId, String complianceRepository)
      Refactor:
      Rename to getReplies()
    • getStatuses

      public ComplianceServiceReplyList getStatuses(UUID sagaEventId)
      Refactor:
      Rename to getReplies()
    • getMappedStatuses

      public Map<String,ComplianceServiceReplyList> getMappedStatuses(UUID sagaEventId)
      Refactor:
      Rename to getRepliesByRepository()
    • convertToComplianceServiceReply

      public ComplianceServiceReply convertToComplianceServiceReply(UUID sagaEventId, ComplianceReply s)
    • getLatestStatuses

      public ComplianceServiceReplyList getLatestStatuses(UUID sagaEventId)
      Parameters:
      sagaEventId - Event's SAGA event id
      Returns:
      The compliance replies that are related to a given event

      This method will return the latest reply (by message type) that was caused by attempting to send a message to a repository. If no attempts were made, it will return the latest reply (by message type).

    • getLatestStatus

      public Optional<ComplianceServiceReply> getLatestStatus(UUID sagaEventId, String complianceRepository)
      Parameters:
      sagaEventId - Event's SAGA event id
      complianceRepository - Compliance Repository name
      Returns:
      The compliance reply that is related to a given event

      This method will return the latest reply that was caused by attempting to send a message to a repository. If no attempts were made, it will return the latest reply.

    • getLatestStatus

      public Optional<ComplianceServiceReply> getLatestStatus(UUID sagaEventId, String complianceRepository, Set<IMessageType> messageTypes)
      Parameters:
      sagaEventId - Event's SAGA event id
      complianceRepository - Compliance Repository name
      messageTypes - Message types
      Returns:
      The compliance reply that is related to a given event and at least one of the message types

      This method will return the latest reply (by message type) that was caused by attempting to send a message to a repository. If no attempts were made, it will return the latest reply (by message type).

    • getLatestStatus

      public Optional<ComplianceServiceReply> getLatestStatus(UUID sagaEventId, String complianceRepository, String... messageTypes)
      Parameters:
      sagaEventId - Event's SAGA event id
      complianceRepository - Compliance Repository name
      messageTypes - Message types
      Returns:
      The compliance reply that is related to a given event and at least one of the message types

      This method will return the latest reply (by message type) that was caused by attempting to send a message to a repository. If no attempts were made, it will return the latest reply (by message type).

    • isLatestStatus

      public boolean isLatestStatus(UUID sagaEventId, String complianceRepository, IMessageType messageType, Predicate<MessageStatus> expectedStatus)
      This method takes an event SAGA id, a compliance repository name, a target message type and an expected status that is asserted against the event's latest status
      Parameters:
      sagaEventId - Event's saga event id
      complianceRepository - Compliance Repository name
      messageType - Message types
      expectedStatus - Status to be use as filter
      Returns:
      Assert that the latest status is the expected status
    • store

      public void store(ComplianceRepositoryReply status)
    • revert

      public void revert(UUID sagaEventId, String repositoryId, String replyIdentifier)
    • getDominantComplianceRepliesByEventType

      public Map<UUID,Map<String,Map<String,IComplianceServiceReply>>> getDominantComplianceRepliesByEventType(Collection<UUID> sagaEventIds, List<String> regulations)
      Parameters:
      sagaEventIds -
      regulations -
      Returns:
      Dictionary with most dominant reply Map of EventId, Map of Regulation, Map of Type, Reply
    • getReplyToDominantReducer

      public ReplyToDominantReducer getReplyToDominantReducer()
    • getDominantComplianceReplies

      public Map<UUID,Map<String,IComplianceServiceReply>> getDominantComplianceReplies(Collection<UUID> sagaEventIds, List<String> regulations)
    • getLatestReplyPerEventByRegulationAndMessageType

      public Map<UUID,IComplianceServiceReply> getLatestReplyPerEventByRegulationAndMessageType(Set<UUID> sagaEventIds, String regulation, String messageType)