// Create a new CronTaskReport
CronTaskReport report = cronTaskReportService.create();
report.setObject_id(mediationId);
report.setDate(new Date());
report.setType(CronTaskReport.TYPE.INTERNAL_FEED);
MediationService mediationService = mediatorService.getMediationService(mediationId, null);
report.setDescription(new StringBuffer("Creating feed for MediationService ").append(mediationService.getName()).toString());
if(mediationService.getHasFeed()) {
report.setResult("NOOK because has feed.");
cronTaskReportService.save(report);
return;
}
try {
LOGGER.info("Creating feeds for " + mediationService.getName() + " service");
Provider provider = providerService.getProviderByMediationService(mediationId, null);
FeedSchools feedSchools = internalFeedService.createFeedSchools(host, provider, mediationService);
internalFeedService.saveFeedSchools(feedSchools);
HashMap<Long, ExtendedSchool> schools = new HashMap<Long, ExtendedSchool>();
Collection<ExtendedCourse> courses =
extendedCourseService.getCoursesByOwner(mediationService.getId(), null, null);
for(ExtendedCourse course : courses) {
ExtendedSchool school = extendedSchoolService.getSchool(course.getSchool(), Locale.getDefault());
if(school != null) schools.put(school.getId(), school);
}
for(ExtendedSchool school : schools.values()) {