Package com.tmm.enterprise.microblog.domain

Examples of com.tmm.enterprise.microblog.domain.Person


    controller.setActivityService(activityService);
    controller.setAccountService(accountService);
    controller.setNotificationService(notificationService);
    controller.setJsonService(jsonService);

    p = new Person();
    p.setRole(UserRole.MEMBER);
    p.setId(1l);

    acc = new Account();
    acc.setUserProfile(p);
View Full Code Here


   * @param recipId
   * @throws ButterflyException
   */
  @Transactional
  public void sendEmail(String senderUserName, String msg, String recipId) throws ButterflyException {
    Person recipient = null;
    Account senderAcc = accountService.loadAccountByUserName(senderUserName);
    Person sender = senderAcc.getUserProfile();
    try {
      Long id = Long.parseLong(recipId);
      recipient = contactService.loadPerson(id);
    } catch (Exception e) {
      throw new ButterflyException(ButterflyExceptionCode.USER002_INVALIDUSERID, "Invalid recipient ID provided - ID must be numeric", e);
    }

    PrivateMessage pm = new PrivateMessage();
    pm.setDetails(msg);
    pm.setAssignedTo(recipient);
    pm.setRaisedBy(sender);

    createPrivateMessage(pm);
    sender.addSentMessage(pm);
    recipient.addReceivedMessage(pm);
  }
View Full Code Here

   * @throws Exception
   */
  @Transactional
  @RequestMapping("/list")
  public ModelAndView list(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Person currentUser = accountService.getPerson(request);
    Map<String, Object> model = Maps.newHashMap();
    JsonArray array = new JsonArray();
    if (currentUser != null) {
      List<ToDo> todos = currentUser.getTodoItems();
      for (ToDo todo : todos) {
        array.add(jsonService.convertToJson(todo));
      }
    }
    model.put("todos", array);
View Full Code Here

   * @return
   * @throws Exception
   */
  @RequestMapping("/detail/{todoId}")
  public ModelAndView detail(@PathVariable("todoId") long todoId, HttpServletRequest request, HttpServletResponse response) throws Exception {
    Person currentUser = accountService.getPerson(request);

    notificationService.markAsRead(currentUser, todoId);

    Map<String, Object> model = Maps.newHashMap();
    JsonArray array = new JsonArray();
    if (currentUser != null) {
      List<ToDo> todos = currentUser.getTodoItems();
      for (ToDo todo : todos) {
        JsonObject t = jsonService.convertToJson(todo);
        if (todo.getId() == todoId) {
          t.addProperty("display", true);
        }
View Full Code Here

  }

  @Transactional
  public void createStatus(String newStatus, String userName) {
    Account acc = accountService.loadAccountByUserName(userName);
    Person currentUser = acc.getUserProfile();
    if (currentUser != null) {
      Status s = new Status(currentUser, newStatus);
      currentUser.addStatus(s);
      statusDao.persist(s);
    }
  }
View Full Code Here

  }

  @Transactional
  public void createWorkTask(String title, String description, String currentUserName, long assignedToId, String priority) {
    Account acc = accountService.loadAccountByUserName(currentUserName);
    Person currentUser = acc.getUserProfile();
    if (currentUser != null) {
      Contactable contact = contactService.loadContactable(assignedToId);
      WorkTask wt = new WorkTask();
      wt.setTitle(title);
      wt.setDetails(description);
View Full Code Here

      wt.setAssignedTo(ass);
    }

    if (body != null && !"".equals(body.trim())) {
      Account acc = accountService.loadAccountByUserName(userName);
      Person currentUser = acc.getUserProfile();
      TicketUpdate update = new TicketUpdate();
      update.setDetails(body);
      update.setTicket(wt);
      update.setRaisedBy(currentUser);
      update.setAssignedTo(wt.getRaisedBy());
View Full Code Here

  }

 
  private Map<String, Object> getJsonMessagesForPerson(
      HttpServletRequest request) {
    Person currentUser = accountService.getPerson(request);
    Map<String, Object> model = Maps.newHashMap();
    JsonArray array = new JsonArray();
    if (currentUser!=null){
      List<PrivateMessage> emails = currentUser.getReceivedMessages();
      for (PrivateMessage pm : emails){
        array.add(jsonService.convertToJson(pm));
      }
    }
    model.put("emails", array);
View Full Code Here

   * @return
   * @throws Exception
   */
  @RequestMapping("/list")
  public ModelAndView list(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Person currentUser = accountService.getPerson(request);
    Map<String, Object> model = Maps.newHashMap();
    JsonArray asked = new JsonArray();
    JsonArray toAnswer = new JsonArray();
    if (currentUser != null) {
      List<Question> questionsAsked = questionService.loadQuestionsAsked(currentUser);
View Full Code Here

   * @throws Exception
   */
  @RequestMapping("/detail/{questionId}")
  public ModelAndView detail(@PathVariable("questionId") long questionId, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    Person currentUser = accountService.getPerson(request);
    notificationService.markAsRead(currentUser, questionId);

    Question q = questionService.loadQuestion(questionId);
    JsonObject question = jsonService.convertToJson(q);
    JsonArray answers = new JsonArray();
View Full Code Here

TOP

Related Classes of com.tmm.enterprise.microblog.domain.Person

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.