diff --git a/webapi/src/main/java/org/oruko/dictionary/web/NameEntryService.java b/webapi/src/main/java/org/oruko/dictionary/web/NameEntryService.java index 23e0e08a..56859695 100644 --- a/webapi/src/main/java/org/oruko/dictionary/web/NameEntryService.java +++ b/webapi/src/main/java/org/oruko/dictionary/web/NameEntryService.java @@ -200,9 +200,7 @@ public List loadAllNames(Optional pageNumberParam, Optional< new PageRequest(pageNumber == 0 ? 0 : pageNumber - 1, count, Sort.Direction.ASC, "id"); Page pages = nameEntryRepository.findAll(request); - pages.forEach(page -> { - nameEntries.add(page); - }); + pages.forEach(nameEntries::add); return nameEntries; } @@ -213,10 +211,7 @@ public List loadAllNames(Optional pageNumberParam, Optional< * @return list of {@link NameEntry}. If state is not present, it returns an empty list */ public List loadAllByState(Optional state) { - if (!state.isPresent()) { - return Collections.emptyList(); - } - return nameEntryRepository.findByState(state.get()); + return state.map(s -> nameEntryRepository.findByState(s)).orElseGet(Collections::emptyList); } /** @@ -232,8 +227,8 @@ public List loadByState(Optional state, Optional page return this.loadAllNames(pageParam, countParam); } - final Integer page = pageParam.isPresent() ? pageParam.get() - 1 : 1; - final Integer count = countParam.isPresent() ? countParam.get() : COUNT_SIZE; + final Integer page = pageParam.map(integer -> integer - 1).orElse(1); + final Integer count = countParam.orElse(COUNT_SIZE); return nameEntryRepository.findByState(state.get(), new PageRequest(page,count)); diff --git a/webapi/src/main/java/org/oruko/dictionary/web/event/RecentSearches.java b/webapi/src/main/java/org/oruko/dictionary/web/event/RecentSearches.java index d5fd4725..e92e5b99 100644 --- a/webapi/src/main/java/org/oruko/dictionary/web/event/RecentSearches.java +++ b/webapi/src/main/java/org/oruko/dictionary/web/event/RecentSearches.java @@ -81,9 +81,7 @@ public String[] getMostPopular() { List> frequency = getNameWithSearchFrequency(); List mostPopular = new ArrayList<>(); - frequency.stream().forEach(name -> { - mostPopular.add((String) name.keySet().toArray()[0]); - }); + frequency.stream().forEach(name -> mostPopular.add((String) name.keySet().toArray()[0])); if (mostPopular.size() > popularListLimit) { return mostPopular.subList(0, popularListLimit).toArray(new String[popularListLimit]); diff --git a/webapi/src/main/java/org/oruko/dictionary/web/rest/FeedbackApi.java b/webapi/src/main/java/org/oruko/dictionary/web/rest/FeedbackApi.java index 91b178cb..255da161 100644 --- a/webapi/src/main/java/org/oruko/dictionary/web/rest/FeedbackApi.java +++ b/webapi/src/main/java/org/oruko/dictionary/web/rest/FeedbackApi.java @@ -100,9 +100,7 @@ public ResponseEntity> deleteAllFeedbackForName(@RequestPara } final Sort sort = new Sort(Sort.Direction.DESC, "submittedAt"); List feedbacks = feedbackRepository.findByName(name, sort); - feedbacks.stream().forEach(feedback -> { - feedbackRepository.delete(feedback); - }); + feedbacks.stream().forEach(feedback -> feedbackRepository.delete(feedback)); return new ResponseEntity<>(response("All Feedback messages deleted for "+ name), HttpStatus.OK); } diff --git a/webapi/src/main/java/org/oruko/dictionary/web/rest/NameApi.java b/webapi/src/main/java/org/oruko/dictionary/web/rest/NameApi.java index a116f732..130aef71 100644 --- a/webapi/src/main/java/org/oruko/dictionary/web/rest/NameApi.java +++ b/webapi/src/main/java/org/oruko/dictionary/web/rest/NameApi.java @@ -351,10 +351,11 @@ public ResponseEntity< Map> updateNames(@Valid @RequestBody Name entryService.bulkUpdateNames(foundNames); List notFound = notFoundNames.stream() - .map(notFoundName -> notFoundName.getName()) + .map(NameEntry::getName) .collect(Collectors.toList()); + List found = foundNames.stream() - .map(foundName -> foundName.getName()) + .map(NameEntry::getName) .collect(Collectors.toList()); String responseMessage = String.join(",", found) + " updated. "; diff --git a/webapi/src/test/java/org/oruko/dictionary/web/NameEntryServiceTest.java b/webapi/src/test/java/org/oruko/dictionary/web/NameEntryServiceTest.java index f8942cee..5205003a 100644 --- a/webapi/src/test/java/org/oruko/dictionary/web/NameEntryServiceTest.java +++ b/webapi/src/test/java/org/oruko/dictionary/web/NameEntryServiceTest.java @@ -123,7 +123,7 @@ public void testdeleteNameEntryAndDuplicates() { @Test public void testDeleteInDuplicateEntry() throws Exception { - DuplicateNameEntry duplicateNameEntry = mock(DuplicateNameEntry.class);;;; + DuplicateNameEntry duplicateNameEntry = mock(DuplicateNameEntry.class); nameEntryService.deleteInDuplicateEntry(duplicateNameEntry); verify(duplicateEntryRepository).delete(duplicateNameEntry); } diff --git a/website/src/main/java/org/oruko/dictionary/DictionaryApplication.java b/website/src/main/java/org/oruko/dictionary/DictionaryApplication.java index 55e9db77..eb29df95 100644 --- a/website/src/main/java/org/oruko/dictionary/DictionaryApplication.java +++ b/website/src/main/java/org/oruko/dictionary/DictionaryApplication.java @@ -33,7 +33,6 @@ @SpringBootApplication @EnableCaching @EnableSwagger2 -//@EnableWebSecurity //switches off auto configuration for spring security public class DictionaryApplication extends WebMvcConfigurerAdapter { private final String LANG = "lang"; @@ -99,8 +98,7 @@ public ReloadableResourceBundleMessageSource messageSource() { return source; } - -// @Bean + @Bean public net.sf.ehcache.CacheManager ecacheManager() { CacheConfiguration allNames = new CacheConfiguration(); allNames.setName("allNames"); @@ -120,17 +118,10 @@ public net.sf.ehcache.CacheManager ecacheManager() { names.setEternal(false); names.setTimeToIdleSeconds(1800); -// CacheConfiguration nameCount = new CacheConfiguration(); -// nameCount.setName("nameCount"); -// nameCount.setMaxEntriesLocalHeap(0); -// nameCount.setEternal(false); -// nameCount.setTimeToIdleSeconds(1800); - net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration(); config.addCache(allNames); config.addCache(querySearchResult); config.addCache(names); - //config.addCache(nameCount); return net.sf.ehcache.CacheManager.newInstance(config); } diff --git a/website/src/main/resources/messages.properties b/website/src/main/resources/messages.properties index 6c3d7218..7ea293c6 100644 --- a/website/src/main/resources/messages.properties +++ b/website/src/main/resources/messages.properties @@ -21,7 +21,7 @@ lang.most-popular-names=Most Popular Names lang.name-of-day=Name of the day lang.play-sound=Click to hear pronunciation lang.submitby=Submitted by -lang.pronounciation=Pronounciation +lang.pronunciation=Pronunciation lang.share=Share lang.improve-entry=Improve this entry lang.meaningof=Meaning of diff --git a/website/src/main/resources/messages_yo.properties b/website/src/main/resources/messages_yo.properties index 601b19ea..1cfaa45f 100644 --- a/website/src/main/resources/messages_yo.properties +++ b/website/src/main/resources/messages_yo.properties @@ -21,7 +21,7 @@ lang.most-popular-names=Àwọn Orúkọ Tó Gbajúmọ̀ Jù lang.name-of-day=Orúkọ Ojúmọ́ lang.play-sound=Tẹ̀ láti gbọ́ ohùn lang.submitby=Ẹni tó fún wa ni -lang.pronounciation=Sísọ síta +lang.pronunciation=Sísọ síta lang.share=Fihànká lang.improve-entry=Tún orúkọ yìí ṣe lang.meaningof=Ìtumọọ @@ -85,5 +85,5 @@ lang.key-supporters=Àwọn agbèlẹ́yìn wa pàtàkì lang.yoruba-name-dictionary=Dikṣọ́nárì Orúkọ Yorùbá lang.yoruba-name-newsletter=Ìwé Ìròyìn YorubaName -lang.follow-update=Follow us behind the scenes for exclusive news, freebies, links, lexicographer tools, and other important updates about this dictionary. -lang.enter-your-email=Enter your email here \ No newline at end of file +lang.follow-update=Tẹ̀lé wa wọlé láti gba ojúlówó ìròyìn, oun ọ̀fẹ́, ìsopọ̀, oun èlò àwọn onímọ̀ èdè, àti oríṣiríṣi ìròyìn pàtàkì nípa dikṣọ́nárì yìí. +lang.enter-your-email=Tẹ email rẹ síbí \ No newline at end of file diff --git a/website/src/main/resources/website/contactus.hbs b/website/src/main/resources/website/contactus.hbs index 29bf1d19..5f818174 100644 --- a/website/src/main/resources/website/contactus.hbs +++ b/website/src/main/resources/website/contactus.hbs @@ -16,14 +16,14 @@

{{message "lang.contact-info-preamble"}}

{{message "lang.contact-info-email-preamble"}} project@yorubaname.com

-

Or visit our office at YorubaName.com
+

{{message "lang.contact-info-contact-preamble"}}
2nd Floor, The Garnet Building
Lekki - Epe Express Road, Lekki
Lagos 101245
Nigeria

-

Follow us on Social Media

+

{{message "lang.social-media"}}