use of ai.elimu.model.gson.content.AllophoneGson in project webapp by elimu-ai.
the class JavaToGsonConverter method getSyllableGson.
public static SyllableGson getSyllableGson(Syllable syllable) {
if (syllable == null) {
return null;
} else {
SyllableGson syllableGson = new SyllableGson();
syllableGson.setId(syllable.getId());
syllableGson.setLocale(syllable.getLocale());
syllableGson.setTimeLastUpdate(syllable.getTimeLastUpdate());
syllableGson.setRevisionNumber(syllable.getRevisionNumber());
syllableGson.setContentStatus(syllable.getContentStatus());
syllableGson.setText(syllable.getText());
List<AllophoneGson> allophones = new ArrayList<>();
for (Allophone allophone : syllable.getAllophones()) {
AllophoneGson allophoneGson = getAllophoneGson(allophone);
allophones.add(allophoneGson);
}
syllableGson.setAllophones(allophones);
syllableGson.setUsageCount(syllable.getUsageCount());
return syllableGson;
}
}
use of ai.elimu.model.gson.content.AllophoneGson in project webapp by elimu-ai.
the class JavaToGsonConverter method getWordGson.
public static WordGson getWordGson(Word word) {
if (word == null) {
return null;
} else {
WordGson wordGson = new WordGson();
wordGson.setId(word.getId());
wordGson.setLocale(word.getLocale());
wordGson.setTimeLastUpdate(word.getTimeLastUpdate());
wordGson.setRevisionNumber(word.getRevisionNumber());
wordGson.setContentStatus(word.getContentStatus());
wordGson.setText(word.getText());
wordGson.setPhonetics(word.getPhonetics());
List<AllophoneGson> allophones = new ArrayList<>();
for (Allophone allophone : word.getAllophones()) {
AllophoneGson allophoneGson = getAllophoneGson(allophone);
allophones.add(allophoneGson);
}
wordGson.setAllophones(allophones);
wordGson.setUsageCount(word.getUsageCount());
wordGson.setWordType(word.getWordType());
wordGson.setSpellingConsistency(word.getSpellingConsistency());
return wordGson;
}
}
use of ai.elimu.model.gson.content.AllophoneGson in project webapp by elimu-ai.
the class JavaToGsonConverter method getLetterGson.
public static LetterGson getLetterGson(Letter letter) {
if (letter == null) {
return null;
} else {
LetterGson letterGson = new LetterGson();
letterGson.setId(letter.getId());
letterGson.setLocale(letter.getLocale());
letterGson.setTimeLastUpdate(letter.getTimeLastUpdate());
letterGson.setRevisionNumber(letter.getRevisionNumber());
letterGson.setContentStatus(letter.getContentStatus());
letterGson.setText(letter.getText());
List<AllophoneGson> allophones = new ArrayList<>();
for (Allophone allophone : letter.getAllophones()) {
AllophoneGson allophoneGson = getAllophoneGson(allophone);
allophones.add(allophoneGson);
}
letterGson.setAllophones(allophones);
letterGson.setBraille(letter.getBraille());
letterGson.setUsageCount(letter.getUsageCount());
return letterGson;
}
}
use of ai.elimu.model.gson.content.AllophoneGson in project webapp by elimu-ai.
the class AllophoneRestController method list.
@RequestMapping("/list")
public String list(HttpServletRequest request, @RequestParam String deviceId, // TODO: checksum,
@RequestParam Locale locale) {
logger.info("list");
logger.info("request.getQueryString(): " + request.getQueryString());
JSONArray allophones = new JSONArray();
for (Allophone allophone : allophoneDao.readAllOrdered(locale)) {
AllophoneGson allophoneGson = JavaToGsonConverter.getAllophoneGson(allophone);
String json = new Gson().toJson(allophoneGson);
allophones.put(new JSONObject(json));
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("result", "success");
jsonObject.put("allophones", allophones);
logger.info("jsonObject: " + jsonObject);
return jsonObject.toString();
}
use of ai.elimu.model.gson.content.AllophoneGson in project webapp by elimu-ai.
the class JavaToGsonConverter method getAllophoneGson.
public static AllophoneGson getAllophoneGson(Allophone allophone) {
if (allophone == null) {
return null;
} else {
AllophoneGson allophoneGson = new AllophoneGson();
allophoneGson.setId(allophone.getId());
allophoneGson.setLocale(allophone.getLocale());
allophoneGson.setTimeLastUpdate(allophone.getTimeLastUpdate());
allophoneGson.setRevisionNumber(allophone.getRevisionNumber());
allophoneGson.setContentStatus(allophone.getContentStatus());
allophoneGson.setValueIpa(allophone.getValueIpa());
allophoneGson.setValueSampa(allophone.getValueSampa());
allophoneGson.setAudio(getAudioGson(allophone.getAudio()));
allophoneGson.setDiacritic(allophone.isDiacritic());
allophoneGson.setSoundType(allophone.getSoundType());
allophoneGson.setUsageCount(allophone.getUsageCount());
return allophoneGson;
}
}
Aggregations