Search in sources :

Example 1 with ObjectFactory

use of biblemulticonverter.schema.roundtripxml.ObjectFactory in project BibleMultiConverter by schierlm.

the class RoundtripXML method createBible.

protected JAXBElement<BibleType> createBible(Bible sBible) throws Exception {
    ObjectFactory of = new ObjectFactory();
    JAXBElement<BibleType> dBible = of.createBible(of.createBibleType());
    dBible.getValue().setName(sBible.getName());
    int dictCounter = 0;
    for (Book sBook : sBible.getBooks()) {
        BibleType.Book dBook = of.createBibleTypeBook();
        dBook.setAbbr(sBook.getAbbr());
        if (sBook.getId().equals(BookID.DICTIONARY_ENTRY)) {
            dBook.setId(sBook.getId().getOsisID() + "-" + (++dictCounter));
        } else {
            dBook.setId(sBook.getId().getOsisID());
        }
        dBook.setShortName(sBook.getShortName());
        dBook.setLongName(sBook.getLongName());
        dBible.getValue().getBook().add(dBook);
        for (Chapter sChapter : sBook.getChapters()) {
            BibleType.Book.Chapter dChapter = of.createBibleTypeBookChapter();
            dBook.getChapter().add(dChapter);
            if (sChapter.getProlog() != null) {
                dChapter.setProlog(of.createBibleTypeBookChapterProlog());
                sChapter.getProlog().accept(new CreateContentVisitor(of, dChapter.getProlog().getContent()));
            }
            for (Verse sVerse : sChapter.getVerses()) {
                BibleType.Book.Chapter.Verse dVerse = of.createBibleTypeBookChapterVerse();
                dChapter.getVerse().add(dVerse);
                dVerse.setNumber(sVerse.getNumber());
                sVerse.accept(new CreateContentVisitor(of, dVerse.getContent()));
            }
        }
    }
    return dBible;
}
Also used : ObjectFactory(biblemulticonverter.schema.roundtripxml.ObjectFactory) Book(biblemulticonverter.data.Book) Chapter(biblemulticonverter.data.Chapter) BibleType(biblemulticonverter.schema.roundtripxml.BibleType) Verse(biblemulticonverter.data.Verse)

Aggregations

Book (biblemulticonverter.data.Book)1 Chapter (biblemulticonverter.data.Chapter)1 Verse (biblemulticonverter.data.Verse)1 BibleType (biblemulticonverter.schema.roundtripxml.BibleType)1 ObjectFactory (biblemulticonverter.schema.roundtripxml.ObjectFactory)1