use of com.tyndalehouse.step.core.models.OsisWrapper in project step by STEPBible.
the class SubjectEntryServiceImpl method getVersesForResults.
/**
* obtains the verses for all results
*
* @param results the results
* @param versions the version in which to look it up
* @param context the context to expand with the reference
* @return the verses
*/
private SubjectEntries getVersesForResults(final EntityDoc[] results, final String[] versions, final String limitingScopeReference, final int context) {
final List<OsisWrapper> verses = new ArrayList<OsisWrapper>(32);
boolean masterVersionSwapped = false;
for (final EntityDoc doc : results) {
final String references = doc.get("references");
masterVersionSwapped |= collectVersesFromReferences(verses, versions, references, limitingScopeReference, context);
}
return new SubjectEntries(verses, masterVersionSwapped);
}
use of com.tyndalehouse.step.core.models.OsisWrapper in project step by STEPBible.
the class BibleInformationServiceImpl method getPassageText.
/**
* Gets the passage text.
*
* @param version the version
* @param startVerseId the start verse id
* @param endVerseId the end verse id
* @param options the options
* @param interlinearVersion the interlinear version
* @param roundUp the round up
* @return the passage text
*/
@Override
public OsisWrapper getPassageText(final String version, final int startVerseId, final int endVerseId, final String options, final String interlinearVersion, final Boolean roundUp) {
final List<String> extraVersions = getExtraVersionsFromString(interlinearVersion);
final Set<LookupOption> lookupOptions = this.optionsValidationService.trim(this.optionsValidationService.getLookupOptions(options), version, extraVersions, InterlinearMode.NONE, null);
final OsisWrapper passage = this.jswordPassage.getOsisTextByVerseNumbers(version, version, startVerseId, endVerseId, new ArrayList<LookupOption>(lookupOptions), interlinearVersion, roundUp, false);
return passage;
}
use of com.tyndalehouse.step.core.models.OsisWrapper in project step by STEPBible.
the class SearchPageController method setupRequestContext.
/**
* Sets up the request context for use in the JSTL parsing
*
* @param req the request
* @param data the osisWrapper
* @throws IOException
*/
private void setupRequestContext(final HttpServletRequest req, final AbstractComplexSearch data) throws IOException {
// global settings
// set the language attributes once
final Locale userLocale = this.clientSessionProvider.get().getLocale();
if (userLocale.getLanguage().equalsIgnoreCase("zh") && userLocale.getCountry().equalsIgnoreCase("tw")) {
req.setAttribute("languageCode", "zh_TW");
} else
req.setAttribute("languageCode", userLocale.getLanguage());
req.setAttribute("languageName", ContemporaryLanguageUtils.capitaliseFirstLetter(userLocale.getDisplayLanguage(userLocale)).replace("\"", ""));
req.setAttribute("languageComplete", this.languageService.isCompleted(userLocale.getLanguage()));
req.setAttribute("ltr", ComponentOrientation.getOrientation(userLocale).isLeftToRight());
req.setAttribute("versions", objectMapper.get().writeValueAsString(modules.getAllModules()));
req.setAttribute("searchType", data.getSearchType().name());
req.setAttribute("versionList", getVersionList(data.getMasterVersion(), data.getExtraVersions()));
req.setAttribute("languages", this.languageService.getAvailableLanguages());
// specific to passages
if (data instanceof OsisWrapper) {
final OsisWrapper osisWrapper = (OsisWrapper) data;
req.setAttribute("passageText", osisWrapper.getValue());
osisWrapper.setValue(null);
req.setAttribute("passageModel", objectMapper.get().writeValueAsString(osisWrapper));
populateMetaPassage(req, osisWrapper);
populateSiblingChapters(req, osisWrapper);
} else if (data instanceof SearchResult) {
final SearchResult results = (SearchResult) data;
req.setAttribute("searchResults", results.getResults());
req.setAttribute("definitions", results.getDefinitions());
req.setAttribute("filter", results.getStrongHighlights());
req.setAttribute("numResults", results.getTotal());
req.setAttribute("sort", results.getOrder());
results.setResults(null);
req.setAttribute("passageModel", objectMapper.get().writeValueAsString(results));
populateMetaSearch(req, results);
}
// set the analytics token
req.setAttribute("stepDomain", appManagerService.getAppDomain());
req.setAttribute("analyticsToken", Boolean.TRUE.equals(Boolean.getBoolean("step.development")) ? DEV_TOKEN : LIVE_TOKEN);
}
Aggregations