use of ai.elimu.model.content.Allophone in project webapp by elimu-ai.
the class AllophoneCreateController method handleRequest.
@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model) {
logger.info("handleRequest");
Allophone allophone = new Allophone();
model.addAttribute("allophone", allophone);
model.addAttribute("soundTypes", SoundType.values());
return "content/allophone/create";
}
use of ai.elimu.model.content.Allophone in project webapp by elimu-ai.
the class AllophoneEditController method handleRequest.
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(Model model, @PathVariable Long id) {
logger.info("handleRequest");
Allophone allophone = allophoneDao.read(id);
model.addAttribute("allophone", allophone);
model.addAttribute("soundTypes", SoundType.values());
return "content/allophone/edit";
}
use of ai.elimu.model.content.Allophone in project webapp by elimu-ai.
the class AllophoneListController method handleRequest.
@RequestMapping(method = RequestMethod.GET)
public String handleRequest(Model model, HttpSession session) {
logger.info("handleRequest");
Contributor contributor = (Contributor) session.getAttribute("contributor");
// To ease development/testing, auto-generate Allophones
List<Allophone> allophonesGenerated = generateAllophones(contributor.getLocale());
for (Allophone allophone : allophonesGenerated) {
logger.info("allophone.getValueIpa(): /" + allophone.getValueIpa() + "/, allophone.getValueSampa(): " + allophone.getValueSampa());
Allophone existingAllophone = allophoneDao.readByValueIpa(contributor.getLocale(), allophone.getValueIpa());
if (existingAllophone == null) {
allophoneDao.create(allophone);
}
}
List<Allophone> allophones = allophoneDao.readAllOrderedByUsage(contributor.getLocale());
model.addAttribute("allophones", allophones);
int maxUsageCount = 0;
for (Allophone allophone : allophones) {
if (allophone.getUsageCount() > maxUsageCount) {
maxUsageCount = allophone.getUsageCount();
}
}
model.addAttribute("maxUsageCount", maxUsageCount);
return "content/allophone/list";
}
use of ai.elimu.model.content.Allophone in project webapp by elimu-ai.
the class LetterEditController method handleRequest.
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(HttpSession session, Model model, @PathVariable Long id) {
logger.info("handleRequest");
Contributor contributor = (Contributor) session.getAttribute("contributor");
Letter letter = letterDao.read(id);
model.addAttribute("letter", letter);
List<Allophone> allophones = allophoneDao.readAllOrderedByUsage(contributor.getLocale());
model.addAttribute("allophones", allophones);
return "content/letter/edit";
}
use of ai.elimu.model.content.Allophone in project webapp by elimu-ai.
the class StringToAllophoneConverter method convert.
/**
* Convert Allophone id to Allophone entity
*/
public Allophone convert(String id) {
if (StringUtils.isBlank(id)) {
return null;
} else {
Long allophoneId = Long.parseLong(id);
Allophone allophone = allophoneDao.read(allophoneId);
return allophone;
}
}
Aggregations