Exemplo n.º 1
0
  @Override
  public IAfTopic getTopic(String topicName) throws AfException {
    DiscussionService ds = ServiceHelper.getDiscussionService(afSession);

    IAfID forumId = getForumId();
    if (forumId == null) {
      return null;
    }

    TopicInfo ti = ds.getTopic(AFCHelper.getNodeRefById(afSession, forumId), topicName);

    if (ti == null) {
      return null;
    }

    return new AfTopic(afSession, ti);
  }
Exemplo n.º 2
0
  @Override
  public IAfPost addComment(String comment) throws AfException {

    DiscussionService ds = ServiceHelper.getDiscussionService(afSession);

    IAfID forumId = getForumId();
    IAfFolder forum = (IAfFolder) afSession.getObject(forumId);
    if (forumId == null || forum == null) {
      // create a discussion forum
      forum = (IAfFolder) newChild("fm:forum", "discussion", "fm:discussion");
      forumId = forum.getObjectID();
    }

    NodeRef forumNf = AFCHelper.getNodeRefById(afSession, forumId);
    TopicInfo ti = ds.getTopic(forumNf, "Comments");
    if (ti == null) {
      // create a topic!
      forum.newChild("fm:topic", "Comments", "cm:contains");
      ti = ds.getTopic(forumNf, "Comments");
    }

    return new AfPost(afSession, ds.createPost(ti, comment));
  }