Search in sources :

Example 1 with PyramusCurriculum

use of fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCurriculum in project muikku by otavanopisto.

the class PyramusCourseMetaSchoolDataBridge method listCurriculums.

@Override
public List<Curriculum> listCurriculums() {
    List<Curriculum> result = new ArrayList<>();
    fi.otavanopisto.pyramus.rest.model.Curriculum[] curriculums = pyramusClient.get("/common/curriculums?filterArchived=true", fi.otavanopisto.pyramus.rest.model.Curriculum[].class);
    if (curriculums != null) {
        for (fi.otavanopisto.pyramus.rest.model.Curriculum curriculum : curriculums) {
            SchoolDataIdentifier identifier = pyramusIdentifierMapper.getCurriculumIdentifier(curriculum.getId());
            result.add(new PyramusCurriculum(identifier, curriculum.getName()));
        }
    }
    return result;
}
Also used : SchoolDataIdentifier(fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier) PyramusCurriculum(fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCurriculum) ArrayList(java.util.ArrayList) Curriculum(fi.otavanopisto.muikku.schooldata.entity.Curriculum) PyramusCurriculum(fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCurriculum)

Example 2 with PyramusCurriculum

use of fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCurriculum in project muikku by otavanopisto.

the class PyramusCourseMetaSchoolDataBridge method findCurriculum.

@Override
public Curriculum findCurriculum(String identifier) {
    Long curriculumId = pyramusIdentifierMapper.getPyramusCurriculumId(identifier);
    fi.otavanopisto.pyramus.rest.model.Curriculum curriculum = pyramusClient.get("/common/curriculums/" + curriculumId, fi.otavanopisto.pyramus.rest.model.Curriculum.class);
    if (curriculum != null) {
        return new PyramusCurriculum(new SchoolDataIdentifier(identifier, getSchoolDataSource()), curriculum.getName());
    }
    return null;
}
Also used : SchoolDataIdentifier(fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier) PyramusCurriculum(fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCurriculum)

Aggregations

PyramusCurriculum (fi.otavanopisto.muikku.plugins.schooldatapyramus.entities.PyramusCurriculum)2 SchoolDataIdentifier (fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier)2 Curriculum (fi.otavanopisto.muikku.schooldata.entity.Curriculum)1 ArrayList (java.util.ArrayList)1