}
courseData = courses.get(courseId);
if(courseData == null) {
courseData = new HashMap<String, Object>();
Course course = this.serviceLocator.getCourseService().getCourse(courseId, locale);
School school = this.serviceLocator.getSchoolService().getSchool(course.getSchool(), locale);
Provider provider = this.serviceLocator.getProviderService().getProviderById(school.getProvider(), locale);
String townName = school.getContactInfo() != null &&
school.getContactInfo().getCity() != null ?
school.getContactInfo().getCity() : "";
//Town town = this.getTownByName(townName, locale);
Town town = this.serviceLocator.getTerritorialService().getTownsMap(locale).get(townName);
Province province = new Province();
Region region = new Region();
if(town != null && town.getId() != null) {
region = this.serviceLocator.getTerritorialService().getRegionsMap(locale).get(town.getRegion());
province = this.serviceLocator.getTerritorialService().getProvincesMap(locale).get(town.getProvince());
} else {
town = new Town();
}
// Metadata
StringBuffer keyWords = new StringBuffer();
for(Category tag : course.getTags()) {
keyWords.append(tag.getCategory()).append(",");
}
// Create courseData
courseData.put("provider", provider);