Class MessageDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
ru.bgcrm.dao.message.MessageDAO

public class MessageDAO extends CommonDAO
  • Constructor Details

  • Method Details

    • getMessageById

      public Message getMessageById(int id) throws BGException
      Throws:
      BGException
    • getUnreadIncomingMessageCount

      public int getUnreadIncomingMessageCount(int processId, int userId) throws BGException
      Количество непрочитанных конкретным пользователем входящих сообщений процесса (BPU-7152). Непрочитанное = входящее сообщение процесса, по которому нет строки в message_read для этого пользователя. Персонально: у разных пользователей счётчик разный. Отметку прочтения ставит markMessageRead(int, int).
      Parameters:
      processId - идентификатор процесса
      userId - идентификатор пользователя, для которого считаем непрочитанные
      Returns:
      число входящих сообщений процесса, ещё не прочитанных этим пользователем
      Throws:
      BGException
    • markMessageRead

      public void markMessageRead(int userId, int messageId) throws BGException
      Отметить сообщение прочитанным пользователем. Идемпотентно: повторный вызов не меняет время первого прочтения (INSERT IGNORE).
      Parameters:
      userId - кто прочитал
      messageId - что прочитал
      Throws:
      BGException
    • markProcessMessagesRead

      public int markProcessMessagesRead(int userId, int processId) throws BGException
      Отметить прочитанными все входящие сообщения процесса. Идемпотентно, как и markMessageRead(int, int): уже отмеченные сохраняют время первого прочтения.
      Parameters:
      userId - кто прочитал
      processId - процесс, чьи входящие отмечаются
      Returns:
      сколько сообщений отмечено этим вызовом
      Throws:
      BGException
    • getMessageBySystemId

      public Message getMessageBySystemId(int typeId, String systemId) throws BGException
      Throws:
      BGException
    • updateMessage

      public void updateMessage(Message message) throws BGException
      Throws:
      BGException
    • updateMessageProcess

      public void updateMessageProcess(Message message) throws BGException
      Throws:
      BGException
    • deleteMessage

      public void deleteMessage(int id) throws BGException
      Throws:
      BGException
    • getUnsendMessageList

      public List<Message> getUnsendMessageList(int type, int maxCount) throws BGException
      Throws:
      BGException
    • searchMessageList

      public void searchMessageList(SearchResult<Message> searchResult, Integer processId, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from) throws BGException
      Throws:
      BGException
    • searchMessageList

      public void searchMessageList(SearchResult<Message> searchResult, Integer processId, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder) throws BGException
      Throws:
      BGException
    • searchMessageList

      public void searchMessageList(SearchResult<Message> searchResult, Integer processId, List<Integer> typeIds, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder) throws BGException
      Throws:
      BGException
    • getProcessMessageList

      public List<Message> getProcessMessageList(int processId, int beforeMessageId) throws BGException
      Throws:
      BGException