Class MongoMucDAO

  • All Implemented Interfaces:
    tigase.db.DataSourceAware<MongoDataSource>, tigase.muc.repository.IMucDAO<MongoDataSource,​byte[]>

    public class MongoMucDAO
    extends tigase.muc.repository.AbstractMucDAO<MongoDataSource,​byte[]>
    Created by andrzej on 20.10.2016.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.mongodb.client.MongoCollection<org.bson.Document> roomAffilaitionsCollection  
      protected com.mongodb.client.MongoCollection<org.bson.Document> roomsCollection  
    • Constructor Summary

      Constructors 
      Constructor Description
      MongoMucDAO()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected byte[] calculateHash​(java.lang.String user)  
      byte[] createRoom​(tigase.muc.RoomWithId<byte[]> room)  
      void destroyRoom​(tigase.xmpp.jid.BareJID roomJID)  
      protected byte[] generateId​(tigase.xmpp.jid.BareJID user)  
      java.util.Map<tigase.xmpp.jid.BareJID,​tigase.muc.RoomAffiliation> getAffiliations​(tigase.muc.RoomWithId<byte[]> room)  
      tigase.muc.RoomWithId<byte[]> getRoom​(tigase.xmpp.jid.BareJID roomJID)  
      java.lang.String getRoomAvatar​(tigase.muc.RoomWithId<byte[]> room)  
      java.util.ArrayList<tigase.xmpp.jid.BareJID> getRoomsJIDList()  
      void setAffiliation​(tigase.muc.RoomWithId<byte[]> room, tigase.xmpp.jid.BareJID jid, tigase.muc.RoomAffiliation affiliation)  
      void setDataSource​(MongoDataSource dataSource)  
      void setSubject​(tigase.muc.RoomWithId<byte[]> room, java.lang.String subject, java.lang.String creatorNickname, java.util.Date changeDate)  
      void updateRoomAvatar​(tigase.muc.RoomWithId<byte[]> room, java.lang.String encodedAvatar, java.lang.String hash)  
      void updateRoomConfig​(tigase.muc.RoomConfig roomConfig)  
      • Methods inherited from class tigase.muc.repository.AbstractMucDAO

        parseConfigElement
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • roomAffilaitionsCollection

        protected com.mongodb.client.MongoCollection<org.bson.Document> roomAffilaitionsCollection
      • roomsCollection

        protected com.mongodb.client.MongoCollection<org.bson.Document> roomsCollection
    • Constructor Detail

      • MongoMucDAO

        public MongoMucDAO()
    • Method Detail

      • calculateHash

        protected byte[] calculateHash​(java.lang.String user)
                                throws tigase.db.TigaseDBException
        Throws:
        tigase.db.TigaseDBException
      • createRoom

        public byte[] createRoom​(tigase.muc.RoomWithId<byte[]> room)
                          throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • destroyRoom

        public void destroyRoom​(tigase.xmpp.jid.BareJID roomJID)
                         throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • generateId

        protected byte[] generateId​(tigase.xmpp.jid.BareJID user)
                             throws tigase.db.TigaseDBException
        Throws:
        tigase.db.TigaseDBException
      • getAffiliations

        public java.util.Map<tigase.xmpp.jid.BareJID,​tigase.muc.RoomAffiliation> getAffiliations​(tigase.muc.RoomWithId<byte[]> room)
                                                                                                throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • getRoom

        public tigase.muc.RoomWithId<byte[]> getRoom​(tigase.xmpp.jid.BareJID roomJID)
                                              throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • getRoomsJIDList

        public java.util.ArrayList<tigase.xmpp.jid.BareJID> getRoomsJIDList()
                                                                     throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • setAffiliation

        public void setAffiliation​(tigase.muc.RoomWithId<byte[]> room,
                                   tigase.xmpp.jid.BareJID jid,
                                   tigase.muc.RoomAffiliation affiliation)
                            throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • setDataSource

        public void setDataSource​(MongoDataSource dataSource)
      • getRoomAvatar

        public java.lang.String getRoomAvatar​(tigase.muc.RoomWithId<byte[]> room)
                                       throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • updateRoomAvatar

        public void updateRoomAvatar​(tigase.muc.RoomWithId<byte[]> room,
                                     java.lang.String encodedAvatar,
                                     java.lang.String hash)
                              throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • setSubject

        public void setSubject​(tigase.muc.RoomWithId<byte[]> room,
                               java.lang.String subject,
                               java.lang.String creatorNickname,
                               java.util.Date changeDate)
                        throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException
      • updateRoomConfig

        public void updateRoomConfig​(tigase.muc.RoomConfig roomConfig)
                              throws tigase.component.exceptions.RepositoryException
        Throws:
        tigase.component.exceptions.RepositoryException