use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class TimelineServiceImpl method getTimelineEvent.
@Override
public EnhancedTimelineEvent getTimelineEvent(final String id, final String version) {
final EntityDoc[] results = this.timelineEvents.searchExactTermBySingleField("id", 1, id);
if (results.length == 0) {
return null;
}
final EnhancedTimelineEvent ete = new EnhancedTimelineEvent(results[0]);
final String references = ete.getEvent().get("storedReferences");
final String[] refs = StringUtils.split(references);
for (final String r : refs) {
// final OsisWrapper osisText = this.jsword.peakOsisText(version, KEYED_REFERENCE_VERSION, r);
// ete.add(osisText);
}
return ete;
}
use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class TimelineServiceImpl method getEventsFromScripture.
@Override
public TimelineEventsAndDate getEventsFromScripture(final String reference) {
final TimelineEventsAndDate timelineEventsAndDate = new TimelineEventsAndDate();
final EntityDoc[] matchingTimelineEvents = lookupEventsMatchingReference(reference);
timelineEventsAndDate.setEvents(matchingTimelineEvents);
timelineEventsAndDate.setDateTime(getDateForEvents(matchingTimelineEvents));
return timelineEventsAndDate;
}
use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class VocabularyServiceImpl method getDataFromLexiconDefinition.
/**
* gets data from the matched lexicon definitions
*
* @param reference the reference that anchors the strong number
* @param vocabIdentifiers the identifiers
* @param provider the provider used to get data from it
* @return the data in String form
*/
private String getDataFromLexiconDefinition(final String version, final String reference, final String vocabIdentifiers, final LexiconDataProvider provider) {
// else we lookup and concatenate
EntityDoc[] lds = getLexiconDefinitions(vocabIdentifiers, version, reference);
if (lds.length == 0) {
return vocabIdentifiers;
} else if (lds.length == 1) {
return provider.getData(lds[0]);
}
// otherwise, we need to resort to concatenating the fields
final StringBuilder sb = new StringBuilder(lds.length * 32);
sb.append('[');
for (int ii = 0; ii < lds.length; ii++) {
final EntityDoc l = lds[ii];
sb.append(provider.getData(l));
if (ii + 1 < lds.length) {
sb.append(MULTI_WORD_SEPARATOR);
}
}
sb.append(']');
return sb.toString();
}
use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class LexiconDefinitionServiceImpl method lookup.
@Override
public Map<String, LexiconSuggestion> lookup(final Set<String> strongNumbers, final String userLanguage) {
final Map<String, LexiconSuggestion> results = new HashMap<String, LexiconSuggestion>(strongNumbers.size() * 2);
// exit early if no strong numbers
if (strongNumbers.size() == 0) {
return results;
}
final StringBuilder query = new StringBuilder(strongNumbers.size() * 7);
for (final String strong : strongNumbers) {
query.append(strong);
query.append(' ');
}
final EntityDoc[] lexiconDefitions = this.definitions.searchSingleColumn("strongNumber", query.toString());
for (final EntityDoc lexiconDefinition : lexiconDefitions) {
final String strongNumber = lexiconDefinition.get("strongNumber");
final LexiconSuggestion suggestion = getLexiconSuggestion(lexiconDefinition, strongNumber, userLanguage);
results.put(strongNumber, suggestion);
}
return results;
}
use of com.tyndalehouse.step.core.data.EntityDoc in project step by STEPBible.
the class MorphologyServiceImpl method getMorphology.
@Override
public List<EntityDoc> getMorphology(final String code) {
// split code into keys
final String[] codes = split(code, SPACE_SEPARATOR);
final List<EntityDoc> morphs = new ArrayList<EntityDoc>(codes.length);
for (final String c : codes) {
// check cache for key, otherwise obtain from database
final EntityDoc item = retrieveMorphologyByLongName(c);
if (item != null) {
morphs.add(item);
}
}
return morphs;
}
Aggregations