Package com.tmm.enterprise.microblog.domain

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


      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


  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();
    PrivateMessage pm = (PrivateMessage) renderTarget.getActivity();
    n.addProperty("read", renderTarget.isRead());
    String msg = pm.getTitle() == null ? (pm.getDetails().length() > 100 ? pm.getDetails().substring(0, 100) : pm.getDetails()) : (pm.getTitle()
        .length() > 100 ? pm.getTitle().substring(0, 100) : pm.getTitle());
    String from = pm.getRaisedBy() == null ? "Unknown Sender" : pm.getRaisedBy().getName();
    n.addProperty("body", msg);
    n.addProperty("from", from);
    n.addProperty("activityId", pm.getId());
    n.addProperty("activityType", "PrivateMessage");

    return n;
  }
View Full Code Here

  }

  @Test
  public void testConvertToJsonPrivateMessage() {
    Date now = new Date();
    PrivateMessage pm = new PrivateMessage();
    pm.setDetails("test pm body text");
    pm.setCreationDate(now);
    pm.setId(1l);
    pm.setTitle("pm subject");
    JsonObject job = jsonService.convertToJson(pm);
    assertEquals(
        "{\"body\":\"test pm body text\",\"createdBy\":\"UNKNOWN AUTHOR\",\"createdAt\":\""
            + now.toString()
            + "\",\"displayDate\":\"just now\","
View Full Code Here

  public void inboxTest() {
    Person p = new Person();
    p.setRole(UserRole.MEMBER);
    Date now = new Date();

    PrivateMessage pm = new PrivateMessage();
    pm.setDetails("example email");
    pm.setTitle("topic");
    pm.setRaisedBy(p);
    pm.setAssignedTo(p);
    pm.setId(1l);
    pm.setCreationDate(now);

    p.addReceivedMessage(pm);
    p.addSentMessage(pm);

    when(accountService.getPerson(request)).thenReturn(p);
View Full Code Here

TOP

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

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.