Example #1
0
    def createChatroom(cls, obj, params):
        """ Inserts the object in the database according to all the kind of indexing types, in this case:
        -Chat rooms by conference
        -Chat rooms by user
        -Chat rooms by name (to check if there's already a chat room with that name in our XMPP server)
        -Chat rooms by ID (to access faster to the object when querying)
        """
        room = params['room']

        conference = params['conference']

        # index by conference id
        confIndex = IndexByConf()
        room.setId(DBHelpers.newID())
        confIndex.index(conference.getId(), room)

        # Index by chat room's name
        crNameIndex = IndexByCRName()
        crNameIndex.index(room)

        # Index by id
        idIndex = IndexByID()
        idIndex.index(room)

        # Index by room creator
        userIndex = IndexByUser()
        userIndex.index(room.getOwner().getId(), room)
Example #2
0
    def createChatroom(cls, obj, params):
        """ Inserts the object in the database according to all the kind of indexing types, in this case:
        -Chat rooms by conference
        -Chat rooms by user
        -Chat rooms by name (to check if there's already a chat room with that name in our XMPP server)
        -Chat rooms by ID (to access faster to the object when querying)
        """
        room = params['room']

        conference = params['conference']

        # index by conference id
        confIndex = IndexByConf()
        room.setId(DBHelpers.newID())
        confIndex.index(conference.getId(), room)

        # Index by chat room's name
        crNameIndex = IndexByCRName()
        crNameIndex.index(room)

        # Index by id
        idIndex = IndexByID()
        idIndex.index(room)

        # Index by room creator
        userIndex = IndexByUser()
        userIndex.index(room.getOwner().getId(), room)
Example #3
0
 def editChatroom(self, obj, params):
     oldTitle = params['oldTitle']
     newRoom = params['newRoom']
     #we have an index by the chat room name. If, while editing, someone changes the chat room name, we'll have to update the index
     if oldTitle != newRoom.getTitle():
         #the title has been changed. Get rid of the old index and substitute it for the new one
         crNameIndex = IndexByCRName()
         crNameIndex.unindex(newRoom, oldTitle)
         crNameIndex.index(newRoom)
Example #4
0
    def editChatroom(self, obj, params):
        oldTitle = params['oldTitle']
        newRoom = params['newRoom']
        userId = params['userId']

        #we have an index by the chat room name. If, while editing, someone changes the chat room name, we'll have to update the index
        if oldTitle != newRoom.getTitle():
            #the title has been changed. Get rid of the old index and substitute it for the new one
            crNameIndex = IndexByCRName()
            crNameIndex.unindex(newRoom, oldTitle)
            crNameIndex.index(newRoom)

            # For dynamic loading this needs to be in alphabetical order,
            # therefore reindex on change.
            userIndex = IndexByUser()
            userIndex.reindex(userId, newRoom, oldTitle)
Example #5
0
    def editChatroom(self, obj, params):
        oldTitle = params['oldTitle']
        newRoom = params['newRoom']
        userId = params['userId']

        #we have an index by the chat room name. If, while editing, someone changes the chat room name, we'll have to update the index
        if oldTitle != newRoom.getTitle():
            #the title has been changed. Get rid of the old index and substitute it for the new one
            crNameIndex = IndexByCRName()
            crNameIndex.unindex(newRoom, oldTitle)
            crNameIndex.index(newRoom)

            # For dynamic loading this needs to be in alphabetical order,
            # therefore reindex on change.
            userIndex = IndexByUser()
            userIndex.reindex(userId, newRoom, oldTitle)