public ChapterBean() { HttpServletRequest hsr = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); String url = hsr.getParameter("url").replace(".html", ""); int idx = url.lastIndexOf("-"); int chapter = Integer.parseInt(url.substring(idx + 1, url.length())); String book = url.substring(0, idx).replace("-", " "); int bookId = CachedData.getBibleBooks().getByName(book).getId(); BibleVerses verses = BibleVerses.loadByBookIdChapterNumber(bookId, chapter); passage = BiblePassage.load(verses.get(0).getId(), verses.get(verses.size() - 1).getId()); if (passage == null) { passage = new BiblePassage(); passage.setStartVerseId(verses.get(0).getId()); passage.setEndVerseId(verses.get(verses.size() - 1).getId()); passage.save(); Topics.generateForPassage( passage.getId(), passage.getStartVerseId(), passage.getEndVerseId()); } passage.populateVerses(AppUser.getCurrent().TranslationId); commentsController = new CommentsController("passage", passage.getId()); relatedTopicsController = new RelatedTopicsController("passage", passage.getId(), 5); relatedImagesController = new RelatedImagesController("passage", passage.getId(), passage.getUrl()); }
public String getListen() { return "<span class=\"listen\" id=\"listen_" + String.valueOf(passage.getStartVerseId()) + "_" + String.valueOf(passage.getEndVerseId()) + "\"></span>"; }