Package com.tmm.enterprise.microblog.domain

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


    Account acc = accountService.loadAccountByUserName(currentUserName);
    Person currentUser = acc.getUserProfile();
    // assigning to
    if (currentUser != null) {
      Question q = loadQuestion(questionId);
      Answer a = new Answer();
      a.setAssignedTo(currentUser);
      a.setRaisedBy(currentUser);
      a.setDetails(answer);
      a.setQuestion(q);
      q.addAnswer(a);
      answerService.createAnswer(a);
    }
  }
View Full Code Here


    return questionTagDao.loadmostPopular(20);
  }

  @Transactional
  public void updateAnswer(long answerId, boolean correct) {
    Answer a = loadAnswer(answerId);
    a.setCorrect(correct);
  }
View Full Code Here

  public JsonObject render(Notification renderTarget) {

    // FIXME - just put in to get web running.. will need more thought on
    // the rendering approach
    JsonObject n = new JsonObject();
    Answer a = (Answer) renderTarget.getActivity();
    n.addProperty("read", renderTarget.isRead());
    String msg;

    Question q = a.getQuestion();
    if (q != null) {
      msg = "Answer added for: "
          + (q.getTitle() == null ? (q.getDetails().length() > 100 ? q.getDetails().substring(0, 100) : q.getDetails()) : (q.getTitle()
              .length() > 100 ? q.getTitle().substring(0, 100) : q.getTitle()));
    } else {
      msg = a.getTitle() == null ? (a.getDetails().length() > 100 ? a.getDetails().substring(0, 100) : a.getDetails())
          : (a.getTitle().length() > 100 ? a.getTitle().substring(0, 100) : a.getTitle());
    }

    boolean isOwner = a.getRaisedBy() != null && a.getRaisedBy().getNotifications().contains(renderTarget);
    String from;
    if (isOwner) {
      from = "you answered this question";
    } else {
      from = "answered by " + (a.getRaisedBy() == null ? "Unknown Sender" : a.getRaisedBy().getName());
    }

    n.addProperty("body", msg);
    n.addProperty("from", from);
    n.addProperty("activityId", a.getId());
    n.addProperty("activityType", "Answer");

    return n;
  }
View Full Code Here

TOP

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

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.