Package ru.bgcrm.dao.message
Class MessageDAO
java.lang.Object
ru.bgcrm.dao.CommonDAO
ru.bgcrm.dao.message.MessageDAO
- Direct Known Subclasses:
MessageSearchDAO
Message DAO.
-
Nested Class Summary
Nested classes/interfaces inherited from class ru.bgcrm.dao.CommonDAO
CommonDAO.ObjectExtractor<T>, CommonDAO.RecordUpdater<T extends Id>
-
Field Summary
Fields inherited from class ru.bgcrm.dao.CommonDAO
con, log, SQL_AND, SQL_DELETE, SQL_DELETE_FROM, SQL_DESC, SQL_DISTINCT, SQL_FROM, SQL_GROUP_BY, SQL_INNER_JOIN, SQL_INSERT_IGNORE, SQL_INSERT_INTO, SQL_LEFT_JOIN, SQL_LIMIT, SQL_ON_DUP_KEY_UPDATE, SQL_ORDER_BY, SQL_REPLACE, SQL_SELECT, SQL_SELECT_ALL_FROM, SQL_SELECT_COUNT_ROWS, SQL_SET, SQL_UNION_ALL, SQL_UPDATE, SQL_VALUES, SQL_WHERE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteMessage
(int id) Deletes all message related entities and attached files.void
deleteProcessMessages
(int processId) Delete process related messages and all related to them entities.static String
getMessageById
(int id) Selects a message by ID.getMessageBySystemId
(int typeId, String systemId) Selects a message by system ID.static Message
getMessageFromRs
(ResultSet rs, String prefix) getMessageTags
(int messageId) Selects message tags.getProcessMessageList
(int processId, int beforeMessageId) Retrieves process message list, sorted by ID.getProcessMessageList
(Set<Integer> processIds, String text) Searches messages in processes.getProcessMessageTagMap
(int processId) getProcessMessageTagMap
(Collection<Integer> processIds) getUnsendMessageList
(int type, int maxCount) void
searchMessageList
(Pageable<Message> searchResult, Integer processId, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from) Deprecated.void
searchMessageList
(Pageable<Message> searchResult, Integer processId, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder) Deprecated.void
searchMessageList
(Pageable<Message> searchResult, Integer processId, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder, Set<Integer> tagIds) Deprecated.void
searchMessageList
(Pageable<Message> searchResult, Collection<Integer> processIds, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder, Set<Integer> tagIds) Deprecated.void
searchMessageList
(Pageable<Message> searchResult, Collection<Integer> processIds, Set<Integer> typeIds, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder, Set<Integer> tagIds) Deprecated.void
toggleMessageTags
(int messageId, Set<Integer> tagIds, boolean add) Adds or removes message tagsvoid
updateMessage
(Message message) Updates message entity.void
updateMessageProcess
(Message message) Marks a message as processed (related to process).void
updateMessageTags
(int messageId, Set<Integer> tagIds, boolean positiveOnly) Updates message tagsMethods inherited from class ru.bgcrm.dao.CommonDAO
deleteById, foundRows, getById, getGroupedIds, getGroupedIds, getIds, getIds, getPageLimit, getPeriodSql, lastInsertId, setPeriodParamValue, setRecordCount, update, updateColumn, updateIds, updateIds, updateOrInsert
-
Constructor Details
-
MessageDAO
-
MessageDAO
-
-
Method Details
-
getMessageById
Selects a message by ID.- Parameters:
id
-- Returns:
- Throws:
SQLException
-
getMessageBySystemId
Selects a message by system ID.- Parameters:
typeId
-systemId
-- Returns:
- Throws:
SQLException
-
updateMessage
Updates message entity.- Parameters:
message
-- Throws:
SQLException
-
updateMessageProcess
Marks a message as processed (related to process).- Parameters:
message
-- Throws:
SQLException
-
updateMessageTags
public void updateMessageTags(int messageId, Set<Integer> tagIds, boolean positiveOnly) throws SQLException Updates message tags- Parameters:
messageId
- the message IDtagIds
- the tag IDspositiveOnly
- only positive tags will be deleted before insertion- Throws:
SQLException
-
toggleMessageTags
Adds or removes message tags- Parameters:
messageId
- the message IDtagIds
- the tag IDsadd
- add or delete- Throws:
SQLException
-
getMessageTags
Selects message tags.- Parameters:
messageId
-- Returns:
- Throws:
SQLException
-
deleteMessage
Deletes all message related entities and attached files.- Parameters:
id
- the message ID.- Throws:
SQLException
Exception
-
deleteProcessMessages
Delete process related messages and all related to them entities.- Parameters:
processId
- process ID.- Throws:
SQLException
-
getUnsendMessageList
-
searchMessageList
@Deprecated public void searchMessageList(Pageable<Message> searchResult, Integer processId, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from) Deprecated.UseMessageSearchDAO
. -
searchMessageList
@Deprecated public void searchMessageList(Pageable<Message> searchResult, Integer processId, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder) Deprecated.UseMessageSearchDAO
. -
searchMessageList
@Deprecated public void searchMessageList(Pageable<Message> searchResult, Integer processId, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder, Set<Integer> tagIds) Deprecated.UseMessageSearchDAO
. -
searchMessageList
@Deprecated public void searchMessageList(Pageable<Message> searchResult, Collection<Integer> processIds, Integer typeId, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder, Set<Integer> tagIds) Deprecated.UseMessageSearchDAO
. -
searchMessageList
@Deprecated public void searchMessageList(Pageable<Message> searchResult, Collection<Integer> processIds, Set<Integer> typeIds, Integer direction, Boolean processed, Boolean withAttach, Date dateFrom, Date dateTo, String from, boolean reverseOrder, Set<Integer> tagIds) Deprecated.UseMessageSearchDAO
. -
getProcessMessageList
Retrieves process message list, sorted by ID.- Parameters:
processId
- process ID.beforeMessageId
- if > 0 - filter from message ID.- Returns:
- Throws:
Exception
-
getProcessMessageTagMap
- Throws:
SQLException
-
getProcessMessageTagMap
public Map<Integer,Set<Integer>> getProcessMessageTagMap(Collection<Integer> processIds) throws SQLException - Throws:
SQLException
-
getProcessMessageList
Searches messages in processes.- Parameters:
processIds
- process IDs.text
- message substring.- Returns:
- Throws:
Exception
-
getIsolationJoin
-
getMessageFromRs
- Throws:
SQLException
-