-
+
"
${letter.text}
"
diff --git a/src/main/webapp/WEB-INF/jsp/content/word/peer-reviews/pending.jsp b/src/main/webapp/WEB-INF/jsp/content/word/peer-reviews/pending.jsp
index 8cc7cbc63..9bbbc7805 100644
--- a/src/main/webapp/WEB-INF/jsp/content/word/peer-reviews/pending.jsp
+++ b/src/main/webapp/WEB-INF/jsp/content/word/peer-reviews/pending.jsp
@@ -30,7 +30,7 @@
""
- / ${sound.valueIpa} /
+ / ${sound.valueIpa} /
|
${word.wordType}
diff --git a/src/main/webapp/WEB-INF/jsp/contributions/most-recent.jsp b/src/main/webapp/WEB-INF/jsp/contributions/most-recent.jsp
index c18781401..5c5606a4b 100644
--- a/src/main/webapp/WEB-INF/jsp/contributions/most-recent.jsp
+++ b/src/main/webapp/WEB-INF/jsp/contributions/most-recent.jsp
@@ -49,7 +49,7 @@
"${word.text}"
|
- / ${sound.valueIpa} /
+ / ${sound.valueIpa} /
|
${word.wordType}
From c00cb8caff3a7939f8081db8295e7cb8a9cb73c2 Mon Sep 17 00:00:00 2001
From: jo-elimu <1451036+jo-elimu@users.noreply.github.com>
Date: Mon, 30 Oct 2023 21:52:29 +0700
Subject: [PATCH 4/6] refactor: Rename REST API controller
ref #1624
---
...r.java => LetterSoundsRestController.java} | 18 +++++------
...oundCorrespondencesRestControllerTest.java | 31 -------------------
.../LetterSoundsRestControllerTest.java | 31 +++++++++++++++++++
3 files changed, 40 insertions(+), 40 deletions(-)
rename src/main/java/ai/elimu/rest/v2/content/{LetterSoundCorrespondencesRestController.java => LetterSoundsRestController.java} (56%)
delete mode 100644 src/test/java/ai/elimu/rest/v2/content/LetterSoundCorrespondencesRestControllerTest.java
create mode 100644 src/test/java/ai/elimu/rest/v2/content/LetterSoundsRestControllerTest.java
diff --git a/src/main/java/ai/elimu/rest/v2/content/LetterSoundCorrespondencesRestController.java b/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
similarity index 56%
rename from src/main/java/ai/elimu/rest/v2/content/LetterSoundCorrespondencesRestController.java
rename to src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
index 11fa9d438..0ddd44b7b 100644
--- a/src/main/java/ai/elimu/rest/v2/content/LetterSoundCorrespondencesRestController.java
+++ b/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
@@ -16,26 +16,26 @@
import ai.elimu.dao.LetterSoundCorrespondenceDao;
@RestController
-@RequestMapping(value = "/rest/v2/content/letter-sound-correspondences", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-public class LetterSoundCorrespondencesRestController {
+@RequestMapping(value = "/rest/v2/content/letter-sounds", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+public class LetterSoundsRestController {
private Logger logger = LogManager.getLogger();
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundCorrespondenceDao letterSoundDao;
@RequestMapping(method = RequestMethod.GET)
public String handleGetRequest() {
logger.info("handleGetRequest");
- JSONArray letterSoundCorrespondencesJsonArray = new JSONArray();
- for (LetterSoundCorrespondence letterSoundCorrespondence : letterSoundCorrespondenceDao.readAllOrderedByUsage()) {
- LetterSoundCorrespondenceGson letterSoundCorrespondenceGson = JpaToGsonConverter.getLetterSoundCorrespondenceGson(letterSoundCorrespondence);
- String json = new Gson().toJson(letterSoundCorrespondenceGson);
- letterSoundCorrespondencesJsonArray.put(new JSONObject(json));
+ JSONArray letterSoundsJsonArray = new JSONArray();
+ for (LetterSoundCorrespondence letterSound : letterSoundDao.readAllOrderedByUsage()) {
+ LetterSoundCorrespondenceGson letterSoundGson = JpaToGsonConverter.getLetterSoundCorrespondenceGson(letterSound);
+ String json = new Gson().toJson(letterSoundGson);
+ letterSoundsJsonArray.put(new JSONObject(json));
}
- String jsonResponse = letterSoundCorrespondencesJsonArray.toString();
+ String jsonResponse = letterSoundsJsonArray.toString();
logger.info("jsonResponse: " + jsonResponse);
return jsonResponse;
}
diff --git a/src/test/java/ai/elimu/rest/v2/content/LetterSoundCorrespondencesRestControllerTest.java b/src/test/java/ai/elimu/rest/v2/content/LetterSoundCorrespondencesRestControllerTest.java
deleted file mode 100644
index b1432f6b8..000000000
--- a/src/test/java/ai/elimu/rest/v2/content/LetterSoundCorrespondencesRestControllerTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package ai.elimu.rest.v2.content;
-
-import ai.elimu.util.JsonLoader;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import static org.hamcrest.CoreMatchers.*;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import static org.junit.Assert.assertThat;
-import org.junit.Test;
-import selenium.DomainHelper;
-
-public class LetterSoundCorrespondencesRestControllerTest {
-
- private Logger logger = LogManager.getLogger();
-
- @Test
- public void testHandleGetRequest() {
- String jsonResponse = JsonLoader.loadJson(DomainHelper.getRestUrlV2() + "/content/letter-sound-correspondences");
- logger.info("jsonResponse: " + jsonResponse);
-
- JSONArray letterSoundCorrespondencesJSONArray = new JSONArray(jsonResponse);
- logger.info("letterSoundCorrespondencesJSONArray.length(): " + letterSoundCorrespondencesJSONArray.length());
- assertThat(letterSoundCorrespondencesJSONArray.length() > 0, is(true));
-
- JSONObject letterSoundCorrespondenceJsonObject = letterSoundCorrespondencesJSONArray.getJSONObject(0);
- assertThat(letterSoundCorrespondenceJsonObject.getLong("id"), not(nullValue()));
- assertThat(letterSoundCorrespondenceJsonObject.has("letters"), is(true));
- assertThat(letterSoundCorrespondenceJsonObject.has("sounds"), is(true));
- }
-}
diff --git a/src/test/java/ai/elimu/rest/v2/content/LetterSoundsRestControllerTest.java b/src/test/java/ai/elimu/rest/v2/content/LetterSoundsRestControllerTest.java
new file mode 100644
index 000000000..4dfa98f50
--- /dev/null
+++ b/src/test/java/ai/elimu/rest/v2/content/LetterSoundsRestControllerTest.java
@@ -0,0 +1,31 @@
+package ai.elimu.rest.v2.content;
+
+import ai.elimu.util.JsonLoader;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import static org.hamcrest.CoreMatchers.*;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import static org.junit.Assert.assertThat;
+import org.junit.Test;
+import selenium.DomainHelper;
+
+public class LetterSoundsRestControllerTest {
+
+ private Logger logger = LogManager.getLogger();
+
+ @Test
+ public void testHandleGetRequest() {
+ String jsonResponse = JsonLoader.loadJson(DomainHelper.getRestUrlV2() + "/content/letter-sounds");
+ logger.info("jsonResponse: " + jsonResponse);
+
+ JSONArray letterSoundsJSONArray = new JSONArray(jsonResponse);
+ logger.info("letterSoundsJSONArray.length(): " + letterSoundsJSONArray.length());
+ assertThat(letterSoundsJSONArray.length() > 0, is(true));
+
+ JSONObject letterSoundJsonObject = letterSoundsJSONArray.getJSONObject(0);
+ assertThat(letterSoundJsonObject.getLong("id"), not(nullValue()));
+ assertThat(letterSoundJsonObject.has("letters"), is(true));
+ assertThat(letterSoundJsonObject.has("sounds"), is(true));
+ }
+}
From aa95de82bfd85dbb0ca9cec283e79b200f845f4b Mon Sep 17 00:00:00 2001
From: jo-elimu <1451036+jo-elimu@users.noreply.github.com>
Date: Mon, 30 Oct 2023 22:00:37 +0700
Subject: [PATCH 5/6] refactor: Rename letter-sound DAO
ref #1624
---
...undCorrespondenceDao.java => LetterSoundDao.java} | 2 +-
...respondenceDaoJpa.java => LetterSoundDaoJpa.java} | 4 ++--
.../StringToLetterSoundCorrespondenceConverter.java | 6 +++---
.../rest/v2/content/LetterSoundsRestController.java | 4 ++--
.../crowdsource/WordContributionRestController.java | 6 +++---
...LetterSoundCorrespondenceUsageCountScheduler.java | 8 ++++----
.../elimu/util/csv/CsvContentExtractionHelper.java | 8 ++++----
.../java/ai/elimu/util/db/DbContentImportHelper.java | 12 ++++++------
.../ai/elimu/web/content/MainContentController.java | 6 +++---
.../LetterSoundCorrespondenceCreateController.java | 8 ++++----
...LetterSoundCorrespondenceCsvExportController.java | 6 +++---
.../LetterSoundCorrespondenceEditController.java | 10 +++++-----
.../LetterSoundCorrespondenceListController.java | 6 +++---
...tterSoundCorrespondencePeerReviewsController.java | 4 ++--
...orrespondencePeerReviewEventCreateController.java | 6 +++---
.../elimu/web/content/sound/SoundEditController.java | 8 ++++----
.../elimu/web/content/word/WordCreateController.java | 10 +++++-----
.../elimu/web/content/word/WordEditController.java | 10 +++++-----
.../webapp/WEB-INF/spring/applicationContext-jpa.xml | 2 +-
19 files changed, 63 insertions(+), 63 deletions(-)
rename src/main/java/ai/elimu/dao/{LetterSoundCorrespondenceDao.java => LetterSoundDao.java} (85%)
rename src/main/java/ai/elimu/dao/jpa/{LetterSoundCorrespondenceDaoJpa.java => LetterSoundDaoJpa.java} (91%)
diff --git a/src/main/java/ai/elimu/dao/LetterSoundCorrespondenceDao.java b/src/main/java/ai/elimu/dao/LetterSoundDao.java
similarity index 85%
rename from src/main/java/ai/elimu/dao/LetterSoundCorrespondenceDao.java
rename to src/main/java/ai/elimu/dao/LetterSoundDao.java
index c5ca00104..7c60bffab 100644
--- a/src/main/java/ai/elimu/dao/LetterSoundCorrespondenceDao.java
+++ b/src/main/java/ai/elimu/dao/LetterSoundDao.java
@@ -7,7 +7,7 @@
import org.springframework.dao.DataAccessException;
-public interface LetterSoundCorrespondenceDao extends GenericDao {
+public interface LetterSoundDao extends GenericDao {
LetterSoundCorrespondence read(List letters, List sounds) throws DataAccessException;
diff --git a/src/main/java/ai/elimu/dao/jpa/LetterSoundCorrespondenceDaoJpa.java b/src/main/java/ai/elimu/dao/jpa/LetterSoundDaoJpa.java
similarity index 91%
rename from src/main/java/ai/elimu/dao/jpa/LetterSoundCorrespondenceDaoJpa.java
rename to src/main/java/ai/elimu/dao/jpa/LetterSoundDaoJpa.java
index 19332f1e4..7d0dbc941 100644
--- a/src/main/java/ai/elimu/dao/jpa/LetterSoundCorrespondenceDaoJpa.java
+++ b/src/main/java/ai/elimu/dao/jpa/LetterSoundDaoJpa.java
@@ -6,9 +6,9 @@
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.dao.DataAccessException;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
-public class LetterSoundCorrespondenceDaoJpa extends GenericDaoJpa implements LetterSoundCorrespondenceDao {
+public class LetterSoundDaoJpa extends GenericDaoJpa implements LetterSoundDao {
@Override
public LetterSoundCorrespondence read(List letters, List sounds) throws DataAccessException {
diff --git a/src/main/java/ai/elimu/logic/converters/StringToLetterSoundCorrespondenceConverter.java b/src/main/java/ai/elimu/logic/converters/StringToLetterSoundCorrespondenceConverter.java
index 24af28ebe..eaed27e7c 100644
--- a/src/main/java/ai/elimu/logic/converters/StringToLetterSoundCorrespondenceConverter.java
+++ b/src/main/java/ai/elimu/logic/converters/StringToLetterSoundCorrespondenceConverter.java
@@ -4,12 +4,12 @@
import ai.elimu.model.content.LetterSoundCorrespondence;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
public class StringToLetterSoundCorrespondenceConverter implements Converter {
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
/**
* Convert LetterSoundCorrespondence id to LetterSoundCorrespondence entity
@@ -19,7 +19,7 @@ public LetterSoundCorrespondence convert(String id) {
return null;
} else {
Long letterSoundCorrespondenceId = Long.parseLong(id);
- LetterSoundCorrespondence letterSoundCorrespondence = letterSoundCorrespondenceDao.read(letterSoundCorrespondenceId);
+ LetterSoundCorrespondence letterSoundCorrespondence = letterSoundDao.read(letterSoundCorrespondenceId);
return letterSoundCorrespondence;
}
}
diff --git a/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java b/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
index 0ddd44b7b..27ac11723 100644
--- a/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
+++ b/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
@@ -13,7 +13,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
@RestController
@RequestMapping(value = "/rest/v2/content/letter-sounds", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@@ -22,7 +22,7 @@ public class LetterSoundsRestController {
private Logger logger = LogManager.getLogger();
@Autowired
- private LetterSoundCorrespondenceDao letterSoundDao;
+ private LetterSoundDao letterSoundDao;
@RequestMapping(method = RequestMethod.GET)
public String handleGetRequest() {
diff --git a/src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java b/src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java
index df403e910..92177f82e 100644
--- a/src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java
+++ b/src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java
@@ -52,7 +52,7 @@ public class WordContributionRestController {
private ContributorDao contributorDao;
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
/**
* Returns a list of {@link LetterSoundCorrespondence}s that will be used to construct a {@link Word}.
@@ -62,7 +62,7 @@ public String getLetterSoundCorrespondences(HttpServletRequest request, HttpServ
logger.info("getLetterSoundCorrespondences");
JSONArray letterSoundCorrespondencesJsonArray = new JSONArray();
- for (LetterSoundCorrespondence letterSoundCorrespondence : letterSoundCorrespondenceDao.readAllOrderedByUsage()) {
+ for (LetterSoundCorrespondence letterSoundCorrespondence : letterSoundDao.readAllOrderedByUsage()) {
LetterSoundCorrespondenceGson letterSoundCorrespondenceGson =
JpaToGsonConverter.getLetterSoundCorrespondenceGson(letterSoundCorrespondence);
String json = new Gson().toJson(letterSoundCorrespondenceGson);
@@ -148,7 +148,7 @@ public String postWordContribution(
List letterSoundCorrespondences = new ArrayList<>();
for (LetterSoundCorrespondenceGson letterSoundCorrespondenceGson : letterSoundCorrespondencesGsons) {
LetterSoundCorrespondence letterSoundCorrespondence =
- letterSoundCorrespondenceDao.read(letterSoundCorrespondenceGson.getId());
+ letterSoundDao.read(letterSoundCorrespondenceGson.getId());
letterSoundCorrespondences.add(letterSoundCorrespondence);
}
word.setLetterSoundCorrespondences(letterSoundCorrespondences);
diff --git a/src/main/java/ai/elimu/tasks/LetterSoundCorrespondenceUsageCountScheduler.java b/src/main/java/ai/elimu/tasks/LetterSoundCorrespondenceUsageCountScheduler.java
index 32d2c02cd..d42907ac5 100644
--- a/src/main/java/ai/elimu/tasks/LetterSoundCorrespondenceUsageCountScheduler.java
+++ b/src/main/java/ai/elimu/tasks/LetterSoundCorrespondenceUsageCountScheduler.java
@@ -14,7 +14,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
@Service
public class LetterSoundCorrespondenceUsageCountScheduler {
@@ -25,7 +25,7 @@ public class LetterSoundCorrespondenceUsageCountScheduler {
private WordDao wordDao;
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@Scheduled(cron="00 15 06 * * *") // At 06:15 every day
public synchronized void execute() {
@@ -47,7 +47,7 @@ public synchronized void execute() {
}
// Update the values previously stored in the database
- for (LetterSoundCorrespondence letterSoundCorrespondence : letterSoundCorrespondenceDao.readAll()) {
+ for (LetterSoundCorrespondence letterSoundCorrespondence : letterSoundDao.readAll()) {
logger.info("letterSoundCorrespondence.getId(): " + letterSoundCorrespondence.getId());
logger.info("letterSoundCorrespondence Letters: \"" + letterSoundCorrespondence.getLetters().stream().map(Letter::getText).collect(Collectors.joining()) + "\"");
logger.info("letterSoundCorrespondence Sounds: /" + letterSoundCorrespondence.getSounds().stream().map(Sound::getValueIpa).collect(Collectors.joining()) + "/");
@@ -60,7 +60,7 @@ public synchronized void execute() {
logger.info("newUsageCount: " + newUsageCount);
letterSoundCorrespondence.setUsageCount(newUsageCount);
- letterSoundCorrespondenceDao.update(letterSoundCorrespondence);
+ letterSoundDao.update(letterSoundCorrespondence);
logger.info("letterSoundCorrespondence.getUsageCount() (after update): " + letterSoundCorrespondence.getUsageCount());
}
diff --git a/src/main/java/ai/elimu/util/csv/CsvContentExtractionHelper.java b/src/main/java/ai/elimu/util/csv/CsvContentExtractionHelper.java
index a2b5861ee..9fa4a75f2 100644
--- a/src/main/java/ai/elimu/util/csv/CsvContentExtractionHelper.java
+++ b/src/main/java/ai/elimu/util/csv/CsvContentExtractionHelper.java
@@ -1,7 +1,7 @@
package ai.elimu.util.csv;
import ai.elimu.dao.LetterDao;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.dao.SoundDao;
import ai.elimu.dao.WordDao;
import ai.elimu.model.content.Emoji;
@@ -49,7 +49,7 @@ public class CsvContentExtractionHelper {
/**
* For information on how the CSV files were generated, see {@link LetterSoundCorrespondenceCsvExportController#handleRequest}.
*/
- public static List getLetterSoundCorrespondencesFromCsvBackup(File csvFile, LetterDao letterDao, SoundDao soundDao, LetterSoundCorrespondenceDao letterSoundCorrespondenceDao) {
+ public static List getLetterSoundCorrespondencesFromCsvBackup(File csvFile, LetterDao letterDao, SoundDao soundDao, LetterSoundDao letterSoundDao) {
logger.info("getLetterSoundCorrespondencesFromCsvBackup");
List letterSoundCorrespondences = new ArrayList<>();
@@ -119,7 +119,7 @@ public static List getLetterSoundCorrespondencesFromC
/**
* For information on how the CSV files were generated, see {@link WordCsvExportController#handleRequest}.
*/
- public static List getWordsFromCsvBackup(File csvFile, LetterDao letterDao, SoundDao soundDao, LetterSoundCorrespondenceDao letterSoundCorrespondenceDao, WordDao wordDao) {
+ public static List getWordsFromCsvBackup(File csvFile, LetterDao letterDao, SoundDao soundDao, LetterSoundDao letterSoundDao, WordDao wordDao) {
logger.info("getWordsFromCsvBackup");
List words = new ArrayList<>();
@@ -167,7 +167,7 @@ public static List getWordsFromCsvBackup(File csvFile, LetterDao letterDao
Sound sound = soundDao.readByValueIpa(soundsJsonArray.getString(j));
sounds.add(sound);
}
- LetterSoundCorrespondence letterSoundCorrespondence = letterSoundCorrespondenceDao.read(letters, sounds);
+ LetterSoundCorrespondence letterSoundCorrespondence = letterSoundDao.read(letters, sounds);
logger.info("letterSoundCorrespondence.getId(): " + letterSoundCorrespondence.getId());
letterSoundCorrespondences.add(letterSoundCorrespondence);
}
diff --git a/src/main/java/ai/elimu/util/db/DbContentImportHelper.java b/src/main/java/ai/elimu/util/db/DbContentImportHelper.java
index 36bcec843..3e2baf278 100644
--- a/src/main/java/ai/elimu/util/db/DbContentImportHelper.java
+++ b/src/main/java/ai/elimu/util/db/DbContentImportHelper.java
@@ -6,7 +6,7 @@
import ai.elimu.dao.LetterContributionEventDao;
import ai.elimu.dao.LetterDao;
import ai.elimu.dao.LetterSoundCorrespondenceContributionEventDao;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.dao.NumberContributionEventDao;
import ai.elimu.dao.NumberDao;
import ai.elimu.dao.SoundDao;
@@ -67,7 +67,7 @@ public class DbContentImportHelper {
private SoundDao soundDao;
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
private LetterSoundCorrespondenceContributionEventDao letterSoundCorrespondenceContributionEventDao;
@@ -162,12 +162,12 @@ public synchronized void performDatabaseContentImport(Environment environment, L
// Extract and import letter-sound correspondences in src/main/resources/
File letterSoundsCsvFile = new File(contentDirectory, "letter-sounds.csv");
- List letterSoundCorrespondences = CsvContentExtractionHelper.getLetterSoundCorrespondencesFromCsvBackup(letterSoundsCsvFile, letterDao, soundDao, letterSoundCorrespondenceDao);
+ List letterSoundCorrespondences = CsvContentExtractionHelper.getLetterSoundCorrespondencesFromCsvBackup(letterSoundsCsvFile, letterDao, soundDao, letterSoundDao);
logger.info("letterSoundCorrespondences.size(): " + letterSoundCorrespondences.size());
- letterSoundCorrespondenceDao = (LetterSoundCorrespondenceDao) webApplicationContext.getBean("letterSoundCorrespondenceDao");
+ letterSoundDao = (LetterSoundDao) webApplicationContext.getBean("letterSoundDao");
letterSoundCorrespondenceContributionEventDao = (LetterSoundCorrespondenceContributionEventDao) webApplicationContext.getBean("letterSoundCorrespondenceContributionEventDao");
for (LetterSoundCorrespondence letterSoundCorrespondence : letterSoundCorrespondences) {
- letterSoundCorrespondenceDao.create(letterSoundCorrespondence);
+ letterSoundDao.create(letterSoundCorrespondence);
LetterSoundCorrespondenceContributionEvent letterSoundCorrespondenceContributionEvent = new LetterSoundCorrespondenceContributionEvent();
letterSoundCorrespondenceContributionEvent.setContributor(contributor);
@@ -181,7 +181,7 @@ public synchronized void performDatabaseContentImport(Environment environment, L
// Extract and import Words from CSV file in src/main/resources/
File wordsCsvFile = new File(contentDirectory, "words.csv");
- List words = CsvContentExtractionHelper.getWordsFromCsvBackup(wordsCsvFile, letterDao, soundDao, letterSoundCorrespondenceDao, wordDao);
+ List words = CsvContentExtractionHelper.getWordsFromCsvBackup(wordsCsvFile, letterDao, soundDao, letterSoundDao, wordDao);
logger.info("words.size(): " + words.size());
wordDao = (WordDao) webApplicationContext.getBean("wordDao");
wordContributionEventDao = (WordContributionEventDao) webApplicationContext.getBean("wordContributionEventDao");
diff --git a/src/main/java/ai/elimu/web/content/MainContentController.java b/src/main/java/ai/elimu/web/content/MainContentController.java
index af12a5a7a..fcfb86408 100644
--- a/src/main/java/ai/elimu/web/content/MainContentController.java
+++ b/src/main/java/ai/elimu/web/content/MainContentController.java
@@ -13,7 +13,7 @@
import ai.elimu.dao.EmojiDao;
import ai.elimu.dao.ImageDao;
import ai.elimu.dao.LetterDao;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.dao.NumberContributionEventDao;
import ai.elimu.dao.NumberDao;
import ai.elimu.dao.StoryBookContributionEventDao;
@@ -50,7 +50,7 @@ public class MainContentController {
private SoundDao soundDao;
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@Autowired
private NumberDao numberDao;
@@ -119,7 +119,7 @@ public String handleRequest(
model.addAttribute("letterCount", letterDao.readCount());
model.addAttribute("soundCount", soundDao.readCount());
- model.addAttribute("letterSoundCorrespondenceCount", letterSoundCorrespondenceDao.readCount());
+ model.addAttribute("letterSoundCorrespondenceCount", letterSoundDao.readCount());
model.addAttribute("numberCount", numberDao.readCount());
model.addAttribute("syllableCount", syllableDao.readCount());
model.addAttribute("wordCount", wordDao.readCount());
diff --git a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceCreateController.java b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceCreateController.java
index cd8f5d7fb..7c3d851ec 100644
--- a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceCreateController.java
+++ b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceCreateController.java
@@ -16,7 +16,7 @@
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.LetterSoundCorrespondenceContributionEvent;
import ai.elimu.model.enums.Platform;
@@ -36,7 +36,7 @@ public class LetterSoundCorrespondenceCreateController {
private final Logger logger = LogManager.getLogger();
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@Autowired
private LetterSoundCorrespondenceContributionEventDao letterSoundCorrespondenceContributionEventDao;
@@ -76,7 +76,7 @@ public String handleSubmit(
logger.info("handleSubmit");
// Check if the LetterSoundCorrespondence already exists
- LetterSoundCorrespondence existingLetterSoundCorrespondence = letterSoundCorrespondenceDao.read(letterSoundCorrespondence.getLetters(), letterSoundCorrespondence.getSounds());
+ LetterSoundCorrespondence existingLetterSoundCorrespondence = letterSoundDao.read(letterSoundCorrespondence.getLetters(), letterSoundCorrespondence.getSounds());
if (existingLetterSoundCorrespondence != null) {
result.rejectValue("letters", "NonUnique");
}
@@ -95,7 +95,7 @@ public String handleSubmit(
return "content/letter-sound/create";
} else {
letterSoundCorrespondence.setTimeLastUpdate(Calendar.getInstance());
- letterSoundCorrespondenceDao.create(letterSoundCorrespondence);
+ letterSoundDao.create(letterSoundCorrespondence);
LetterSoundCorrespondenceContributionEvent letterSoundCorrespondenceContributionEvent = new LetterSoundCorrespondenceContributionEvent();
letterSoundCorrespondenceContributionEvent.setContributor((Contributor) session.getAttribute("contributor"));
diff --git a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceCsvExportController.java b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceCsvExportController.java
index c39ff05d3..2b470abe7 100644
--- a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceCsvExportController.java
+++ b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceCsvExportController.java
@@ -19,7 +19,7 @@
import org.apache.logging.log4j.LogManager;
import org.json.JSONArray;
import org.springframework.web.bind.annotation.RequestMethod;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
@Controller
@RequestMapping("/content/letter-sound/list")
@@ -28,7 +28,7 @@ public class LetterSoundCorrespondenceCsvExportController {
private final Logger logger = LogManager.getLogger();
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@RequestMapping(value="/letter-sounds.csv", method = RequestMethod.GET)
public void handleRequest(
@@ -37,7 +37,7 @@ public void handleRequest(
) throws IOException {
logger.info("handleRequest");
- List letterSoundCorrespondences = letterSoundCorrespondenceDao.readAllOrderedByUsage();
+ List letterSoundCorrespondences = letterSoundDao.readAllOrderedByUsage();
logger.info("letterSoundCorrespondences.size(): " + letterSoundCorrespondences.size());
CSVFormat csvFormat = CSVFormat.DEFAULT
diff --git a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceEditController.java b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceEditController.java
index 2a78e7fbf..33ffd3370 100644
--- a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceEditController.java
+++ b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceEditController.java
@@ -17,7 +17,7 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.dao.LetterSoundCorrespondencePeerReviewEventDao;
import ai.elimu.dao.WordDao;
import ai.elimu.model.content.Word;
@@ -40,7 +40,7 @@ public class LetterSoundCorrespondenceEditController {
private final Logger logger = LogManager.getLogger();
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@Autowired
private LetterSoundCorrespondenceContributionEventDao letterSoundCorrespondenceContributionEventDao;
@@ -61,7 +61,7 @@ public class LetterSoundCorrespondenceEditController {
public String handleRequest(Model model, @PathVariable Long id) {
logger.info("handleRequest");
- LetterSoundCorrespondence letterSoundCorrespondence = letterSoundCorrespondenceDao.read(id);
+ LetterSoundCorrespondence letterSoundCorrespondence = letterSoundDao.read(id);
model.addAttribute("letterSoundCorrespondence", letterSoundCorrespondence);
model.addAttribute("timeStart", System.currentTimeMillis());
@@ -92,7 +92,7 @@ public String handleSubmit(
logger.info("handleSubmit");
// Check if the LetterSoundCorrespondence already exists
- LetterSoundCorrespondence existingLetterSoundCorrespondence = letterSoundCorrespondenceDao.read(letterSoundCorrespondence.getLetters(), letterSoundCorrespondence.getSounds());
+ LetterSoundCorrespondence existingLetterSoundCorrespondence = letterSoundDao.read(letterSoundCorrespondence.getLetters(), letterSoundCorrespondence.getSounds());
if ((existingLetterSoundCorrespondence != null) && !existingLetterSoundCorrespondence.getId().equals(letterSoundCorrespondence.getId())) {
result.rejectValue("letters", "NonUnique");
}
@@ -115,7 +115,7 @@ public String handleSubmit(
} else {
letterSoundCorrespondence.setTimeLastUpdate(Calendar.getInstance());
letterSoundCorrespondence.setRevisionNumber(letterSoundCorrespondence.getRevisionNumber() + 1);
- letterSoundCorrespondenceDao.update(letterSoundCorrespondence);
+ letterSoundDao.update(letterSoundCorrespondence);
LetterSoundCorrespondenceContributionEvent letterSoundCorrespondenceContributionEvent = new LetterSoundCorrespondenceContributionEvent();
letterSoundCorrespondenceContributionEvent.setContributor((Contributor) session.getAttribute("contributor"));
diff --git a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceListController.java b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceListController.java
index 83877fcfd..9b34314d5 100644
--- a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceListController.java
+++ b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondenceListController.java
@@ -9,7 +9,7 @@
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
@Controller
@RequestMapping("/content/letter-sound/list")
@@ -18,13 +18,13 @@ public class LetterSoundCorrespondenceListController {
private final Logger logger = LogManager.getLogger();
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model) {
logger.info("handleRequest");
- List letterSoundCorrespondences = letterSoundCorrespondenceDao.readAllOrderedByUsage();
+ List letterSoundCorrespondences = letterSoundDao.readAllOrderedByUsage();
model.addAttribute("letterSoundCorrespondences", letterSoundCorrespondences);
int maxUsageCount = 0;
diff --git a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondencePeerReviewsController.java b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondencePeerReviewsController.java
index 7839be625..d8fd8a21b 100644
--- a/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondencePeerReviewsController.java
+++ b/src/main/java/ai/elimu/web/content/letter_sound_correspondence/LetterSoundCorrespondencePeerReviewsController.java
@@ -2,7 +2,7 @@
import ai.elimu.dao.EmojiDao;
import ai.elimu.dao.LetterSoundCorrespondenceContributionEventDao;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.dao.LetterSoundCorrespondencePeerReviewEventDao;
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.LetterSoundCorrespondenceContributionEvent;
@@ -31,7 +31,7 @@ public class LetterSoundCorrespondencePeerReviewsController {
private LetterSoundCorrespondencePeerReviewEventDao letterSoundCorrespondencePeerReviewEventDao;
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@Autowired
private EmojiDao emojiDao;
diff --git a/src/main/java/ai/elimu/web/content/peer_review/LetterSoundCorrespondencePeerReviewEventCreateController.java b/src/main/java/ai/elimu/web/content/peer_review/LetterSoundCorrespondencePeerReviewEventCreateController.java
index 1f1074902..8c847bc5c 100644
--- a/src/main/java/ai/elimu/web/content/peer_review/LetterSoundCorrespondencePeerReviewEventCreateController.java
+++ b/src/main/java/ai/elimu/web/content/peer_review/LetterSoundCorrespondencePeerReviewEventCreateController.java
@@ -1,7 +1,7 @@
package ai.elimu.web.content.peer_review;
import ai.elimu.dao.LetterSoundCorrespondenceContributionEventDao;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.dao.LetterSoundCorrespondencePeerReviewEventDao;
import ai.elimu.model.content.Letter;
import ai.elimu.model.content.LetterSoundCorrespondence;
@@ -37,7 +37,7 @@ public class LetterSoundCorrespondencePeerReviewEventCreateController {
private LetterSoundCorrespondencePeerReviewEventDao letterSoundCorrespondencePeerReviewEventDao;
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@RequestMapping(method = RequestMethod.POST)
public String handleSubmit(
@@ -93,7 +93,7 @@ public String handleSubmit(
} else {
letterSoundCorrespondence.setPeerReviewStatus(PeerReviewStatus.NOT_APPROVED);
}
- letterSoundCorrespondenceDao.update(letterSoundCorrespondence);
+ letterSoundDao.update(letterSoundCorrespondence);
return "redirect:/content/letter-sound/edit/" + letterSoundCorrespondenceContributionEvent.getLetterSoundCorrespondence().getId() + "#contribution-events";
}
diff --git a/src/main/java/ai/elimu/web/content/sound/SoundEditController.java b/src/main/java/ai/elimu/web/content/sound/SoundEditController.java
index edcefd5f2..9a282a478 100644
--- a/src/main/java/ai/elimu/web/content/sound/SoundEditController.java
+++ b/src/main/java/ai/elimu/web/content/sound/SoundEditController.java
@@ -1,6 +1,6 @@
package ai.elimu.web.content.sound;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.dao.SoundContributionEventDao;
import java.util.Calendar;
import javax.servlet.http.HttpSession;
@@ -39,7 +39,7 @@ public class SoundEditController {
private SoundContributionEventDao soundContributionEventDao;
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(Model model, @PathVariable Long id) {
@@ -53,7 +53,7 @@ public String handleRequest(Model model, @PathVariable Long id) {
model.addAttribute("soundContributionEvents", soundContributionEventDao.readAll(sound));
- model.addAttribute("letterSoundCorrespondences", letterSoundCorrespondenceDao.readAll());
+ model.addAttribute("letterSoundCorrespondences", letterSoundDao.readAll());
return "content/sound/edit";
}
@@ -88,7 +88,7 @@ public String handleSubmit(
model.addAttribute("timeStart", System.currentTimeMillis());
model.addAttribute("soundTypes", SoundType.values());
model.addAttribute("soundContributionEvents", soundContributionEventDao.readAll(sound));
- model.addAttribute("letterSoundCorrespondences", letterSoundCorrespondenceDao.readAll());
+ model.addAttribute("letterSoundCorrespondences", letterSoundDao.readAll());
return "content/sound/edit";
} else {
sound.setTimeLastUpdate(Calendar.getInstance());
diff --git a/src/main/java/ai/elimu/web/content/word/WordCreateController.java b/src/main/java/ai/elimu/web/content/word/WordCreateController.java
index 30c9e4523..6f208b732 100644
--- a/src/main/java/ai/elimu/web/content/word/WordCreateController.java
+++ b/src/main/java/ai/elimu/web/content/word/WordCreateController.java
@@ -45,7 +45,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
@@ -62,7 +62,7 @@ public class WordCreateController {
private EmojiDao emojiDao;
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@Autowired
private ImageDao imageDao;
@@ -95,7 +95,7 @@ public String handleRequest(Model model, @RequestParam(required = false) String
model.addAttribute("word", word);
model.addAttribute("timeStart", System.currentTimeMillis());
- model.addAttribute("letterSoundCorrespondences", letterSoundCorrespondenceDao.readAllOrderedByUsage()); // TODO: sort by letter(s) text
+ model.addAttribute("letterSoundCorrespondences", letterSoundDao.readAllOrderedByUsage()); // TODO: sort by letter(s) text
model.addAttribute("rootWords", wordDao.readAllOrdered());
model.addAttribute("emojisByWordId", getEmojisByWordId());
model.addAttribute("wordTypes", WordType.values());
@@ -125,7 +125,7 @@ public String handleSubmit(
if (result.hasErrors()) {
model.addAttribute("word", word);
model.addAttribute("timeStart", request.getParameter("timeStart"));
- model.addAttribute("letterSoundCorrespondences", letterSoundCorrespondenceDao.readAllOrderedByUsage()); // TODO: sort by letter(s) text
+ model.addAttribute("letterSoundCorrespondences", letterSoundDao.readAllOrderedByUsage()); // TODO: sort by letter(s) text
model.addAttribute("rootWords", wordDao.readAllOrdered());
model.addAttribute("emojisByWordId", getEmojisByWordId());
model.addAttribute("wordTypes", WordType.values());
@@ -248,7 +248,7 @@ private void autoSelectLetterSoundCorrespondences(Word word) {
List letterSoundCorrespondences = new ArrayList<>();
- List allLetterSoundCorrespondencesOrderedByLettersLength = letterSoundCorrespondenceDao.readAllOrderedByLettersLength();
+ List allLetterSoundCorrespondencesOrderedByLettersLength = letterSoundDao.readAllOrderedByLettersLength();
while (StringUtils.isNotBlank(wordText)) {
logger.info("wordText: \"" + wordText + "\"");
diff --git a/src/main/java/ai/elimu/web/content/word/WordEditController.java b/src/main/java/ai/elimu/web/content/word/WordEditController.java
index 9d812cc14..c39290bda 100644
--- a/src/main/java/ai/elimu/web/content/word/WordEditController.java
+++ b/src/main/java/ai/elimu/web/content/word/WordEditController.java
@@ -47,7 +47,7 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import ai.elimu.dao.LetterSoundCorrespondenceDao;
+import ai.elimu.dao.LetterSoundDao;
import ai.elimu.util.DiscordHelper;
import ai.elimu.web.context.EnvironmentContextLoaderListener;
@@ -61,7 +61,7 @@ public class WordEditController {
private WordDao wordDao;
@Autowired
- private LetterSoundCorrespondenceDao letterSoundCorrespondenceDao;
+ private LetterSoundDao letterSoundDao;
@Autowired
private AudioDao audioDao;
@@ -104,7 +104,7 @@ public String handleRequest(
model.addAttribute("word", word);
model.addAttribute("timeStart", System.currentTimeMillis());
- model.addAttribute("letterSoundCorrespondences", letterSoundCorrespondenceDao.readAllOrderedByUsage()); // TODO: sort by letter(s) text
+ model.addAttribute("letterSoundCorrespondences", letterSoundDao.readAllOrderedByUsage()); // TODO: sort by letter(s) text
model.addAttribute("rootWords", wordDao.readAllOrdered());
model.addAttribute("emojisByWordId", getEmojisByWordId());
model.addAttribute("wordTypes", WordType.values());
@@ -195,7 +195,7 @@ public String handleSubmit(
if (result.hasErrors()) {
model.addAttribute("word", word);
model.addAttribute("timeStart", request.getParameter("timeStart"));
- model.addAttribute("letterSoundCorrespondences", letterSoundCorrespondenceDao.readAllOrderedByUsage()); // TODO: sort by letter(s) text
+ model.addAttribute("letterSoundCorrespondences", letterSoundDao.readAllOrderedByUsage()); // TODO: sort by letter(s) text
model.addAttribute("rootWords", wordDao.readAllOrdered());
model.addAttribute("emojisByWordId", getEmojisByWordId());
model.addAttribute("wordTypes", WordType.values());
@@ -284,7 +284,7 @@ private void autoSelectLetterSoundCorrespondences(Word word) {
List letterSoundCorrespondences = new ArrayList<>();
- List allLetterSoundCorrespondencesOrderedByLettersLength = letterSoundCorrespondenceDao.readAllOrderedByLettersLength();
+ List allLetterSoundCorrespondencesOrderedByLettersLength = letterSoundDao.readAllOrderedByLettersLength();
while (StringUtils.isNotBlank(wordText)) {
logger.info("wordText: \"" + wordText + "\"");
diff --git a/src/main/webapp/WEB-INF/spring/applicationContext-jpa.xml b/src/main/webapp/WEB-INF/spring/applicationContext-jpa.xml
index 96bff7aa1..575c130e4 100644
--- a/src/main/webapp/WEB-INF/spring/applicationContext-jpa.xml
+++ b/src/main/webapp/WEB-INF/spring/applicationContext-jpa.xml
@@ -58,9 +58,9 @@
-
+
From 110bfbf42e336ebdb8fd2ab5bebc8e0aed0311be Mon Sep 17 00:00:00 2001
From: jo-elimu <1451036+jo-elimu@users.noreply.github.com>
Date: Mon, 30 Oct 2023 22:09:36 +0700
Subject: [PATCH 6/6] refactor: Rename from "Correspondence"
closes #1624
---
.../ai/elimu/rest/v2/JpaToGsonConverter.java | 32 +++++++++----------
.../content/LetterSoundsRestController.java | 2 +-
.../WordContributionRestController.java | 2 +-
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java b/src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java
index 1f7b466c1..e15a619c2 100644
--- a/src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java
+++ b/src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java
@@ -88,31 +88,31 @@ public static SoundGson getSoundGson(Sound sound) {
}
}
- public static LetterSoundCorrespondenceGson getLetterSoundCorrespondenceGson(LetterSoundCorrespondence letterSoundCorrespondence) {
- if (letterSoundCorrespondence == null) {
+ public static LetterSoundCorrespondenceGson getLetterSoundGson(LetterSoundCorrespondence letterSound) {
+ if (letterSound == null) {
return null;
} else {
- LetterSoundCorrespondenceGson letterSoundCorrespondenceGson = new LetterSoundCorrespondenceGson();
+ LetterSoundCorrespondenceGson letterSoundGson = new LetterSoundCorrespondenceGson();
// BaseEntity
- letterSoundCorrespondenceGson.setId(letterSoundCorrespondence.getId());
+ letterSoundGson.setId(letterSound.getId());
- // LetterSoundCorrespondence
+ // LetterSound
List letters = new ArrayList<>();
- for (Letter letter : letterSoundCorrespondence.getLetters()) {
+ for (Letter letter : letterSound.getLetters()) {
LetterGson letterGson = getLetterGson(letter);
letters.add(letterGson);
}
- letterSoundCorrespondenceGson.setLetters(letters);
+ letterSoundGson.setLetters(letters);
List sounds = new ArrayList<>();
- for (Sound sound : letterSoundCorrespondence.getSounds()) {
+ for (Sound sound : letterSound.getSounds()) {
SoundGson soundGson = getSoundGson(sound);
sounds.add(soundGson);
}
- letterSoundCorrespondenceGson.setSounds(sounds);
- letterSoundCorrespondenceGson.setUsageCount(letterSoundCorrespondence.getUsageCount());
+ letterSoundGson.setSounds(sounds);
+ letterSoundGson.setUsageCount(letterSound.getUsageCount());
- return letterSoundCorrespondenceGson;
+ return letterSoundGson;
}
}
@@ -131,12 +131,12 @@ public static WordGson getWordGson(Word word) {
// Word
wordGson.setText(word.getText());
- List letterSoundCorrespondences = new ArrayList<>();
- for (LetterSoundCorrespondence letterSoundCorrespondence : word.getLetterSoundCorrespondences()) {
- LetterSoundCorrespondenceGson letterSoundCorrespondenceGson = getLetterSoundCorrespondenceGson(letterSoundCorrespondence);
- letterSoundCorrespondences.add(letterSoundCorrespondenceGson);
+ List letterSounds = new ArrayList<>();
+ for (LetterSoundCorrespondence letterSound : word.getLetterSoundCorrespondences()) {
+ LetterSoundCorrespondenceGson letterSoundGson = getLetterSoundGson(letterSound);
+ letterSounds.add(letterSoundGson);
}
- wordGson.setLetterSoundCorrespondences(letterSoundCorrespondences);
+ wordGson.setLetterSoundCorrespondences(letterSounds);
wordGson.setWordType(word.getWordType());
return wordGson;
diff --git a/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java b/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
index 27ac11723..7e0437617 100644
--- a/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
+++ b/src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java
@@ -30,7 +30,7 @@ public String handleGetRequest() {
JSONArray letterSoundsJsonArray = new JSONArray();
for (LetterSoundCorrespondence letterSound : letterSoundDao.readAllOrderedByUsage()) {
- LetterSoundCorrespondenceGson letterSoundGson = JpaToGsonConverter.getLetterSoundCorrespondenceGson(letterSound);
+ LetterSoundCorrespondenceGson letterSoundGson = JpaToGsonConverter.getLetterSoundGson(letterSound);
String json = new Gson().toJson(letterSoundGson);
letterSoundsJsonArray.put(new JSONObject(json));
}
diff --git a/src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java b/src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java
index 92177f82e..28b837195 100644
--- a/src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java
+++ b/src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java
@@ -64,7 +64,7 @@ public String getLetterSoundCorrespondences(HttpServletRequest request, HttpServ
JSONArray letterSoundCorrespondencesJsonArray = new JSONArray();
for (LetterSoundCorrespondence letterSoundCorrespondence : letterSoundDao.readAllOrderedByUsage()) {
LetterSoundCorrespondenceGson letterSoundCorrespondenceGson =
- JpaToGsonConverter.getLetterSoundCorrespondenceGson(letterSoundCorrespondence);
+ JpaToGsonConverter.getLetterSoundGson(letterSoundCorrespondence);
String json = new Gson().toJson(letterSoundCorrespondenceGson);
letterSoundCorrespondencesJsonArray.put(new JSONObject(json));
}
|