public void printTopic(int topicID) throws IOException { Topic topicToPrint = readTopic(topicID); System.out.println("id:" + topicToPrint.getId()); System.out.println("title:" + topicToPrint.getTitle()); System.out.println("desc:" + topicToPrint.getDescription()); System.out.println("narr:" + topicToPrint.getNarrative()); }
public static List<String> getTopicIds(Set<Topic> topics) { List<String> ids = Collections.emptyList(); if (topics != null && !topics.isEmpty()) { ids = new ArrayList<>(); for (Topic topic : topics) { String id = getStringId(topic.getId()); if (id != null) { ids.add(id); } } } return ids; }
@RequestMapping( value = "/{section}/{group}/{id}/comments", produces = "application/json; charset=UTF-8", method = RequestMethod.GET) @ResponseBody public Map<String, Object> getComments( @PathVariable("section") String sectionName, @PathVariable("group") String groupName, @PathVariable("id") int msgid, @RequestParam(value = "page", defaultValue = "0") int page, HttpServletRequest request) throws Exception { Topic topic = topicDao.getById(msgid); Group group = groupDao.getGroup(topic.getGroupId()); Section section = sectionService.getSection(group.getSectionId()); if (!section.getUrlName().equals(sectionName) || !group.getUrlName().equals(groupName) || page < 0) { throw new MessageNotFoundException(msgid); } permissionService.checkView(topic, AuthUtil.getCurrentUser()); CommentList comments = commentService.getCommentList(topic, false); CommentFilter cv = new CommentFilter(comments); int messagesPerPage = AuthUtil.getProfile().getMessages(); List<Comment> commentsFiltered = cv.getCommentsForPage(false, page, messagesPerPage, ImmutableSet.<Integer>of()); List<PreparedComment> preparedComments = prepareService.prepareCommentList( comments, commentsFiltered, request.isSecure(), Template.getTemplate(request), topic); return ImmutableMap.of( "comments", preparedComments, "topic", new ApiCommentTopicInfo( topic.getId(), topic.getLink(), permissionService.isCommentsAllowed(topic, AuthUtil.getCurrentUser()))); }
@Override public String toString() { return roomHardConstraintType + "@" + topic.getId(); }
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=utf-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; _jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n"); out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\" >\r\n"); out.write("<head>\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n"); out.write("<title>Neonat论坛</title>\r\n"); out.write( "<link href=\"forum.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\">\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("<div id=\"page\">\r\n"); out.write(" <div id=\"header\">\r\n"); out.write(" <div class=\"clearfix\">\r\n"); out.write(" <div style=\"padding:15px 0 10px 0;\">\r\n"); out.write(" <div class=\"title_logo\"></div>\r\n"); out.write(" </div>\r\n"); out.write( " <div class=\"toolbar\"><a href=\"new.jsp\"><img src=\"images/post.gif\" /></a><div style=\"float:right\">论坛发帖总数:\r\n"); out.write("\t\t"); BundleContext context = Activator.getContext(); NeonatModelService ms = context.getService(context.getServiceReference(NeonatModelService.class)); Board board = ms.getBoard(); out.println(board.getTopicCount()); out.write("\r\n"); out.write("\t </div></div>\r\n"); out.write("\t \r\n"); out.write("\t <table id=\"forum_main\" cellspacing=\"1\">\r\n"); out.write(" <thead>\r\n"); out.write(" <tr>\r\n"); out.write(" <td bgcolor=\"#477AA5\" style=\"width: 20px;\">ID</td>\r\n"); out.write( " <td colspan=\"2\" bgcolor=\"#477AA5\" style=\"border-left: 1px solid white;\">主题</td>\r\n"); out.write(" <td bgcolor=\"#477AA5\" style=\"width: 50px;\">回复</td>\r\n"); out.write(" <td bgcolor=\"#477AA5\" style=\"width: 100px;\">发帖时间</td>\r\n"); out.write(" <td bgcolor=\"#477AA5\" style=\"width: 100px;\">作者</td>\r\n"); out.write(" </tr>\r\n"); out.write(" </thead>\r\n"); out.write(" <tbody>\r\n"); out.write(" "); for (Iterator<Entry<Integer, Topic>> i = board.getTopicsMap().entrySet().iterator(); i.hasNext(); ) { Topic topic = i.next().getValue(); out.write("\r\n"); out.write("\t <tr>\r\n"); out.write("\t <td class=\"topic_id\">"); out.print(topic.getId()); out.write("</td>\r\n"); out.write("\t <td class=\"topic_icon unread_topic\"></td>\r\n"); out.write("\t <td class=\"topic_title\"><a href=\"content.jsp?id="); out.print(topic.getId()); out.write('"'); out.write('>'); out.print(topic.getTitle()); out.write("</a></td>\r\n"); out.write("\t <td class=\"topic_replies\">"); out.print(topic.getReplyTopics().size()); out.write("</td>\r\n"); out.write("\t <td class=\"topic_time\">"); out.print(topic.getDate().toLocaleString()); out.write("</td>\r\n"); out.write( "\t <td class=\"topic_author\"><a href=\"#\" target=\"_blank\">IcyFenix</a></td>\r\n"); out.write("\t </tr>\r\n"); out.write("\t "); } out.write("\r\n"); out.write(" </table>\r\n"); out.write(" <br />\r\n"); out.write( " <div style=\"text-align:center\">©2011-2012 Neonat BBS All rights reserved.</div>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write("</div>\r\n"); out.write("</body>\r\n"); out.write("</html>"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
public void setTopic(Topic topic) { this.topic = topic.getId(); }
public TopicRef( Topic topic, Float weighting, Boolean supervised, Relationship relationship, Integer offset) { this(topic.getId(), weighting, supervised, relationship, offset); }