Search in sources :

Example 1 with CourseIdentifierEntity

use of fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity in project muikku by otavanopisto.

the class CourseIdentifierEntityDAO method create.

public CourseIdentifierEntity create(Boolean archived) {
    CourseIdentifierEntity courseIdentifierEntity = new CourseIdentifierEntity();
    courseIdentifierEntity.setArchived(archived);
    getEntityManager().persist(courseIdentifierEntity);
    return courseIdentifierEntity;
}
Also used : CourseIdentifierEntity(fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity)

Example 2 with CourseIdentifierEntity

use of fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity in project muikku by otavanopisto.

the class DefaultSchoolDataMetaListener method onSchoolDataCourseIdentifierDiscoveredEvent.

public synchronized void onSchoolDataCourseIdentifierDiscoveredEvent(@Observes SchoolDataCourseIdentifierDiscoveredEvent event) {
    String discoverId = "CI-" + event.getDataSource() + "/" + event.getIdentifier();
    if (discoveredCourseIdentifiers.containsKey(discoverId)) {
        event.setDiscoveredCourseIdentifierEntityId(discoveredCourseIdentifiers.get(discoverId));
        return;
    }
    CourseIdentifierEntity entity = courseIdentifierEntityController.findCourseIdentifierEntityBySchoolDataSourceAndIdentifier(event.getDataSource(), event.getIdentifier());
    if (entity == null) {
        entity = courseIdentifierEntityController.createCourseIdentifierEntity(event.getDataSource(), event.getIdentifier());
        discoveredCourseIdentifiers.put(discoverId, entity.getId());
        event.setDiscoveredCourseIdentifierEntityId(entity.getId());
    } else {
        logger.warning("CourseIdentifierEntity " + event.getIdentifier() + "/" + event.getDataSource() + " already exists");
    }
}
Also used : CourseIdentifierEntity(fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity)

Example 3 with CourseIdentifierEntity

use of fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity in project muikku by otavanopisto.

the class CourseIdentifierEntityController method createCourseIdentifierEntity.

public CourseIdentifierEntity createCourseIdentifierEntity(String dataSource, String identifier) {
    SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(dataSource);
    if (dataSource == null) {
        logger.severe("Could not find datasource " + dataSource);
        return null;
    }
    CourseIdentifierEntity courseIdentifierEntity = courseIdentifierEntityDAO.create(Boolean.FALSE);
    courseIdentifierSchoolDataIdentifierDAO.create(schoolDataSource, identifier, courseIdentifierEntity);
    return courseIdentifierEntity;
}
Also used : SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource) CourseIdentifierEntity(fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity)

Aggregations

CourseIdentifierEntity (fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity)3 SchoolDataSource (fi.otavanopisto.muikku.model.base.SchoolDataSource)1