use of fi.otavanopisto.muikku.schooldata.entity.Curriculum 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;
}
use of fi.otavanopisto.muikku.schooldata.entity.Curriculum in project muikku by otavanopisto.
the class CoursePickerRESTService method listCurriculums.
@GET
@Path("/curriculums")
@RESTPermit(requireLoggedIn = false, handling = Handling.UNSECURED)
public Response listCurriculums() {
schoolDataBridgeSessionController.startSystemSession();
try {
List<Curriculum> curriculums = courseMetaController.listCurriculums();
List<CoursePickerCurriculum> restCurriculums = new ArrayList<CoursePickerCurriculum>();
for (Curriculum curriculum : curriculums) restCurriculums.add(new CoursePickerCurriculum(curriculum.getIdentifier().toId(), curriculum.getName()));
restCurriculums.sort((CoursePickerCurriculum a, CoursePickerCurriculum b) -> {
return b.getName().compareTo(a.getName());
});
return Response.ok(restCurriculums).build();
} finally {
schoolDataBridgeSessionController.endSystemSession();
}
}
Aggregations