Class JDBCMessageArchiveRepository<Q extends QueryCriteria>

    • Field Detail

      • ADD_MESSAGE_QUERY

        @ConfigField(desc="Query to add message to store",
                     alias="add-message-query")
        protected java.lang.String ADD_MESSAGE_QUERY
      • ADD_TAG_TO_MESSAGE_QUERY

        @ConfigField(desc="Query to add tag to message in store",
                     alias="add-tag-to-message-query")
        protected java.lang.String ADD_TAG_TO_MESSAGE_QUERY
      • DELETE_EXPIRED_MESSAGES_QUERY

        @ConfigField(desc="Query to delete expired messages",
                     alias="delete-expired-messages-query")
        protected java.lang.String DELETE_EXPIRED_MESSAGES_QUERY
      • GET_COLLECTIONS_COUNT_QUERY

        @ConfigField(desc="Query to retrieve number of collections",
                     alias="get-collections-count-query")
        protected java.lang.String GET_COLLECTIONS_COUNT_QUERY
      • GET_COLLECTIONS_QUERY

        @ConfigField(desc="Query to retrieve list of collections",
                     alias="get-collections-query")
        protected java.lang.String GET_COLLECTIONS_QUERY
      • GET_MESSAGES_COUNT_QUERY

        @ConfigField(desc="Query to retrieve number of messages",
                     alias="get-messages-count-query")
        protected java.lang.String GET_MESSAGES_COUNT_QUERY
      • GET_MESSAGES_QUERY

        @ConfigField(desc="Query to retrieve list of messages",
                     alias="get-messages-query")
        protected java.lang.String GET_MESSAGES_QUERY
      • GET_MESSAGE_POSITION_QUERY

        @ConfigField(desc="Query to retrieve message possition",
                     alias="get-message-position-query")
        protected java.lang.String GET_MESSAGE_POSITION_QUERY
      • GET_TAGS_FOR_USER_COUNT_QUERY

        @ConfigField(desc="Query to retrieve number of tags used by user",
                     alias="get-tags-for-user-count-query")
        protected java.lang.String GET_TAGS_FOR_USER_COUNT_QUERY
      • GET_TAGS_FOR_USER_QUERY

        @ConfigField(desc="Query to retrieve tags used by user",
                     alias="get-tags-for-user-query")
        protected java.lang.String GET_TAGS_FOR_USER_QUERY
      • REMOVE_MESSAGES_QUERY

        @ConfigField(desc="Query to remove messages",
                     alias="remove-messages-query")
        protected java.lang.String REMOVE_MESSAGES_QUERY
      • data_repo

        protected tigase.db.DataRepository data_repo
    • Constructor Detail

      • JDBCMessageArchiveRepository

        public JDBCMessageArchiveRepository()
    • Method Detail

      • setDataSource

        public void setDataSource​(tigase.db.DataRepository data_repo)
        Specified by:
        setDataSource in interface tigase.db.DataSourceAware<Q extends QueryCriteria>
      • archiveMessage

        public void archiveMessage​(tigase.xmpp.jid.BareJID owner,
                                   tigase.xmpp.jid.JID buddy,
                                   java.util.Date timestamp,
                                   tigase.xml.Element msg,
                                   java.lang.String stableId,
                                   java.util.Set<java.lang.String> tags)
        Specified by:
        archiveMessage in interface MessageArchiveRepository<Q extends QueryCriteria,​tigase.db.DataRepository>
      • deleteExpiredMessages

        public void deleteExpiredMessages​(tigase.xmpp.jid.BareJID owner,
                                          java.time.LocalDateTime before)
                                   throws tigase.db.TigaseDBException
        Specified by:
        deleteExpiredMessages in interface MessageArchiveRepository<Q extends QueryCriteria,​tigase.db.DataRepository>
        Throws:
        tigase.db.TigaseDBException
      • getStableId

        public java.lang.String getStableId​(tigase.xmpp.jid.BareJID owner,
                                            tigase.xmpp.jid.BareJID buddy,
                                            java.lang.String stanzaId)
                                     throws tigase.db.TigaseDBException
        Specified by:
        getStableId in interface MessageArchiveRepository<Q extends QueryCriteria,​tigase.db.DataRepository>
        Throws:
        tigase.db.TigaseDBException
      • queryItems

        public void queryItems​(Q crit,
                               tigase.xmpp.mam.MAMRepository.ItemHandler<Q,​tigase.xmpp.mam.MAMRepository.Item> itemHandler)
                        throws tigase.db.TigaseDBException,
                               tigase.component.exceptions.ComponentException
        Specified by:
        queryItems in interface tigase.xmpp.mam.MAMRepository<Q extends QueryCriteria,​tigase.xmpp.mam.MAMRepository.Item>
        Throws:
        tigase.db.TigaseDBException
        tigase.component.exceptions.ComponentException
      • removeItems

        public void removeItems​(tigase.xmpp.jid.BareJID owner,
                                java.lang.String withJid,
                                java.util.Date start,
                                java.util.Date end)
                         throws tigase.db.TigaseDBException
        Specified by:
        removeItems in interface MessageArchiveRepository<Q extends QueryCriteria,​tigase.db.DataRepository>
        Throws:
        tigase.db.TigaseDBException
      • getTags

        public java.util.List<java.lang.String> getTags​(tigase.xmpp.jid.BareJID owner,
                                                        java.lang.String startsWith,
                                                        Q crit)
                                                 throws tigase.db.TigaseDBException
        Specified by:
        getTags in interface MessageArchiveRepository<Q extends QueryCriteria,​tigase.db.DataRepository>
        Throws:
        tigase.db.TigaseDBException
      • setItemsQueryParams

        public void setItemsQueryParams​(java.sql.PreparedStatement stmt,
                                        Q crit,
                                        FasteningCollation fasteningCollation)
                                 throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • newQuery

        public Q newQuery()
        Specified by:
        newQuery in interface tigase.xmpp.mam.MAMRepository<Q extends QueryCriteria,​tigase.xmpp.mam.MAMRepository.Item>
      • initPreparedStatements

        protected void initPreparedStatements​(tigase.db.DataRepository data_repo)
                                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • convertToTimestamp

        protected java.sql.Timestamp convertToTimestamp​(java.util.Date date)
      • setCountQueryParams

        protected int setCountQueryParams​(java.sql.PreparedStatement stmt,
                                          Q crit,
                                          FasteningCollation fasteningCollation)
                                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setQueryParams

        protected int setQueryParams​(java.sql.PreparedStatement stmt,
                                     Q crit,
                                     FasteningCollation fasteningCollation)
                              throws java.sql.SQLException
        Throws:
        java.sql.SQLException