Package fr.cesi.chat.domain

Examples of fr.cesi.chat.domain.Message


   * @return
   */
  @RequestMapping(value = "/sendMessage", method = RequestMethod.POST, produces = "application/json")
  public @ResponseBody
  Message post(@RequestBody final Message message) {
    Message message2 = new Message(Utils.getDateNow(), user, null, message.getMessage(), Event.ALL_CLIENTS);
    clientService.sendMessage(output, message2);
    return message;
  }
View Full Code Here


   */
  @RequestMapping(value = "/getMessages", method = RequestMethod.GET, produces = "application/json")
  public @ResponseBody
  Message get(HttpServletResponse res) {
    List<Message> messages = client.getClientThreadServerResponseMessage().getMessages();
    Message message = null;
    if (!messages.isEmpty()) {
      message = messages.remove(0);
    }
    return message;
  }
View Full Code Here

    String newNickname = userUpdated.getNickname();
    String oldNickname = user.getNickname();
    String concatNickname = oldNickname + "," + newNickname;

    userUpdated.setNickname(concatNickname);
    Message message2 = new Message(Utils.getDateNow(), userUpdated, "", null, Event.CHANGING_USERNAME);
    clientService.sendMessage(output, message2);

    // On set le nouveau nickname dans la variable global user
    String ip = user.getIp();
    String nickanme = user.getNickname();
View Full Code Here

   * @return
   */
  @RequestMapping(value = "/updateStatusUser", method = RequestMethod.POST, produces = "application/json")
  public @ResponseBody
  User postUpdateStatusUser(@RequestBody final User userUpdated, ModelAndView model) {
    Message message = new Message(Utils.getDateNow(), userUpdated, "", null, Event.CHANGING_STATUS_USERNAME);
    clientService.sendMessage(output, message);
    // On set le nouveau nickname dans la variable global user
    user.setStatut(userUpdated.getStatut());
    return new User(user.getNickname(), user.getStatut(), user.getIp());
  }
View Full Code Here

   * @param model
   * @return
   */
  @RequestMapping(value = "/deconnexion", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
  public ModelAndView deconnexion() {
    Message message2 = new Message(Utils.getDateNow(), user, "", null, Event.DELETING_USERNAME);
    clientService.sendMessage(output, message2);
    // client.closeConnection(); // On ferme les connexions
    ModelAndView model = new ModelAndView(REDIRECT_ROOT);
    model.getModelMap().addAttribute("statuts", Statut.values());
    return model;
View Full Code Here

  }

  public void insert10Messages() {
    MessagesHistoryMongo conect = new MessagesHistoryMongo();
    Statut statut = Statut.EN_LIGNE;
    Message message1 = new Message();
    message1.setMessage("comment vas-tu?");
    message1.setUserFrom(new User("benoit", statut, "192.168.1.1"));
    message1.setUserTo("florian");
    message1.setEvent(Event.ALL_CLIENTS);
    message1.setDate(new Date(1394743482).toString());

    conect.saveMessage(message1);

    Statut statut2 = Statut.ABSENT;
    Message message2 = new Message();
    message2.setMessage("bien et toi");
    message2.setUserFrom(new User("florian", statut2, "192.168.1.2"));
    message2.setUserTo("Benoit");
    message2.setEvent(Event.ONE_CLIENT);
    message2.setDate(new Date(1394829882).toString());
 

    conect.saveMessage(message2);

    Message message3 = new Message();
    message3.setMessage("cool raoul");
    message3.setUserFrom(new User("antho", statut, "192.168.1.3"));
    message3.setUserTo("All");
    message3.setEvent(Event.ALL_CLIENTS);
    message3.setDate(new Date(1394916282).toString());

    conect.saveMessage(message3);

    Message message4 = new Message();
    message4.setMessage("on se fait un mac DO");
    message4.setUserFrom(new User("benoit", statut, "192.168.1.1"));
    message4.setUserTo("florian");
    message4.setEvent(Event.ALL_CLIENTS);
    message4.setDate(new Date(1395002682).toString());

    conect.saveMessage(message4);

    Message message5 = new Message();
    message5.setMessage("ou un kebab");
    message5.setUserFrom(new User("florian", statut, "192.168.1.2"));
    message5.setUserTo("all");
    message5.setEvent(Event.ALL_CLIENTS);
    message5.setDate(new Date(1395089082).toString());

    conect.saveMessage(message5);

    Message message6 = new Message();
    message6.setMessage("pour moi mc do c'est cool!");
    message6.setUserFrom(new User("antho", statut, "192.168.1.3"));
    message6.setUserTo("all");
    message6.setEvent(Event.ALL_CLIENTS);
    message6.setDate(new Date(1395175482).toString());

    conect.saveMessage(message6);

    Message message7 = new Message();
    message7.setMessage("bon ben mc do");
    message7.setUserFrom(new User("florian", statut, "192.168.1.2"));
    message7.setUserTo("all");
    message7.setEvent(Event.ALL_CLIENTS);
    message7.setDate(new Date(1395261882).toString());

    conect.saveMessage(message7);

    Message message8 = new Message();
    message8.setMessage("on prend quelle voiture?");
    message8.setUserFrom(new User("florian", statut, "192.168.1.2"));
    message8.setUserTo("all");
    message8.setEvent(Event.ALL_CLIENTS);
    message8.setDate(new Date(1395348282).toString());

    conect.saveMessage(message8);

    Message message9 = new Message();
    message9.setMessage("la mienne c'est bon");
    message9.setUserFrom(new User("benoit", statut, "192.168.1.1"));
    message9.setUserTo("all");
    message9.setEvent(Event.ALL_CLIENTS);
    message9.setDate(new Date(1395434682).toString());
   
    conect.saveMessage(message9);

    Message message10 = new Message();
    message10.setMessage("allez go en B! on va les avoir");
    message10.setUserFrom(new User("florian", statut, "192.168.1.2"));
    message10.setUserTo("all");
    message10.setEvent(Event.ALL_CLIENTS);
    message10.setDate(new Date(1395521082).toString());
   
    conect.saveMessage(message10);
  }
View Full Code Here

TOP

Related Classes of fr.cesi.chat.domain.Message

Copyright © 2018 www.massapicom. 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.