Search in sources :

Example 1 with AbstractPassageBook

use of org.crosswire.jsword.book.basic.AbstractPassageBook in project step by STEPBible.

the class JSwordMetadataServiceImpl method getFirstChapterReference.

@Override
public String getFirstChapterReference(final String version) {
    final Book bookFromVersion = versificationService.getBookFromVersion(version);
    if (bookFromVersion instanceof AbstractPassageBook) {
        final Iterator<BibleBook> bookIterator = ((AbstractPassageBook) bookFromVersion).getBibleBooks().iterator();
        BibleBook bibleBook = bookIterator.next();
        if (BibleBook.INTRO_BIBLE.equals(bibleBook) || BibleBook.INTRO_OT.equals(bibleBook) || BibleBook.INTRO_NT.equals(bibleBook)) {
            bibleBook = bookIterator.next();
            if (BibleBook.INTRO_OT.equals(bibleBook) || BibleBook.INTRO_NT.equals(bibleBook)) {
                bibleBook = bookIterator.next();
            }
        }
        return String.format("%s.%d", bibleBook.getOSIS(), 1);
    }
    throw new StepInternalException("Unable to ascertain first chapter of book.");
}
Also used : BibleBook(org.crosswire.jsword.versification.BibleBook) StepInternalException(com.tyndalehouse.step.core.exceptions.StepInternalException) BibleBook(org.crosswire.jsword.versification.BibleBook) Book(org.crosswire.jsword.book.Book) AbstractPassageBook(org.crosswire.jsword.book.basic.AbstractPassageBook) AbstractPassageBook(org.crosswire.jsword.book.basic.AbstractPassageBook)

Aggregations

StepInternalException (com.tyndalehouse.step.core.exceptions.StepInternalException)1 Book (org.crosswire.jsword.book.Book)1 AbstractPassageBook (org.crosswire.jsword.book.basic.AbstractPassageBook)1 BibleBook (org.crosswire.jsword.versification.BibleBook)1