/** * Find a BookType from a name. * * @param name The name of the BookType to look up * @return The found BookType or null if the name is not found */ public static BookType getBookType(String name) { for (BookType v : values()) { if (v.name().equalsIgnoreCase(name)) { return v; } } throw new IllegalArgumentException(JSOtherMsg.lookupText("BookType {0} is not defined!", name)); }
private void adjustBookType() { // The book type represents the underlying category of book. // Fine tune it here. BookCategory focusedCategory = (BookCategory) getValue(ConfigEntryType.CATEGORY); questionable = focusedCategory == BookCategory.QUESTIONABLE; // From the config map, extract the important bean properties String modTypeName = (String) getValue(ConfigEntryType.MOD_DRV); if (modTypeName == null) { log.error( "Book not supported: malformed conf file for " + internal + " no " + ConfigEntryType.MOD_DRV.getName() + " found"); supported = false; return; } bookType = BookType.fromString(modTypeName); if (getBookType() == null) { log.error("Book not supported: malformed conf file for " + internal + " no book type found"); supported = false; return; } BookCategory basicCategory = getBookType().getBookCategory(); if (basicCategory == null) { supported = false; return; } // The book type represents the underlying category of book. // Fine tune it here. if (focusedCategory == BookCategory.OTHER || focusedCategory == BookCategory.QUESTIONABLE) { focusedCategory = getBookType().getBookCategory(); } add(ConfigEntryType.CATEGORY, focusedCategory.getName()); }