Examples of Room


Examples of org.apache.openmeetings.db.entity.room.Room

    if (ap.getRemind() == null && !remindTypes.isEmpty()) {
      ap.setRemind(remindTypes.get(0));
    }
   
    Room r = new Room();
    if (!roomTypes.isEmpty()) {
      r.setRoomtype(roomTypes.get(0));
    }
    r.setAppointment(true);
    ap.setRoom(r);
    return ap;
  }
View Full Code Here

Examples of org.apache.openmeetings.persistence.beans.room.Room

      if (currentModList.size() > 0) {
        return 2L;
      } else {
        // No moderator in this room at the moment
        Room room = roomDao.get(currentClient.getRoom_id());

        if (room.getIsModeratedRoom()) {
          return 3L;
        } else {
          return 1L;
        }
      }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0045_muc.model.Room

    }

    public void testEnterRoom() throws Exception {
        chat.join("Nick");

        Room room = conference.findRoom(TestUtil.parseUnchecked(ROOM_JID));
        assertEquals(1, room.getOccupantCount());
        Occupant occupant = room.getOccupants().iterator().next();
        assertEquals(TEST_USERNAME1, occupant.getJid().getBareJID().getFullQualifiedName());
        assertEquals("Nick", occupant.getName());
       
       
        final BlockingQueue<String> joinedQueue = new LinkedBlockingQueue<String>();
        chat.addParticipantStatusListener(new ParticipantStatusListenerAdapter() {
           
            @Override
            public void joined(String participant) {
                joinedQueue.add(participant);
            }
        });
        chat2.join("Nick2");
        assertEquals(2, room.getOccupantCount());

        // chat should be notified
        assertEquals(ROOM_JID + "/Nick2", joinedQueue.poll(5000, TimeUnit.MILLISECONDS));
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0045_muc.model.Room

   
    public void testExitRoom() throws Exception {
        chat.join("Nick");
        chat2.join("Nick2");

        Room room = conference.findRoom(TestUtil.parseUnchecked(ROOM_JID));
        assertEquals(2, room.getOccupantCount());
       
        final BlockingQueue<String> leftQueue = new LinkedBlockingQueue<String>();
        chat.addParticipantStatusListener(new ParticipantStatusListenerAdapter() {
            @Override
            public void left(String participant) {
                leftQueue.add(participant);
            }
        });

       
        chat2.leave();
       
        // wait for status update
        assertEquals(ROOM_JID + "/Nick2", leftQueue.poll(5000, TimeUnit.MILLISECONDS));
        assertEquals(1, room.getOccupantCount());

    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0045_muc.model.Room

            if(roomWithNickJid.getResource() != null) {
                return createMessageErrorStanza(roomJid, from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.BAD_REQUEST, stanza);
            }
           
            logger.debug("Received groupchat message to {}", roomJid);
            Room room = conference.findRoom(roomJid);
            if(room != null) {
                Occupant sendingOccupant = room.findOccupantByJID(from);
               
                // sender must be participant in room
                if(sendingOccupant != null) {
                   
                    Entity roomAndSendingNick = new EntityImpl(room.getJID(), sendingOccupant.getName());
                    if(sendingOccupant.hasVoice()) {
                        // relay message to all occupants in room
                       
                        try {
                            if(stanza.getSubjects() != null && !stanza.getSubjects().isEmpty()) {
                                // subject message
                                if(!room.isRoomType(RoomType.OpenSubject) && !sendingOccupant.isModerator()) {
                                    // room only allows moderators to change the subject, and sender is not a moderator
                                    return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.AUTH, StanzaErrorCondition.FORBIDDEN, stanza);
                                }
                            }
                        } catch (XMLSemanticError e) {
                            // not a subject message, ignore exception
                        }
                       
                        logger.debug("Relaying message to all room occupants");
                        for(Occupant occupent : room.getOccupants()) {
                            logger.debug("Relaying message to  {}", occupent);
                            List<Attribute> replaceAttributes = new ArrayList<Attribute>();
                            replaceAttributes.add(new Attribute("from", roomAndSendingNick.getFullQualifiedName()));
                            replaceAttributes.add(new Attribute("to", occupent.getJid().getFullQualifiedName()));
                           
                            relayStanza(occupent.getJid(),
                                    StanzaBuilder.createClone(stanza, true, replaceAttributes).build(),
                                    serverRuntimeContext);
                           
                        }
                       
                        // add to discussion history
                        room.getHistory().append(stanza, sendingOccupant);
                    } else {
                        return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.FORBIDDEN, stanza);
                    }
                } else {
                    return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.NOT_ACCEPTABLE, stanza);
                }
            } else {
                return createMessageErrorStanza(moduleDomain, from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.ITEM_NOT_FOUND, stanza);
            }
        } else if(type == null  || type == MessageStanzaType.CHAT || type == MessageStanzaType.NORMAL) {
            // private message
            logger.debug("Received direct message to {}", roomWithNickJid);
            Room room = conference.findRoom(roomJid);
            if(room != null) {
                Occupant sendingOccupant = room.findOccupantByJID(from);
               
                // sender must be participant in room
                    if(roomWithNickJid.isResourceSet()) {
                        if(sendingOccupant != null) {
                            // got resource, private message for occupant
                            Occupant receivingOccupant = room.findOccupantByNick(roomWithNickJid.getResource());
                           
                            // must be sent to an existing occupant in the room
                            if(receivingOccupant != null) {
                               
                                Entity roomAndSendingNick = new EntityImpl(room.getJID(), sendingOccupant.getName());
                                logger.debug("Relaying message to  {}", receivingOccupant);
                                List<Attribute> replaceAttributes = new ArrayList<Attribute>();
                                replaceAttributes.add(new Attribute("from", roomAndSendingNick.getFullQualifiedName()));
                                replaceAttributes.add(new Attribute("to", receivingOccupant.getJid().getFullQualifiedName()));
                               
                                relayStanza(receivingOccupant.getJid(),
                                        StanzaBuilder.createClone(stanza, true, replaceAttributes).build(),
                                        serverRuntimeContext);
                            } else {
                                // TODO correct error?
                                return createMessageErrorStanza(moduleDomain, from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.ITEM_NOT_FOUND, stanza);
                            }
                        } else {
                            // user must be occupant to send direct message
                            return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.NOT_ACCEPTABLE, stanza);
                        }
                    } else {
                        X x = X.fromStanza(stanza);
                        if(x != null && x.getInvite() != null) {
                            if(sendingOccupant != null) {
                                // invite, forward modified invite
                                try {
                                    Stanza invite = MUCHandlerHelper.createInviteMessageStanza(stanza, room.getPassword());
                                    relayStanza(invite.getTo(), invite, serverRuntimeContext);
                                } catch (EntityFormatException e) {
                                    // invalid format of invite element
                                    return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.JID_MALFORMED, stanza);
                                }
                            } else {
                                // user must be occupant to send invite
                                return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.NOT_ACCEPTABLE, stanza);
                            }
                        } else if(x != null && x.getDecline() != null) {
                            // invite, forward modified decline
                            try {
                                Stanza decline = MUCHandlerHelper.createDeclineMessageStanza(stanza);
                                relayStanza(decline.getTo(), decline, serverRuntimeContext);
                            } catch (EntityFormatException e) {
                                // invalid format of invite element
                                return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.JID_MALFORMED, stanza);
                            }
                        } else {
                            return createMessageErrorStanza(room.getJID(), from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.UNEXPECTED_REQUEST, stanza);
                        }
                }
            } else {
                return createMessageErrorStanza(moduleDomain, from, stanza.getID(), StanzaErrorType.MODIFY, StanzaErrorCondition.ITEM_NOT_FOUND, stanza);
            }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0045_muc.model.Room

    protected StanzaHandler createHandler() {
        return new MUCPresenceHandler(conference);
    }
   
    public void testChangeNick() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        room.addOccupant(OCCUPANT1_JID, "nick");
        room.addOccupant(OCCUPANT2_JID, "nick 2");

        changeNick(OCCUPANT1_JID, new EntityImpl(ROOM1_JID, "new nick"));
       
        Occupant occupant = room.findOccupantByJID(OCCUPANT1_JID);
        assertEquals("new nick", occupant.getName());

        Item unavailbleItem = new Item(OCCUPANT1_JID, "new nick", Affiliation.None, Role.Participant);
        assertPresenceStanza(occupant1Queue.getNext(), new EntityImpl(ROOM1_JID, "nick"), OCCUPANT1_JID, "unavailable",
                Arrays.asList(unavailbleItem), Arrays.asList(StatusCode.NEW_NICK, StatusCode.OWN_PRESENCE));
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0045_muc.model.Room

        assertPresenceStanza(occupant2Queue.getNext(), new EntityImpl(ROOM1_JID, "new nick"), OCCUPANT2_JID, null,
                Arrays.asList(availbleItem), null);
    }
   
    public void testChangeNickWithDuplicateNick() throws Exception {
        Room room = conference.findRoom(ROOM1_JID);
        room.addOccupant(OCCUPANT1_JID, "nick");
        room.addOccupant(OCCUPANT2_JID, "nick 2");
       
        Stanza error = changeNick(OCCUPANT1_JID, new EntityImpl(ROOM1_JID,"nick 2"));
       
        assertNotNull(error);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0045_muc.model.Room

public class MUCSubjectMessageHandlerTestCase extends AbstractMUCMessageHandlerTestCase {

    private static final String SUBJECT = "Subject";

    public void testChangeSubjectNonModeratorAllowed() throws Exception {
        Room room = conference.findOrCreateRoom(ROOM2_JID, "Room 2", RoomType.OpenSubject);
        room.addOccupant(OCCUPANT1_JID, "nick");
        room.addOccupant(OCCUPANT2_JID, "Nick 2");

        // send message to room
        assertNull(sendMessage(OCCUPANT1_JID, ROOM2_JID, GROUPCHAT, null, null, SUBJECT));

        // verify stanzas to existing occupants on the exiting user
View Full Code Here

Examples of org.dozer.vo.deep.Room

    Van van = newInstance(Van.class);
    van.setName("van");
    van.setTestValue("testValue");
    house.setVan(van);

    Room living = newInstance(Room.class);
    living.setName("Living");
    Room kitchen = newInstance(Room.class);
    kitchen.setName("kitchen");

    List<Room> rooms = newInstance(ArrayList.class);
    rooms.add(living);
    rooms.add(kitchen);
View Full Code Here

Examples of org.dozer.vo.deep.Room

    mapper.map(dest, src);
    // cumulative relationship
    int[] prims = { 1, 2, 3, 1, 2, 3 };
    houseClone.getOwner().setPrim(prims);
    // add two more rooms
    Room room1 = new Room();
    room1.setName("Living");
    Room room2 = new Room();
    room2.setName("kitchen");
    Van van = new Van();
    van.setName("van2");
    houseClone.getRooms().add(room1);
    houseClone.getRooms().add(room2);
    houseClone.getCustomSetGetMethod().add(van);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.