Esempio n. 1
0
  public SynchronizedGroupStatistic synchronizeCourse(CampusCourseImportTO sapCourse) {
    if (sapCourse != null) {
      long resourceableId = sapCourse.getOlatResourceableId();
      log.debug(
          "synchronizeCourse sapCourseId="
              + sapCourse.getSapCourseId()
              + "  resourceableId="
              + resourceableId);
      ICourse course = CourseFactory.loadCourse(resourceableId);
      commitDBImplTransaction();
      log.debug("synchronizeCourse start for course=" + course.getCourseTitle());
      log.debug("synchronizeCourse Lecturer size=" + sapCourse.getLecturers().size());
      log.debug("synchronizeCourse Participants size=" + sapCourse.getParticipants().size());

      courseGroupSynchronizer.addAllLecturesAsOwner(course, sapCourse.getLecturers());
      // SynchronizedGroupStatistic groupStatistic =
      // courseGroupSynchronizer.synchronizeCourseGroupsForStudentsOnly(course, sapCourse);
      SynchronizedGroupStatistic groupStatistic =
          courseGroupSynchronizer.synchronizeCourseGroups(course, sapCourse);
      commitDBImplTransaction();
      log.debug("synchronizeCourse statistic=" + groupStatistic);
      if (campusConfiguration.isSynchronizeTitleAndDescriptionEnabled()) {
        log.debug("SynchronizeTitleAndDescription is enabled");
        courseAttributeSynchronizer.synchronizeTitleAndDescription(
            sapCourse.getSapCourseId(), sapCourse);
        commitDBImplTransaction();
      }
      return groupStatistic;
    } else {
      return SynchronizedGroupStatistic.createEmptyStatistic();
    }
  }
 @SuppressWarnings("deprecation")
 public void createAllCampusCoursesFromTemplate() {
   List<Long> courseIds = daoManager.getAllNotCreatedSapCourcesIds();
   for (Long courseId : courseIds) {
     CampusCourseImportTO campusCourseImportData = daoManager.getSapCampusCourse(courseId);
     if (campusCourseImportData.isOlatResourceableIdUndefined()) {
       if (!campusCourseImportData.getLecturers().isEmpty()) {
         try {
           Identity creator = campusCourseImportData.getLecturers().get(0);
           if (creator != null) {
             campusCourseCoreService.createCampusCourse(
                 null, courseId, creator, campusCourseImportData);
           }
         } catch (Exception ex) {
           LOG.error(ex.getMessage());
         } finally {
           DBFactory.getInstance(false).intermediateCommit();
         }
       }
     }
   }
 }